Matrix Template Library


The Matrix Template Library is a linear algebra library for C++ programs.
The MTL uses template programming, which considerably reduces the code length. All matrices and vectors are available in all classical numerical formats: float, double, complex or complex.
Furthermore, generic programming allows the usage of arbitrary types as long as they provide the necessary operations. For instance one can use arbitrary integer formats, types for interval arithmetic from the Boost C++ Libraries, quaternions, types of higher precision and appropriate user-defined types.
The MTL supports several implementations of dense matrices and sparse matrices. MTL2 has been developed by Jeremy Siek and Andrew Lumsdaine.
The latest version, MTL4, is developed by Peter Gottschling and Andrew Lumsdaine. It contains most of MTL2's functionality and adds new optimization techniques as meta-tuning, e.g. loop unrolling of dynamically sized containers can be specified in the function call. Platform-independent performance scalability is reached by recursive data structures and algorithms.
Generic applications can be written in a natural notation, e.g. v += A*q - w;, while the library dispatches to the appropriate algorithms: matrix vector products vs. matrix products vs. vector scalar products etcetera. The goal is to encapsulate performance issues inside the library and provide scientists an intuitive interface. MTL4 is used in different finite element and finite volume packages, e.g. the FEniCS Project.