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.680375,-0.211234) (-0.444451,0.10794) (0.271423,0.434594) (-0.686642,-0.198111)
(0.566198,0.59688) (-0.0452059,0.257742) (-0.716795,0.213938) (-0.740419,-0.782382)
(0.823295,-0.604897) (-0.270431,0.0268018) (-0.967399,-0.514226) (0.997849,-0.563486)
(-0.329554,0.536459) (0.904459,0.83239) (-0.725537,0.608354) (0.0258648,0.678224)
A^3.1 is:
(0.545666,-2.63743) (0.203869,1.16554) (-0.513414,1.32972) (-0.394715,0.661316)
(3.57161,-1.33776) (0.101221,-0.608487) (-1.04091,1.01587) (0.699862,0.200293)
(1.85761,1.00285) (-2.68235,-0.227423) (-2.0981,-4.59955) (1.63697,-1.63407)
(-1.16175,0.775529) (0.626925,-2.10814) (0.169783,1.84705) (0.924855,-2.09924)
A^3.3 is:
(0.0481398,-2.42133) (0.491198,1.46821) (0.0806201,1.58482) (-0.929845,1.22472)
(3.5958,-1.76607) (0.31909,0.273064) (-1.44547,1.96548) (-0.262064,0.499327)
(1.74455,-0.474671) (-2.94048,0.387475) (-4.08207,-3.19963) (1.34832,-3.23714)
(-0.955046,0.747909) (1.592,-2.51771) (0.825871,2.67682) (1.19399,-1.26471)
A^3.7 is:
(-0.683949,-1.23824) (0.362023,1.50441) (1.69442,0.31258) (-1.3016,2.28742)
(2.85165,-1.62403) (0.500062,1.59928) (-0.394364,3.2083) (-2.62883,1.59426)
(-0.625316,-3.148) (-1.13982,1.33807) (-4.67137,3.06961) (-0.849967,-4.49735)
(0.427211,1.41352) (3.25419,-2.81767) (1.75702,3.05918) (1.65052,1.16473)
A^3.9 is:
(-0.745292,-0.57331) (-0.20408,1.31739) (2.13611,-1.21715) (-0.975954,2.4151)
(2.34627,-0.999025) (0.185441,1.75177) (0.97214,2.81983) (-3.5101,2.22601)
(-2.46846,-3.40907) (0.739741,1.09748) (-2.35143,6.38974) (-2.11108,-3.41234)
(1.63659,1.98727) (3.59318,-2.52272) (1.57219,2.48698) (1.70771,2.3174)
Inherits internal::noncopyable.