This is a set of (very few) SBCL bindings for BLAS/LAPACK. I just add whatever I need manually. This should be mostly for tests, so as not to make libraries reliant on SBCL-specific code.
dgemm
dgesv
dgemm a b &key transa transb alpha beta c => x
Perform dgemm,
double-float matrix multiplication:
- a, b, c: Native 2D Common Lisp matrices of
double-float
elements. The rows and columns are multiplied as expected in matrix multiplication. - transa, transb: Case-insensitive. Can be
"n"
for no transposition to apply."t"
or"c"
to apply a transposition. - alpha, beta:
double-float
scalars. - x: Result matrix.
dgesv a b => x
Perform dgesv.
Solve the linear system of equations for x:
- a, b: Native 2D matrices of
double-float
elements. a is necessarily square. b can have as many columns as right-hand sides. - x: The sets of solutions, in columns, same indices as right-hand sides in b.
dgetrf a => lu ipiv
Perform dgetrf. LUP decomposition of matrix A. Returns L and U stored in a single matrix lu with the unit elements of L omitted. ipiv is the row swap vector to apply in sequence to lu in order to find A. We retrieve A with A = P.L.U. Error whenever A is (exactly) singular.
- a: Native 2D matrices of
double-float
elements. a is necessarily square and non-singular. - lu: L and U matrices stored as a single square matrix.
- ipiv: Row permutations sequence.
LAPACK and BLAS should be installed on the system.
sbcl-lapack
:
sbcl-lapack/test
:
(asdf:test-system "sbcl-lapack")
As far as possible, I try to:
- Use functional calls.
- Hide the return codes, turn them into errors and warnings.
- The results are put in matrices with copying. Performance could be marginally improved.
- It is possible to make the system crash by providing wrong user inputs. I try to catch the most common mistakes though.
- https://www.netlib.org/lapack/explore-html/index.html Documentation for LAPACK/BLAS routines.