Automatic Differentiation
 
Loading...
Searching...
No Matches

◆ matrix_power() [4/4]

template<typename T , require_rev_matrix_t< T > * = nullptr>
plain_type_t< T > stan::math::matrix_power ( const T &  M,
const int  n 
)
inline

Returns the nth power of the specific matrix.

M^n = M * M * ... * M.

Template Parameters
Rnumber of rows, can be Eigen::Dynamic
Cnumber of columns, can be Eigen::Dynamic
Parameters
[in]Ma square matrix
[in]nexponent
Returns
nth power of M
Exceptions
std::domain_errorif the matrix contains NaNs or infinities.
std::invalid_argumentif the exponent is negative or the matrix is not square.

Definition at line 29 of file matrix_power.hpp.