Lisplab

A mathematics library for Common Lisp

Lisplab is a mathematics library in Common Lisp released under the GNU General Public License (GPL) and hosted at common-lisp.net. Lisplab is based on code from Matlisp, but has now moved quite far from the original code mass.

The main purpose of Lisplab is to provide a framwork for mathematical computations. This means that it should be easy to create and manipulate mathematical objects and that naming of classes and functions should be consistent and clear. Lisplab is heavily based on CLOS.

Lisplab contains

The part of Lisplab which is most mature is the matrix and linear algebra, and these should provide a good basis for matrix based modelling.

Installing

Lisplab is installed by asdf. The external libraries, BLAS, LAPACK, and FFTW must be installed separately. They make Lisplab more powerful, but it also makes sense to run it without external libraries. Lisplab is mainly ANSI compliant and does not depend on any other Common Lisp projects, but it has so far only been tested on SBCL, so for other Lisps you must expect some hacking to make it build.

See manual for details.

Getting started

On SBCL, make sure that asdf:*central-registry* contains lisplab.asd. Then you install it by
   > (require :lisplab)
and use it by
   > (use-package :ll-user)
When compiling for the first time you must have *read-default-float-format* set to 'double-float because the generated slatec code requires it. When started, you can do
  LL-USER> (.^ (dmat (1 2) (3 4)) 2)
  #<MATRIX-DGE  2x2
    1.0 4.0 
    9.0 16.0 
  {B7E3E71}>
Common operations are
  .+ .- .* ./ .^ 
  .expt .sqrt .log
  .sin .cos .tan .asin .acos .atan
  .sinh .cosh .tanh .asinh .acosh .atanh
  .besj .besy .besi .besk .besh 
  .gamma .erf .erfc
  mref vref 
  size dim rows cols rank
  mmap
  make-matrix-instance
  dnew dmat dcol drow
  znew zmat zcol zrow
  mnew mmat mcol mrow
  mmax mmin circ-shift pad-shift
  m* m/ minv mtp mct 
  eivenvalues eigenvectors 
  LU-factor
  dlmread dlmwrite pswrite pgmwrite
  export-list import-list
  fftw1 ifftw1 
  fftw2 ifftw2 
  fft-shift ifft-shift
  rk4 euler
  w/infix

Performance

Performance should be quite good (at least on SBCL) since Lisplab's main usage has been to solve partial differential equations in physics.

The graph below compares matrix inversion scalability between the Lapack FFI, and two native implementations: one typed and one untyped. All graphs scale as O(n3), but we see that the untyped version is hopelessly slow, while the typed version is a factor 10 slower than Lapack, which is rather good, and means that it is usable for high performance computing.


Documentation

The manual is in html and in pdf.

Module documentation is generated with Tinaa.

Download

Tarballs are here.

Subversion

You can browse the svn repository or check out the latest development tree from anonymous svn,

  % svn checkout svn://common-lisp.net/project/lisplab/svn lisplab
or if you want just the latest version,
  % svn checkout svn://common-lisp.net/project/lisplab/svn/trunk lisplab

Mailing Lists


Links

Other mathematics resources for Common Lisp
Valid XHTML 1.0 Strict