The foreign function interface comes from Matlisp and is mainly on level 3. The elements of Lisplab typed matrices (double-float and complex double-float) are stored as 1D simple arrays, and most Lisps will then have a SAP inside the array pointer which is binary compatible with Fortran. This adds some overhead to matrix element references, but simplifies the memory management considerably compared to a bare pointer type. Also, it is important to avoid pointers from being moved by the garbage collector. In Matlisp, this was handled by stopping the garbage collector, but a more smoother and better way would be to just pin the pointers in action.
Lisplab has an extra layer with Fortran compatibility above the ordinary C FFI. This layer is mainly unchanged compared to Matlisp, but only the SBCL FFI is distributed with Lisplab.
The FFI for FFTW is a mock-up for SBCL, and it only is for standard complex transforms and inverse transforms. Of course, a lot more can be done, but this simple version works quite OK. In long term the SBCL FFI should be replaced with a general one.
To request usage of more threads, call
Currently only the calls to FFTW will react to this.
There is draft code for symbolic calculations, but it is not yet included in the build. The symbolic code need not know anything about the rest of Lisplab, except for the generic methods of the dotted algebra (The level 0).
(.+ (lambda (x) (+ x 1)) 3)and get a new functions as result. It might even be possible to make beautiful optimizations this way.