StaticMatrix static member functions¶
-
static StaticMatrix identity()¶
Construct the identity matrix.
- Parameters
(None)
- Returns
The identity matrix with
R = C
rows and columns.- Exceptions
this function guarantees not to throw a
LibsemigroupsException
.- Complexity
\(O(n ^ 2)\) where \(n\) is the template parameter
R
andC
.
Warning
This only works when the template parameters
R
andC
are equal (i.e. for square matrices).
-
static StaticMatrix 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 StaticMatrix 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
.