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;
}
Class for computing matrix powers.
Definition MatrixPower.h:338
Namespace containing all symbols from the Eigen library.
Output:
The matrix A is:
(-0.648517,0.0277402) (-0.750559,-0.0104531) (0.292946,0.531364) (0.834409,-0.306198)
(0.0690678,-0.382697) (-0.220706,-0.832202) (0.560474,0.534278) (-0.197692,0.0395199)
(-0.656527,0.895256) (-0.263859,-0.445548) (-0.696135,0.645903) (0.570804,0.213517)
(-0.547139,0.404462) (0.0707959,0.966874) (-0.37063,0.250953) (0.739842,0.863046)
A^3.1 is:
(1.53908,-2.21651) (-0.152667,-0.531488) (0.744457,0.460933) (-1.93119,0.930734)
(1.61499,0.191744) (0.648649,0.421757) (-0.266679,-0.157097) (-0.713262,0.165264)
(1.66249,0.119027) (-1.98109,0.742219) (1.86252,-0.238568) (-2.90399,-1.67843)
(1.01521,-1.61954) (-1.51917,-0.011723) (1.81753,-1.30185) (-3.23722,-1.15108)
A^3.3 is:
(1.1155,-2.36262) (-1.0915,-0.870451) (1.37239,0.521234) (-2.13397,0.277785)
(1.89046,-0.161377) (0.465943,-0.0255513) (0.0427308,0.379298) (-0.703068,-0.0384931)
(1.65374,0.964879) (-2.04144,0.181088) (1.62466,0.377539) (-2.45127,-2.75057)
(1.16953,-0.809816) (-1.88593,-0.0297344) (2.25636,-1.17834) (-3.16752,-2.26286)
A^3.7 is:
(-0.296747,-1.53588) (-2.59831,-0.994351) (2.01438,0.0709399) (-2.0153,-1.33356)
(1.4324,-0.786105) (-0.348582,-0.970141) (0.712009,1.2196) (-0.310195,-0.584644)
(1.17293,2.23861) (-1.19218,-1.23472) (0.487724,1.33185) (-0.50022,-4.22562)
(1.42866,1.41465) (-1.8698,-0.36365) (2.34216,-0.398031) (-2.00938,-4.45188)
A^3.9 is:
(-0.965539,-0.591018) (-2.84559,-0.750439) (1.89979,-0.385573) (-1.70172,-2.1211)
(0.713577,-0.903798) (-0.826882,-1.26024) (0.941145,1.34047) (0.0514993,-0.845345)
(0.770781,2.4594) (-0.35153,-1.87363) (-0.179063,1.53861) (0.823239,-4.39952)
(1.49899,2.54241) (-1.39538,-0.727061) (1.96753,0.22473) (-0.883246,-5.26765)
Inherits internal::noncopyable.