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 Windows1 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, $root=expand_path('<IDL_DEFAULT>', /dlm)) 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[0]) 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 is a more generic routine as an example of calling into LAPACK that works on Linux and OS X.

1. Please let me know if you have a way to do this on Windows!