# LAPACK

Initial release 1992; 27 years ago 3.9.0 / 21 November 2019; 21 days ago Fortran 90 Software library BSD-new www.netlib.org/lapack/

LAPACK (Linear Algebra Package) is a standard software library for numerical linear algebra. It provides routines for solving systems of linear equations and linear least squares, eigenvalue problems, and singular value decomposition. It also includes routines to implement the associated matrix factorizations such as LU, QR, Cholesky and Schur decomposition. LAPACK was originally written in FORTRAN 77, but moved to Fortran 90 in version 3.2 (2008).[1] The routines handle both real and complex matrices in both single and double precision.

LAPACK was designed as the successor to the linear equations and linear least-squares routines of LINPACK and the eigenvalue routines of EISPACK. LINPACK, written in the 1970s and 1980s, was designed to run on the then-modern vector computers with shared memory. LAPACK, in contrast, was designed to effectively exploit the caches on modern cache-based architectures, and thus can run orders of magnitude faster than LINPACK on such machines, given a well-tuned BLAS implementation. LAPACK has also been extended to run on distributed memory systems in later packages such as ScaLAPACK and PLAPACK.[2]

## Naming scheme

Subroutines in LAPACK have a naming convention which makes the identifiers very compact. This was necessary as the first Fortran standards only supported identifiers up to six characters long, so the names had to be shortened to fit into this limit.

A LAPACK subroutine name is in the form `pmmaaa`, where:

• `p` is a one-letter code denoting the type of numerical constants used. `S`, `D` stand for real floating point arithmetic respectively in single and double precision, while `C` and `Z` stand for complex arithmetic with respectively single and double precision. The newer version, LAPACK95, uses generic subroutines in order to overcome the need to explicitly specify the data type.
• `mm` is a two-letter code denoting the kind of matrix expected by the algorithm. The codes for the different kind of matrices are reported below; the actual data are stored in a different format depending on the specific kind; e.g., when the code `DI` is given, the subroutine expects a vector of length `n` containing the elements on the diagonal, while when the code `GE` is given, the subroutine expects an n×n array containing the entries of the matrix.
• `aaa` is a one- to three-letter code describing the actual algorithm implemented in the subroutine, e.g. `SV` denotes a subroutine to solve linear system, while `R` denotes a rank-1 update.

For example, the subroutine to solve a linear system with a general (non-structured) matrix using real double-precision arithmetic is called `DGESV`.

Matrix types in the LAPACK naming scheme
Name Description
BD bidiagonal matrix
DI diagonal matrix
GB general band matrix
GE general matrix (i.e., unsymmetric, in some cases rectangular)
GG general matrices, generalized problem (i.e., a pair of general matrices)
GT general tridiagonal matrix
HB (complex) Hermitian band matrix
HE (complex) Hermitian matrix
HG upper Hessenberg matrix, generalized problem (i.e. a Hessenberg and a triangular matrix)
HP (complex) Hermitian, packed storage matrix
HS upper Hessenberg matrix
OP (real) orthogonal matrix, packed storage matrix
OR (real) orthogonal matrix
PB symmetric matrix or Hermitian matrix positive definite band
PO symmetric matrix or Hermitian matrix positive definite
PP symmetric matrix or Hermitian matrix positive definite, packed storage matrix
PT symmetric matrix or Hermitian matrix positive definite tridiagonal matrix
SB (real) symmetric band matrix
SP symmetric, packed storage matrix
ST (real) symmetric matrix tridiagonal matrix
SY symmetric matrix
TB triangular band matrix
TG triangular matrices, generalized problem (i.e., a pair of triangular matrices)
TP triangular, packed storage matrix
TR triangular matrix (or in some cases quasi-triangular)
TZ trapezoidal matrix
UN (complex) unitary matrix
UP (complex) unitary, packed storage matrix

Details on this scheme can be found in the Naming scheme section in LAPACK Users' Guide.

## Use with other programming languages

Many programming environments today support the use of libraries with C binding. The LAPACK routines can be used like C functions if a few restrictions are observed.

Several alternative language bindings are also available: