Cyrus Harmon's Lisp Matrix Package


I'm sure this has been a written a thousand times before, but, partially because I need such a thing and partially as an exercise in both LISP programming and matrix operations, I have written a common-lisp package for matrix operations

The package consists of common-lisp classes, methods and functions for creating and operating on matrices. The package is called "matrix" and the core class is "matrix". Perhaps I should use a less generic name. Let me know if the name causes problems.


Supported Implementations




matrix Class

simple-matrix class

Programming Notes

Representing Matrices


Matrix Operations

Matrix Conversion

Implementation Notes

Type-specific matrix functions

The general strategy has been to 1) make things work and then make them work quickly. To this end, I have been writing functions for matrix operations in a general manner first and then recoding type-specific versions to make certain operations go faster. This is done via liberal use of macros to generate type-specific functions and methods for matrix operations that go much faster than the general versions.

The convention is that a generic function such as sum-range will have a generic version that works with all matrices and type specific versions thaqt work with specific matrices. g In order to support these functions there may be internal methods, prefixed with a %, that implement certain type-specific functionality. Macros that generate the code used for the type-specific methods will be prefixed with a %%. In theory, the %%-macros can be called from other code that need to generate in-place code where the overhead of the method-call to the %-method would be too expensive. This convention is not yet widely enforced and certainly untested. Hopefully this situation will improve.

Cyrus Harmon
Last modified: Fri May 7 13:28:51 PDT 2004