pow¶
-
template<typename Mat>
Mat pow(Mat const &x, typename Mat::scalar_type e)¶ Returns the matrix
xto the powere. This function template is defined in namespacematrix_helpers.- Parameters:
x – the matrix (must have equal number of rows and columns)
e – the exponent (must be \(\geq 0\))
- Returns:
A value of type
Mat. Ifeis0, then the identity matrix is returned; ifeis1, then a copy of the parameterxis returned.- Throws:
LibsemigroupsExceptioniftypename Mat::scalar_typeis a signed type and the parametereis less than0.This function does not to throw any other
LibsemigroupsExceptions. It might throwstd::bad_allocif the algorithm cannot allocate enough memory.- Complexity:
\(O(m\log_2(e))\) where \(m\) is the dimension of the matrix
xand \(e\) is the parametere.
Example
auto x == ProjMaxPlusMat<>::make({{-2, 2, 0}, {-1, 0, 0}, {1, -3, 1}})); matrix_helpers::pow(x, 100); // returns {{-1, 0, -1}, {-2, -1, -2}, {-1, 0, -1}}