matpow.RdCompute the \(k\)-th power of a matrix. Whereas x^k computes
element wise powers, x %^% k corresponds to \(k -
1\) matrix multiplications, x %*% x %*% ... %*% x.
x %^% ka square matrix.
an integer, \(k \ge 0\).
Argument \(k\) is coerced to integer using as.integer.
The algorithm uses \(O(log_2(k))\) matrix multiplications.
A matrix of the same dimension as x.
If you think you need x^k for \(k < 0\), then consider
instead solve(x %^% (-k)).
%*% for matrix multiplication.