Using Lapack Routines in Fortran Programs

The problem of using external libraries can be divided into two parts, how to call the routines in your program and how to compile this program.

LAPACK routines are written in Fortran 77 and so you can use them pretty much the same way you use the inbuild functions of Fortran. Finding the eigenvalues of a matrix works the same way you would find the squareroot of a number, you just need a lot more arguments to pass to the LAPACK routine.

When you compile a Fortran program the compiler searches for the definition of the functions in your program in a set of predefined libraries. If you want to use additional libraries, like the LAPACK library, you have to tell the compiler explicitly which library to use and sometimes where to find this library. The exact procedure of compiling your program may depend on your system and how LAPACK was installed on it.


Simple Fortran programs using LAPACK


Back to the LAPACK page