|
|
|
Category:containers,generators |
Component type:type |
|
 |
Description
|
Matrices that occur in real engineering and scientific applications
often have special structure, especially in terms of how many zeros
are in the matrix, and where the non-zeros are located in the matrix.
This means that space and time saving can be acheived by using various
types of compressed storage. There are a multitude of matrix storage
formats in use today, and the MTL tries to support many of the more
common storage formats. The following discussion will describe how the
user of MTL can select the type of matrix he or she wishes to use.
To create a MTL matrix, one first needs to construct the
appropriate matrix type. This is done using the matrix
type generation class, which is easier to think of as a function. It
takes as input the characteristics of the matrix type that you want
and then returns the appropriate MTL matrix. The matrix type
generators ``function'' has defaults defined, so in order to create a
normal rectangular matrix type, one merely does the following:
typedef matrix< double >::type MyMatrix;
MyMatrix A(M, N);
The matrix type generators can take up to four arguments, the
element type, the matrix shape, the storage
format, and the orientation. The following is the
``prototype'' for the matrix type generators.
matrix< EltType, Shape, Storage, Orientation >::type
This type of "generative" interface technique was developed by by
Krzysztof
Czarnecki and Ulrich
Eisenecker in their work on the Generative Matrix Computation Library.
*Storage can be made external by specifying such in the storage
parameter. eg. dense<external>, packed<external>.
|
 |
Example
|
|
 |
Definition
|
matrix.h
|
 |
Template Parameters
|
Parameter | Description | Default |
EltType | Valid choices for this argument include double, complex, and bool. In essence, any builtin or user defined type can be used for the EltType, however, if one uses the matrix with a particular algorithm, the EltType must support the operations required by the algorithm. For MTL algorithms these typically include the usual numerical operators such as addition and multiplication. The std::complex class is a good example of what is required in a numerical type. The documentation for each algorithm will include the requirements on the element type. | |
Shape | This argument specifies the general positioning of the non zero elements in the matrix, but does not specify the actual storage format. In addition it specifies certain properties such as symmetry. The choices for this argument include rectangle, banded, diagonal, triangle, and symmetric. Hermitian is not yet implemented. | |
Storage | The argument specifies the storage scheme used to lay out the matrix elements (and sometimes the element indices) in memory. The storage formats include dense , banded, packed , banded_view, compressed, envelope, and array. | |
Orientation | The storage order for an MTL matrix can either be row_major or column_major. | |
|
 |
Model of
|
|
 |
Members
|
Member
|
Where defined
|
Description
|
enum
{ Shape_id = Shape::id, Shape_M = Shape::M, Shape_N = Shape::N }
|
|
|
type
|
|
The generated type
|
|
 |
New members
|
|
 |
Notes
|
|
 |
See also
|
|