Validation¶
The function validate_matrix can be used to check that a matrix is
valid (i.e. that its entries belong to the underlying semiring).
-
template<typename Mat>
void validate(Mat const &m)¶ Throws an exception if the matrix is invalid.
The overloaded static member functions
DynamicMatrix::makeandStaticMatrix::makeuse this function to verify that the constructed matrix is valid.- Template Parameters:
Mat – a type for which
IsMatrixistrue.- Parameters:
m – the matrix to validate.
- Returns:
(None).
- Throws:
A
LibsemigroupsExceptionif the matrixmis invalid.- Complexity:
At worst \(O(nk)\) where \(n\) is the number of rows in the matrix
mand \(k\) is the number of columns.
Threshold and period¶
-
template<typename Mat>
typename Mat::scalar_type matrix_threshold(Mat const &m)¶ Returns the threshold of a matrix (if any).
This value is only defined for
MaxPlusTruncMat,MinPlusTruncMat, andNTPMat. IfMatis another type of matrix, thenUNDEFINEDis returned.- Template Parameters:
Mat – a type for which
IsMatrixistrue.- Parameters:
m – the matrix.
- Returns:
A value of type
typename Mat::scalar_type.- Exceptions:
This function is
noexceptand is guaranteed never to throw.- Complexity:
Constant.
-
template<typename Mat>
typename Mat::scalar_type matrix_period(Mat const &m)¶ Returns the period of a matrix (if any).
This value is only defined for
NTPMat. IfMatis another type of matrix, thenUNDEFINEDis returned.- Template Parameters:
Mat – a type for which
IsMatrixistrue.- Parameters:
m – the matrix.
- Returns:
A value of type
typename Mat::scalar_type.- Exceptions:
This function is
noexceptand is guaranteed never to throw.- Complexity:
Constant.