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()
{
Matrix4cd A = Matrix4cd::Random();
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:352
Namespace containing all symbols from the Eigen library.
Output:
The matrix A is:
(-0.823067,0.19596) (-0.329554,-0.604897) (0.904459,0.0268018) (-0.725537,-0.514226)
(0.680375,-0.191753) (-0.444451,0.536459) (0.271423,0.83239) (-0.686642,0.608354)
(0.566198,-0.211234) (-0.0452059,0.10794) (-0.716795,0.434594) (-0.740419,-0.198111)
(0.823295,0.59688) (-0.270431,0.257742) (-0.967399,0.213938) (0.997849,-0.782382)
A^3.1 is:
(-0.446224,2.18406) (-2.15927,-0.181461) (0.870919,-1.27933) (-2.52488,1.62746)
(0.41025,-3.85237) (2.49417,1.24999) (0.565543,1.96959) (1.15832,2.19665)
(1.27938,-1.69678) (0.909258,1.21204) (-0.97863,0.546369) (-0.781069,1.99982)
(3.01389,-1.71444) (0.584117,1.50566) (-0.454785,2.25556) (-1.18239,-3.71166)
A^3.3 is:
(-1.8214,2.25674) (-2.05395,-1.33224) (1.14443,-1.25608) (-2.55557,1.34319)
(2.45115,-3.34196) (1.87706,2.57344) (-0.934661,1.99284) (0.892387,3.06352)
(1.92381,-0.618355) (0.20424,1.70038) (-1.43734,-0.483383) (-1.00111,2.48583)
(3.49463,-1.10407) (-0.0998875,1.78982) (-0.330166,1.91331) (-2.26973,-3.82423)
A^3.7 is:
(-4.27601,0.596491) (-0.165523,-3.10207) (1.38148,-1.03341) (-1.45287,0.932387)
(5.2012,0.965985) (-1.38942,3.95531) (-3.40845,-0.332526) (-0.478118,4.02584)
(1.27571,2.36459) (-1.82023,1.32887) (-0.791798,-2.69876) (-1.56377,3.02043)
(2.85038,0.410616) (-1.67327,1.13323) (0.840411,1.13692) (-4.98113,-4.39977)
A^3.9 is:
(-4.7491,-0.968113) (1.36132,-3.17351) (1.32525,-0.877126) (-0.366086,1.14905)
(4.78043,4.15014) (-3.53668,3.28973) (-3.57088,-2.26405) (-1.30667,3.78768)
(-0.174485,3.5401) (-2.60248,0.301323) (0.170058,-3.30797) (-1.69773,2.95747)
(1.63679,0.779341) (-2.11873,0.160055) (1.83073,0.930838) (-6.39564,-4.86363)