$darkmode
#include <unsupported/Eigen/src/MatrixFunctions/MatrixPower.h>
Class for computing matrix powers.
| 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:
Output:
The matrix A is:
(0.205189,0.696235) (0.0722581,0.0241114) (0.740165,-0.727247) (-0.757623,-0.77815)
(0.33421,-0.414795) (-0.046008,0.432106) (0.740565,-0.756752) (-0.467268,-0.711254)
(0.927654,-0.469531) (-0.159573,0.134119) (0.852317,-0.216464) (0.220277,0.00720412)
(-0.632501,0.445064) (-0.498144,-0.00985718) (-0.833781,0.834695) (-0.316277,0.858701)
A^3.1 is:
(2.82147,0.617559) (-1.48755,0.970963) (2.78507,0.649057) (0.194997,0.834121)
(1.84394,0.119559) (-0.630858,0.496335) (2.3421,-1.29128) (-0.665452,-0.695366)
(1.03594,-0.807657) (0.497651,0.436822) (2.25864,-2.05012) (0.216299,-1.66751)
(-1.9992,0.61037) (0.188871,-0.368377) (-2.65853,1.68493) (-0.205445,1.32172)
A^3.3 is:
(2.88197,1.03401) (-1.71448,0.56892) (2.77288,0.560704) (-0.377224,0.528836)
(1.86595,0.065641) (-0.587984,0.349356) (2.60795,-1.489) (-0.645889,-1.14873)
(1.30214,-1.04492) (0.529013,0.724657) (2.60152,-2.08115) (0.563714,-1.5428)
(-2.23995,0.600898) (0.0676424,-0.484104) (-2.92631,1.7629) (-0.408539,1.23203)
A^3.7 is:
(2.72328,1.66936) (-1.58303,-0.314641) (3.03834,0.143548) (-0.930633,-0.690743)
(2.08407,-0.171298) (-0.262362,0.264476) (3.33572,-1.82327) (-0.0983353,-1.85491)
(2.038,-1.3345) (0.272037,1.31458) (3.17728,-2.04889) (0.87513,-0.981768)
(-2.69061,0.502821) (0.0371093,-0.87408) (-3.45106,1.93758) (-0.441753,0.914223)
A^3.9 is:
(2.5787,1.83411) (-1.23803,-0.615574) (3.36528,-0.108757) (-0.808055,-1.38835)
(2.30168,-0.305339) (-0.0687576,0.391672) (3.76599,-1.92907) (0.304986,-1.97759)
(2.4526,-1.3626) (-0.00189484,1.52191) (3.39393,-2.03868) (0.781613,-0.684768)
(-2.88289,0.447788) (0.144684,-1.0595) (-3.71845,2.06343) (-0.26802,0.835181)
Inherits noncopyable.
Public Member Functions | |
| template<typename ResultType > | |
| void | compute (ResultType &res, RealScalar p) |
| Compute the matrix power. More... | |
| MatrixPower (const MatrixType &A) | |
| Constructor. More... | |
| const MatrixPowerParenthesesReturnValue< MatrixType > | operator() (RealScalar p) |
| Returns the matrix power. More... | |
|
inlineexplicit |
Constructor.
| [in] | A | the base of the matrix power. |
The class stores a reference to A, so it should not be changed (or destroyed) before evaluation.
| void Eigen::MatrixPower< MatrixType >::compute | ( | ResultType & | res, |
| RealScalar | p | ||
| ) |
Compute the matrix power.
| [in] | p | exponent, a real scalar. |
| [out] | res | \( A^p \) where A is specified in the constructor. |
|
inline |
Returns the matrix power.
| [in] | p | exponent, a real scalar. |