Saturday, January 12, 2008

announcement: cl-sparsematrix

Lately I have been working on algorithms that solve Hamilton-Bellman-Jacobi equations (that describe optimal control problems in continuous time) using the methods of Kushner and Dupuis, which involve sparse stochastic matrices. The sparse matrix code has stabilized to the point that I cleaned it up today and decided to make it available as a library, in ASDF-installable form. The package is called cl-sparsematrix, and has the following features:
  • generalized sparse matrices: elements don't have to be numbers, but can be any object (eg functions for parametrized sparse matrices), of course you have to define what you mean by zero in this case
  • utility functions for creating, mapping, traversing or copying sparse matrices
  • numerical operations that make sense for numerical sparse matrices (elementwise addition, subtraction and multiplication, row and column sums, multiplication of rows by corresponding elements in a vector, vector-matrix and matrix-vector products)
  • a simple interface for UMFpack for solving sparse systems (uses cffi and ffa)
You will find an introduction to the main concepts in the code as a PDF file in the documentation/ directory. As usual, comments and suggestions are appreciated.


  1. Hi Tamas,

    I'm interested in solving sparse matrices in Lisp (CLISP). I've installed your library (plus the 11 or 12 dependencies ... at least they're there for others now...), but I haven't got libblas.dll, or libamd.dll, or possibly other dll's that are required. Have you got copies of the dlls that I can use? Or, could you help me make sense of all of the confusing blas pages? (I learnt C++ programming as a hobby, so I'm not very familiar with all that stuff by myself)


  2. Any chance you could release the last version of cl-sparsematrix as an archive in some form? It would be very useful to have the minimal routines you describe in Lisp to help bootstrap my thinking about an implementation I want to play around with a bit.