DynamicMatrix (with run time arithmetic)¶
Defined in matrix.hpp
.
-
template<typename Semiring, typename Scalar>
class DynamicMatrix final¶ This is a class for matrices where both the arithmetic operations in the underlying semiring and the dimensions of the matrix can be set at run time.
- Template Parameters
Semiring – the type of a semiring object which defines the semiring arithmetic (see requirements below).
Scalar – the type of the entries in the matrices (the type of elements in the underlying semiring)
Note
Certain member functions only work for square matrices and some only work for rows.
Semiring requirements
The template parameter
Semiring
must have the following member functions:scalar_type zero()
that returns the multiplicative zero scalar in the semiringscalar_type one()
that returns the multiplicative identity scalar in the semiringscalar_type plus(scalar_type x, scalar_type y)
that returns the sum in the semiring of the scalarsx
andy
.scalar_type prod(scalar_type x, scalar_type y)
that returns the product in the semiring of the scalarsx
andy
.
See, for example,
MaxPlusTruncSemiring
.
Member types¶
Member type |
Definition |
---|---|
the type of scalars contained in the matrix ( |
|
the type of references to scalars contained in the matrix |
|
the type of const references to scalars contained in the matrix |
|
type of a row of the matrix |
|
type of a row view int the matrix |
|
the template parameter |
Member functions¶
constructs the matrix |
|
the number of rows/columns in the matrix |
|
returns a pointer to the semiring defining the arithmetic |
Static member functions¶
constructs a matrix and checks that its entries are valid |
|
constructs an identity matrix |
Iterators¶
returns an iterator to the beginning |
|
returns an iterator to the end |
|
returns the coordinates corresponding to an iterator |
Accessors¶
access specified element |
|
access specified row |
|
add all rows to a container |
Arithmetic operators¶
add a (matrix, scalar, or row view) to the matrix in place |
|
multiply the matrix by a matrix or scalar in place |
|
add a (matrix, scalar, or row view) to the matrix |
|
multiply the matrix by a matrix or scalar |
Comparison operators¶
compare matrices |
|
compare matrices |
|
compare matrices |
|
compare matrices |
Modifiers¶
swaps the contents |
|
transposes the matrix |