LightMat logo

LightMat C++ - Matrix class library

Original authors: Dag Fritzson , Anders Gertz, Vadim Engelson; Linköping University.
Currently supported by: Vadim Engelson and Tommy Persson, PELAB, Linköping University, e-mail:

What is LightMat ?

LightMat is a portable C++ class library for efficient arithmetic operations and basic mathematical functions on vectors, matrices, 3- and 4-dimensional arrays. The library is specially optimized for vectors and matrices with dimensions 3 and 4 (i.e. 3x3 and 4x4). The library is optimized to minimize or eliminate object creation overhead which are especially important for small objects. Loops are unrolled whenever possible to provide better performance. Data is stored on the stack when possible i.e. small objects, otherwise on the heap. Arrays can be converted to strings and printed out.

What LightMat is not!

There is currently no specific support for sparse matrices There is no built-in support for complicated linear algebra operations (LU-decompositions, eigenvalues, etc.), but external numerical routines from packages like BLAS and LAPACK can be called to operate directly on LightMat arrays, since LightMat uses the Fortran column-major storage format.

Distribution policy

LightMat is public domain software and can be freely distributed in the original form, provided that acknowledment of Linköping University is included in software and documentation. If you successfully install and use this package in some project, please, send a note to Feedback, bug reports and contributions should be sent to LightMat is used in the Beast and the ObjectMath/MathCode projects.

Available platforms:

Non-available platforms: User manual (HTML). Read installation instructions there, examples and other notes.
Download directory is here.

Mailing list

There is a mailing list for LightMat users. Send a mail with "subscribe lightmat" in the body to


TNT - Template Numerical Toolkit (under construction), a tool similar to LightMat, supports sparse matrices and some algebraic operations. Is based on STL, Standard Template Library.

This page created 21/1/1998 by Vadim Engelson,
Changed 1998-03-23