The Matrix concept is intended to define a matrix that can be used in linear-algebra operations. A matrix contains m rows and n columns, numbered from 0 to m-1 and from 0 to n-1 respectively. The entry in row i and column j has type value_type.
If the value_type satisfies the requirements of the AdditiveAbelianGroup concept, Matrix is a refinement of AdditiveAbelianGroup.
If the value_type satisfies the requirements of the Field concept, Matrix is a refinement of VectorSpace. This is the most common situation in linear algebra. [1]
Matrix thus inherits the algebraic structure from its entries.
The matrix is also a refinement of Assignable if the matrix X::value_type is a model of Assignable.
The matrix is also a refinement of a AdditiveAbelianGroup if the vector's value_type is a AdditiveAbelianGroup.
The matrix is also a refinement of VectorSpace if the matrix' value_type is a Field.
size_type | Type of the matrix size (row index number, column index number) |
value_type | Type of matrix entries |
X | Type that is a model of the Matrix concept |
v | object of type X |
a | object of type X::value_type |
Name | Expression | Type requirements | Return type |
---|---|---|---|
Size constructor[3] | X(n,m) | X::value_type is DefaultConstructible | X |
[1]We assume here that the value_type is a field rather than a vector space. This is stricter than for the Vector concept. It is easier to understand and this is the reason why we have defined only the Vector concept with the more general situation. The modification for the Matrix concept is straightforward.
[2]Matrix being default-constructible does not require the matrix entries to be initialized. The reason for this is that this initialisation generally takes linear time.
[3] The size-constructor is not the same as the default fill constructor. The difference is that the size-constructor is not required to initialise all of its elements to value_type(). The reason for this is that this initialisation generally takes linear time.