template<typename MatrixType>
class Eigen::MatrixPower< MatrixType >
Class for computing matrix powers.
- Template Parameters
-
| MatrixType | type of the base, expected to be an instantiation of the Matrix class template. |
This class is capable of computing real/complex matrices raised to an arbitrary real power. Meanwhile, it saves the result of Schur decomposition if an non-integral power has even been calculated. Therefore, if you want to compute multiple (>= 2) matrix powers for the same matrix, using the class directly is more efficient than calling MatrixBase::pow().
Example:
#include <unsupported/Eigen/MatrixFunctions>
#include <iostream>
int main() {
std::cout << "The matrix A is:\n"
<< A
<< "\n\n"
"A^3.1 is:\n"
<< Apow(3.1)
<< "\n\n"
"A^3.3 is:\n"
<< Apow(3.3)
<< "\n\n"
"A^3.7 is:\n"
<< Apow(3.7)
<< "\n\n"
"A^3.9 is:\n"
<< Apow(3.9) << std::endl;
return 0;
}
MatrixPower(const MatrixType &A)
Constructor.
Definition MatrixPower.h:354
Matrix< std::complex< double >, 4, 4 > Matrix4cd
Namespace containing all symbols from the Eigen library.
Output:
The matrix A is:
(0.696235,0.205189) (0.0241114,0.0722581) (-0.727247,0.740165) (-0.77815,-0.757623)
(-0.414795,0.33421) (0.432106,-0.046008) (-0.756752,0.740565) (-0.711254,-0.467268)
(-0.469531,0.927654) (0.134119,-0.159573) (-0.216464,0.852317) (0.00720412,0.220277)
(0.445064,-0.632501) (-0.00985718,-0.498144) (0.834695,-0.833781) (0.858701,-0.316277)
A^3.1 is:
(-0.16858,-2.88335) (-1.19171,1.31734) (-0.205385,-2.85231) (-0.793347,-0.323082)
(0.170369,-1.83994) (-0.588912,0.545447) (1.64177,-2.11127) (0.582705,0.766038)
(0.95977,-0.896837) (-0.353594,-0.559858) (2.37821,-1.91013) (1.68082,0.0472203)
(-0.915598,1.8791) (0.393388,-0.128919) (-2.08007,2.36222) (-1.33759,-0.00384762)
A^3.3 is:
(0.387072,-3.03728) (-1.28527,1.26933) (0.759272,-2.72521) (-0.642452,0.0960228)
(0.788638,-1.69238) (-0.578217,0.365293) (2.51069,-1.6477) (0.730302,1.09701)
(1.52219,-0.685834) (-0.405507,-0.800341) (3.03538,-1.37315) (1.63056,0.198142)
(-1.55232,1.72301) (0.462049,0.159509) (-2.89927,1.80702) (-1.28322,-0.195319)
A^3.7 is:
(1.66859,-2.72375) (-1.26765,0.999027) (2.64201,-1.50728) (-0.515609,1.03796)
(1.93469,-0.793522) (-0.353836,-0.11654) (3.7999,0.110159) (0.754493,1.69738)
(2.42172,0.263819) (-0.354422,-1.2948) (3.76115,0.383115) (1.22546,0.477461)
(-2.62563,0.773497) (0.429889,0.761964) (-3.95456,-0.159646) (-0.808653,-0.614027)
A^3.9 is:
(2.26004,-2.21492) (-1.12649,0.801666) (3.34086,-0.419028) (-0.58092,1.49767)
(2.32111,-0.0584826) (-0.129182,-0.376093) (4.0214,1.31619) (0.610594,1.90553)
(2.63556,0.962157) (-0.239951,-1.50288) (3.67106,1.48265) (0.879111,0.554066)
(-2.91745,0.00870841) (0.308645,1.02382) (-3.99547,-1.45633) (-0.395371,-0.782971)