Next: , Previous: Tutorial, Up: Top

4 Structure

4.1 Design principles

High level principles

General design principles

Design principles for the matrix code

4.2 Package structure

So far, there is only one main package, called, you might guess it: lisplab. Except from that there are only a few special packages for generated code and FFIs: Slatec, Blas, and FFTW. For test code an applications you have the package lisplab-user.

4.3 The four levels, 0 – 3.

The Lisplab matrix and linear algebra code has a layered structure with four levels, 0 – 3, where

The levels are unequal in size: level 0 is potentially large, level 1 is small, level 2 and 3 are large.

The intention with the structure are the following

The filenames often also denote the levels. If a filename does not denote the level, it is most probably level 3, or outside the level system (non matrix code).

4.4 Matrix class hierarchy

All matrices are subclasses of matrix-base, and as far as possible the generic functions specialize on one or many of its subclasses.

The matrix class hierarchy has three independent lines of inheritance

The structure is inspired by the stream example in Object-Oriented Programming in Common Lisp, by Sonya E. Keene.

4.4.1 The structure

The structure tells what kind of symmetries or other special properties the matrix has. Two matrix classes

4.4.2 The element type

The element type classes has no other purpose than to be represents a Common Lisp types.

4.4.3 The implementation

Since Lisplab has many competing implementation of the same generic functions, the implementation class structure tells which one too choose. There are currently four classes in a straight line of inheritance

This standard method dispatch ensures foreign library methods are chosen before native lisp. It is the responsibility of the methods to call next method if the library is not loaded.