Possible an open-ended question, but I am wondering if most statistical packages and libraries, for instance, Stata, R, Python's NumPy and MATLAB rely on LAPACK algorithms to perform matrix operations, including inverting a matrix.


2 Answers 2


tl;dr Yes.

But your question doesn't make it clear that you understand what LAPACK is about. LAPACK is both a software as well as an interface. That is, the operations that LAPACK defines are standard enough that they can be replaced by other software, such as ATLAS, MKL, and so on. Another way of looking at this is that any software that does linear algebra implicitly uses an LAPACK-esque interface. Given this, you might also be asking how each of the languages/tools you name instantiates this interface.



NumPy does not require any external linear algebra libraries to be installed. However, if these are available, NumPy’s setup script can detect them and use them for building. A number of different LAPACK library setups can be used, including optimized LAPACK libraries such as ATLAS, MKL or the Accelerate/vecLib framework on OS X. [link]

How to see your configuration: np.show_config()



The precompiled R distribution that is downloaded from CRAN makes use of the reference BLAS/LAPACK implementation for linear algebra operations, These implementations are built to be stable and cross platform compatible but are not optimized for performance. Most R programmers use these default libraries and are unaware that highly optimized libraries [with BLAS/LAPACK interfaces] are available and switching to these can have a significant perfomance improvement. [link]

How to see your configuration: sessionInfo()

Matlab (But why?)


In the year 2000, MATLAB migrated to using LAPACK, which is the modern replacement for LINPACK and EISPACK. It is a large, multi-author, Fortran library for numerical linear algebra. LAPACK was originally intended for use on supercomputers because of its ability to operate on several columns of a matrix at a time. The speed of LAPACK routines is closely connected to the speed of the Basic Linear Algebra Subroutines (BLAS). The BLAS version is typically hardware-specific and highly optimized. [link]

Another Description:

The three versions are:

Current (blue): The numerics library included with MATLAB version 5.3

Reference (green): A new numerics library based on LAPACK and machine-independent Fortran Reference BLAS

Optimized (red): A new numerics library based on LAPACK and BLAS optimized for each particular computer.


How to see you configuration: version -lapack


Who knows? I suggest using R.

  • 1
    $\begingroup$ Thanks. What I meant is, for instance, the distinction between Python's 'scipy.linalg' and 'numpy.linalg' matrix inversion functions differences. From the scipy documentation: "scipy.linalg documecontains all the functions in numpy.linalg. plus some other more advanced ones not contained in numpy.linalg Another advantage of using scipy.linalg over numpy.linalg is that it is always compiled with BLAS/LAPACK support, while for numpy this is optional. Therefore, the scipy version might be faster depending on how numpy was installed." $\endgroup$ Oct 15, 2019 at 16:23

To add to the above, Stata, in its matrix programming language Mata, uses BLAS and LAPACK. It includes the reference implementations on all platforms, as well as Intel's MKL implementations on platforms where it's available (x86 and amd64).

Source: Stata documentation


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.