ArticleslgStudy

computer science

LAPACK

LAPACK is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand LAPACK rather than just read about it. In short: 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.

LAPACK — main illustration
LAPACK — illustration

Key takeaways

  • LAPACK belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect LAPACK to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of LAPACK from memory before moving on to harder problems.

Reference excerpt

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. The routines handle both real and complex matrices in both single and double precision. LAPACK relies on an underlying BLAS implementation to provide efficient and portable computational building blocks for its routines. LAPACK was originally written in FORTRAN 77, but moved to Fortran 90 in version 3.2 (2008). It is officially distributed through the Netlib repository. Maintenance work is nowadays done in a GitHub repository. 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 the instruction-level parallelism of modern superscalar processors, 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. Netlib LAPACK is licensed under a three-clause BSD style license, a permissive free software license with few restrictions.

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.

Use with other programming languages and libraries Many programming environments today support the use of libraries with C binding (LAPACKE, a standardised C interface, has been part of LAPACK since version 3.4.0), allowing LAPACK routines to be used directly so long as a few restrictions are observed. Additionally, many other software libraries and tools for scientific and numerical computing are built on top of LAPACK, such as R, MATLAB, and SciPy. Several alternative language bindings are also available:

Armadillo for C++ IT++ for C++ LAPACK++ for C++ Lacaml for OCaml SciPy for Python Gonum for Go PDL::LinearAlgebra for Perl Data Language Math::Lapack for Perl NLapack for .NET CControl for C in embedded systems lapack for rust

Implementations As with BLAS, LAPACK is sometimes forked or rewritten to provide better performance on specific systems. Some of the implementations are:

Accelerate Apple's framework for macOS and iOS, which includes tuned versions of BLAS and LAPACK. Netlib LAPACK The official LAPACK. Netlib ScaLAPACK Scalable (multicore) LAPACK, built on top of PBLAS. Intel MKL Intel's Math routines for their x86 CPUs. OpenBLAS Open-source reimplementation of BLAS and LAPACK. Gonum LAPACK A partial native Go implementation. Since LAPACK typically calls underlying BLAS routines to perform the bulk of its computations, simply linking to a better-tuned BLAS implementation can be enough to significantly improve performance. As a result, LAPACK is not reimplemented as often as BLAS is.

Similar projects These projects provide a similar functionality to LAPACK, but with a main interface differing from that of LAPACK:

Libflame A dense linear algebra library. Has a LAPACK-compatible wrapper. Can be used with any BLAS, although BLIS is the preferred implementation. Eigen A header library for linear algebra. Has a BLAS and a partial LAPACK implementation for compatibility. MAGMA Matrix Algebra on GPU and Multicore Architectures (MAGMA) project develops a dense linear algebra library similar to LAPACK but for heterogeneous and hybrid architectures including multicore systems accelerated with GPGPUs. PLASMA The Parallel Linear Algebra for Scalable Multi-core Architectures (PLASMA) project is a modern replacement of LAPACK for multi-core architectures. PLASMA is a software framework for development of asynchronous operations and features out of order scheduling with a runtime scheduler called QUARK that may be used for any code that expresses its dependencies with a directed acyclic graph.

See also

List of numerical libraries List of open-source mathematical libraries Math Kernel Library (MKL) NAG Numerical Library SLATEC, a FORTRAN 77 library of mathematical and statistical routines QUADPACK, a FORTRAN 77 library for numerical integration

References

Illustrations

LAPACK illustration

Worked examples

Example 1 — a first encounter with LAPACK

Start with the simplest possible case. Write down what LAPACK claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to LAPACK before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about LAPACK ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of LAPACK

In research
LAPACK appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses LAPACK in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
LAPACK is common in secondary-school and first-year university syllabi. It links to neighbouring topics Fortran libraries, Free software programmed in Fortran, Numerical linear algebra, so understanding it makes those chapters shorter.
In everyday life
Look for LAPACK outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.

Affiliate

Preply — study more efficiently by working with a personal tutor. 50% off.

How to study LAPACK in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what LAPACK means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain LAPACK out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is LAPACK in simple terms?

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.

Why does LAPACK matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study LAPACK?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on LAPACK.

Tags

  • Fortran libraries
  • Free software programmed in Fortran
  • Numerical linear algebra
  • Numerical software
  • Software using the BSD license

Keep exploring