The LAPACK library is distributed along with IDL, but wrappers to most of the routines are not provided. On Linux, `CALL_EXTERNAL` can be used to easily access any of the routines. On OS X, the Accelerate Framework can be used. I have not found a solution for Windows[^1] since the needed symbols in the DLL provided by IDL aren't exported.
In the following code example for Linux, we will call [SGEQRF] to determine the QR factorization of a given matrix. First, we need to specify the location of the LAPACK library:
ext = !version.os_family eq 'unix' ? '.so' : '.dll'
lapack = filepath('idl_lapack' + ext, $
m = 20L
n = 10L
x = randomu(seed, m, n)
info = 0L
tau = fltarr(m < n) lwork = -1L work = fltarr(1) status = call_external(lapack, 'sgeqrf_', m, n, x, m, tau, work, lwork, info, $ value=[0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L], $ /auto_glue) lwork = long(work) work2 = fltarr(lwork) status = call_external(lapack, 'sgeqrf_', m, n, x, m, tau, work2, lwork, info, $ value=[0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L], $ /auto_glue) [Here][MG_CALL_LAPACK_EXAMPLE] is a more generic routine as an example of calling into LAPACK that works on Linux and OS X. [LAPACK docs]: http://www.netlib.org/lapack/explore-html/ "Explore LAPACK code" [SGEQRF]: http://www.netlib.org/lapack/explore-html/df/d97/sgeqrf_8f.html "SRC/sgeqrf.f" [MG_CALL_LAPACK_EXAMPLE]: http://michaelgalloy.com/wp-content/uploads/2014/04/mg_call_lapack_example.pro "mg_call_lapack_example.pro" [^1]: Please let me know if you have a way to do this on Windows!