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.19596,-0.823067) (-0.604897,-0.329554) (0.0268018,0.904459) (-0.514226,-0.725537)
(-0.191753,0.680375) (0.536459,-0.444451) (0.83239,0.271423) (0.608354,-0.686642)
(-0.211234,0.566198) (0.10794,-0.0452059) (0.434594,-0.716795) (-0.198111,-0.740419)
(0.59688,0.823295) (0.257742,-0.270431) (0.213938,-0.967399) (-0.782382,0.997849)
A^3.1 is:
(-2.227,0.0990708) (-0.158559,2.16105) (1.39978,-0.660062) (-2.00242,2.23923)
(3.86912,0.197475) (-0.844457,-2.65901) (-1.85688,-0.866645) (-1.98839,-1.48766)
(1.87602,-0.998189) (-1.05488,-1.08768) (-0.692749,0.881118) (-2.09739,0.458621)
(2.1648,-2.70859) (-1.39574,-0.812466) (-2.29894,0.0963299) (3.48099,1.74846)
A^3.3 is:
(-2.83771,0.598344) (0.254566,2.43486) (1.63868,-0.449446) (-2.35702,1.66726)
(4.0905,-0.666724) (-1.44083,-2.8408) (-2.19997,-0.071872) (-2.32446,-2.1859)
(1.42434,-1.43339) (-1.42233,-0.953951) (-0.221865,1.50014) (-2.66939,-0.236535)
(2.57026,-2.61251) (-1.64008,-0.723563) (-1.85466,-0.574456) (2.37697,3.7585)
A^3.7 is:
(-4.08077,1.40979) (1.26083,2.8391) (1.70005,0.293596) (-1.71782,-0.171169)
(4.19575,-3.22198) (-3.03367,-2.89343) (-2.886,1.84371) (-2.25369,-3.36997)
(0.0631557,-2.68602) (-2.22514,-0.357673) (0.519705,2.76408) (-2.76458,-1.98129)
(2.35329,-1.65991) (-2.00537,-0.250066) (0.232659,-1.39455) (-2.44077,6.18161)
A^3.9 is:
(-4.53918,1.69912) (1.84101,2.92148) (1.44614,0.659012) (-0.541332,-1.07763)
(4.07235,-4.84687) (-4.00777,-2.69597) (-3.17274,2.79478) (-1.8831,-3.53663)
(-0.726132,-3.46922) (-2.61758,0.109503) (0.685443,3.24064) (-2.13948,-2.65548)
(1.49472,-1.0258) (-2.11768,0.173358) (1.66258,-1.20577) (-5.55606,5.80425)