DynamicMatrix static member functions¶
-
static DynamicMatrix identity(size_t n)¶
Construct the \(n \times n\) identity matrix.
- Parameters
n – the dimension
- Returns
The \(n \times n\) identity matrix.
- Exceptions
This function guarantees not to throw a
LibsemigroupsException
.- Complexity
\(O(n ^ 2)\).
-
static DynamicMatrix make(std::initializer_list<std::initializer_list<scalar_type>> il)¶
Validates the arguments, constructs a matrix and validates it.
- Parameters
il – the values to be copied into the matrix.
- Returns
the constructed matrix if valid.
- Throws
LibsemigroupsException
ifil
does not represent a matrix of the correct dimensions.- Throws
LibsemigroupsException
if the constructed matrix contains values that do not belong to the underlying semiring.- Complexity
\(O(mn)\) where \(m\) is the number of rows and \(n\) is the number of columns of the matrix.
-
static DynamicMatrix make(std::initializer_list<scalar_type> il)¶
Constructs a row and validates it.
- Parameters
il – the values to be copied into the row.
- Returns
the constructed row if valid.
- Throws
LibsemigroupsException
if the constructed row contains values that do not belong to the underlying semiring.- Complexity
\(O(n)\) where \(n\) is the number of columns of the matrix.
Warning
This constructor only works for rows, i.e. when the template parameter
R
is1
.