LAPACK User's Guide Numerical Algorithms Group logo

LAPACK and NAG Fortran Libraries

on the Kent Math/CS Computer Network

The LAPACK and NAG Fortran Libraries contain a wealth of mathematical software and can be called by (user-written) C or Fortran programs.  LAPACK emphasizes numerical linear algebra (linear systems of equations, matrix factorizations, linear least-squares problems, algebraic eigenvalue problems, singular value decomposition, etc.).  It is public-domain software, with source code and other information available from the Netlib software repository in the LAPACK subdirectoryLAPACK comes with most Linux distributions; rpm's can also be found using rpmfind.

The NAG Fortran Library is a comprehensive mathematical and statistical software library.  In addition to numerical linear algebra, it contains mathematical software for root finding and nonlinear systems, Fast Fourier Transforms, quadrature, ordinary and partial differential equations, interpolation, curve and surface fitting, and optimization.  It also contains statistical software, including regression analysis, multivariate statistical analysis, analysis of variance, nonparametric statistics, contingency tables, and time series.  The NAG Library is a commercial package, developed by the Numerical Algorithms Group.  A very old version (Mark 14, 1990) is installed on some machines on our network.

Current releases of the NAG software library are available (for legitimate educational and/or research use) through the Ohio Supercomputer Center's (OSC) "Statewide Software License" program.  A portion of the NAG Library is also accessible from inside the Maple computer algebra system, which also is installed on our network.  For information on accessing Maple on our network, see here.

Compiled library archives, for both LAPACK and NAG, are installed on the main servers on our Math/CS network:

Backup copies (and some README and make info) are in the automounted subdirectories /vol/lapack/ and /vol/nag/.


Usage

The standard usage is to call one (or more) of the library procedures/subprograms from a user-written driver program.  This program can be in C or Fortran (or another language).  The appropriate compiler is invoked in a standard way.  The linker/loader (which is usually automatically invoked by the compiler upon successful compilation) must be directed to search the appropriate library archive to resolve these calls ("external references").  Most of the LAPACK routines in addition call auxiliary Basic Linear Algebra Subprograms (BLAS).  Manufacturer-supplied versions of these exist on the HP's; while locally or distro/rpm-installed versions are on the Linux machines.  On the HP's, the LAPACK and NAG libraries are not in the standard load path, and so one must communicate this additional information to the linker/loader.  Here are some typical examples: Some simple illustrations of this (and other compiling/linking options) can be found in the test programs test_la.c, test_la.cpp, test_la.f, test_nag.c, and test_nag.f.

In calling Fortran programs from C programs, one needs to take into account certain differences between the two languages, in particular, all input and/or output arguments in Fortran are passed by reference, and arrays in Fortran are stored in column-major order (whereas C stores arrays in row-major order).  Aspects of dealing with these differences are indicated in the test/example programs above.

For LAPACK, instead of using the pre-compiled libraries (as described above), one can also download (from the LAPACK subdirectory at Netlib) the Fortran source code for the routines you need to use and simply compile them together with your driver routine.  Since most of the LAPACK routines also call other (lower-level or auxiliary) routines, you should to be sure to click to download the routines "plus dependenices."


Documentation and References

On-line UNIX manual (man) pages are available for the LAPACK and BLAS routines--only a restricted set of the BLAS man pages are on the Linux machines.  These all can be accessed by typing, for example or
% man lapack
for general information.

Other examples:

% man ddot
to obtain information (calling sequence, input/output argument list) for the BLAS routine to calculate the real double-precision dot product of two vectors, or
% man cgesv
for the LAPACK routine to solve a general complex single-precision system of linear equations.

The LAPACK man pages on the HP machines are locally installed.  For the man utility to find them, their location must be properly incorporated into the MANPATH environment variable.  This should happen automatically if your .cshrc or .login (or .bashrc or .bash_profile or ... ) script sources in the file /etc/MANPATH.  Alternately, or if you have problems, you can add the directory manually (or in your .cshrc or .login or ... file) via (csh/tcsh syntax)

or (bash/sh syntax)

% export MANPATH=${MANPATH}:/vol/lapack/man

See Help with Login Scripts for more help on this.

The most complete information on the LAPACK Library is contained in the LAPACK Users' Guide, 3rd Edition, which is available in hard copy (from SIAM Publications--you can probably borrow a copy from one of the numerical analysts in our department) or in on-line version (at the link above).

There are no on-line man pages for the NAG Library.  Usage notes can be found in the subdirectory /vol/nag/doc/ (see in particular the "Essential Introduction" essint and the "User's Note" un).  An extensive collection of examples is in /vol/nag/examples/.  The most complete documentation consists of the multi-volume hard-copy set in our Documentation Room: room 313A, the last side room in the Math/CS Library.  The library/mailroom key (which is issued to all Math/CS faculty and graduate students) will open this room.  If you do not have one of these keys, then you will need to see a secretary in the Math/CS Main Office (room 233) to borrow one.  The best place to start is the spiral-bound NAG Fortran Library Introductory Guide - Mark 14, which you can also borrow from one of the numerical analysts.


Getting Help

General help concerning our network and systems is available on the Departmental Home Page and in the on-line System Information. Avenues to other sources of help and support are available here.


Chuck Gartland / gartland@math.kent.edu
June, 1999 (original version)
July, 2004 (latest revision)