»  Home »  Products »  Stata 17 »  Intel Math Kernel Library (MKL)

Intel Math Kernel Library (MKL)


  • Greatly improved performance for Mata functions and operators using LAPACK routines
  • Up-to-date algorithm updates and improvements of LAPACK routines

Stata 17 provides deeply optimized LAPACK routines by using the Intel Math Kernel Library (MKL) on compatible hardware (all Intel- and AMD-based 64-bit computers).

LAPACK (Linear Algebra PACKage) is a freely available set of routines for solving systems of simultaneous equations, eigenvalue problems, and singular value problems, among others. Mata operators and functions qrd(), lud(), cholesky(), etc., leverage LAPACK where possible for many numerical operations.

LAPACK backed by the Intel MKL provides the latest LAPACK routines heavily optimized for the 64-bit Intel x86-64 instruction set used by both modern Intel and modern AMD processors. Mata functions and operators using MKL benefit greatly in terms of performance.

For example:

Timing of multiplication of two real matrices in seconds:

Edition Size MKL non-MKL
MP8 5,000 by 5,000 2.55 10.26
MP8 10,000 by 10,000 17.28 85.60
MP4 5,000 by 5,000 3.62 15.95
MP4 10,000 by 10,000 28.22 127.24
SE 5,000 by 5,000 13.64 70.61
SE 10,000 by 10,000 108.33 566.99
Timings run in Windows 10 on a computer with an i9-9900KS processor at 4.00GHz and 64GB RAM

Timing of cholesky() in seconds:

Edition Size MKL non-MKL
MP8 5,000 by 5,000 0.42 16.69
MP8 10,000 by 10,000 2.91 133.60
MP4 5,000 by 5,000 0.69 16.69
MP4 10,000 by 10,000 5.03 133.70
SE 5,000 by 5,000 2.41 18.62
SE 10,000 by 10,000 16.66 133.63
Timings run in Windows 10 on a computer with an i9-9900KS processor at 4.00GHz and 64GB RAM

And most importantly, you don't need to do anything to take advantage of the speed gains. Stata commands using these Mata functions and operators, and the Mata functions and operators themselves, will automatically use the Intel MKL on compatible hardware.

See what users are saying.


Anderson, E., Z. Bai, C. Bischof, S. Blackford, J. Demmel, J. J. Dongarra, J. Du Croz, A. Greenbaum, S. Hammarling, A. McKenney, and D. Sorensen. 1999. LAPACK Users’ Guide. 3rd ed. Philadelphia: Society for Industrial and Applied Mathematics.

Rosenquist, T. 2011. Getting reproducible results with Intel MKL. https://software.intel.com/content/www/us/en/develop/articles/getting-reproducible-results-with-intel-mkl.html.

Intel oneAPI Math Kernel Library. https://software.intel.com/content/www/us/en/develop/tools/oneapi/components/onemkl.html.

Additional resources

Mata Reference Manual

Learn more about Mata's use of LAPACK in the Mata manual; see [M1] LAPACK .





The Stata Blog: Not Elsewhere Classified Find us on Facebook Follow us on Twitter LinkedIn YouTube Instagram
© Copyright 1996–2021 StataCorp LLC   •   Terms of use   •   Privacy   •   Contact us