git clone ''

(ql:quickload :cl-blapack)

-- mode: text --

This is an alpha release of cl-blapack, a wrapper around the Fortran BLAS and LAPACK libraries for dense linear algebra.

The software relies on org.middle-angle.foreign-numeric-vector for foreign (non-Lisp heap) storage, and CFFI.

The software generates CFFI interfaces by parsing the Fortran reference implementation of LAPACK (available at I include files blas-cffi.lisp and lapack-cffi.lisp which are the results of this parsing. If you want to regenerate your own, download LAPACK, load the system, and run

(generate-blapack-interface:generate-blapack-files #p“/path/to/LAPACK”)

In general, users should not need to do this — the supplied interface files should work fine. To load the interface, load system.

To see an example, load the system, and execute


The cl-blapack library allows one to write Fortran-style code to call BLAS and LAPACK. There is one convenience — scalar arguments are automatically packaged by the system into foreign-numeric-vectors of length 1 (see blapack-cffi-types.lisp); this may possibly be a source of inefficiency if we are making frequent small calls to the libraries.

NOTE: As of this writing, the code is only sure to work with SBCL. We need to make sure that floating-point traps are turned off. To add support for another implementation, write the appropriate version of with-blapack in cl-blapack.lisp (it's a NOOP for non-SBCL right now). The code has been tested (the example runs) under recent SBCLs on both x86 and x86-64 machines.

NOTE: We assume that BLAS/LAPACK have been compiled so that all integers (representing indexes into arrays) are 32-bit. This seems to be the case currently even on 64-bit machines, but we need to monitor this as it could change in the future.

This software is released under the modified-BSD license (no advertising clause), see LICENSE for details.

As of 04 November 2006, this code is available at

All comments, suggestions, performance reports, and assistance should be sent to