Matrix Template Library
Encyclopedia
The Matrix Template Library (MTL) is a linear algebra
Linear algebra
Linear algebra is a branch of mathematics that studies vector spaces, also called linear spaces, along with linear functions that input one vector and output another. Such functions are called linear maps and can be represented by matrices if a basis is given. Thus matrix theory is often...

 library for C++
C++
C++ is a statically typed, free-form, multi-paradigm, compiled, general-purpose programming language. It is regarded as an intermediate-level language, as it comprises a combination of both high-level and low-level language features. It was developed by Bjarne Stroustrup starting in 1979 at Bell...

 programs.

The MTL uses template programming
Template (programming)
Templates are a feature of the C++ programming language that allow functions and classes to operate with generic types. This allows a function or class to work on many different data types without being rewritten for each one....

, 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
Generic programming
In a broad definition, generic programming is a style of computer programming in which algorithms are written in terms of to-be-specified-later types that are then instantiated when needed for specific types provided as parameters...

 allows the usage of arbitrary types as long as they provide the necessary operations. For instance one can use arbitrary integer formats (e.g. unsigned short), types for interval arithmetic (e.g. boost::interval from the Boost C++ Libraries, quaternion
Quaternion
In mathematics, the quaternions are a number system that extends the complex numbers. They were first described by Irish mathematician Sir William Rowan Hamilton in 1843 and applied to mechanics in three-dimensional space...

s (e.g. boost::quaternion), types of higher precision (e.g. GNU Multi-Precision Library
GNU Multi-Precision Library
The GNU Multiple Precision Arithmetic Library, also known as GMP, is a free library for arbitrary-precision arithmetic, operating on signed integers, rational numbers, and floating point numbers...

) and appropriate user-defined types.

The MTL supports several implementations of dense matrices and sparse matrices
Sparse matrix
In the subfield of numerical analysis, a sparse matrix is a matrix populated primarily with zeros . The term itself was coined by Harry M. Markowitz....

. 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
Finite element method
The finite element method is a numerical technique for finding approximate solutions of partial differential equations as well as integral equations...

 and finite volume
Finite volume method
The finite volume method is a method for representing and evaluating partial differential equations in the form of algebraic equations [LeVeque, 2002; Toro, 1999]....

 packages, e.g. the FEniCS Project
FEniCS Project
The FEniCS Project is a set of free software projects with the common goal to enable automated solution of differential equations. It provides software tools for working with computational meshes, finite element variational formulations of PDEs, ODE solvers and linear algebra.- Software projects...

.

External links

The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK