itpp::mat STC::mat_pow(const itpp::mat &in_mat, int in_exp) //square matrix power of integer exponent { if (in_exp==0) { return itpp::eye(in_mat.rows()); } itpp::mat out = in_mat; int abs_in_exp = std::abs(in_exp); register int n; for (n=1; n<abs_in_exp; n++) { out *= in_mat; } return (in_exp>0)?out:itpp::inv(out); }