Class for computing matrix powers. More...
#include <MatrixPower.h>
Public Member Functions | |
Index | cols () const |
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... | |
Index | rows () const |
Private Types | |
typedef Matrix< ComplexScalar, Dynamic, Dynamic, 0, MatrixType::RowsAtCompileTime, MatrixType::ColsAtCompileTime > | ComplexMatrix |
typedef std::complex< RealScalar > | ComplexScalar |
typedef MatrixType::RealScalar | RealScalar |
typedef MatrixType::Scalar | Scalar |
Private Member Functions | |
template<typename ResultType > | |
void | computeFracPower (ResultType &res, RealScalar p) |
template<typename ResultType > | |
void | computeIntPower (ResultType &res, RealScalar p) |
void | initialize () |
Perform Schur decomposition for fractional power. More... | |
void | split (RealScalar &p, RealScalar &intpart) |
Split p into integral part and fractional part. More... | |
Static Private Member Functions | |
template<int Rows, int Cols, int Options, int MaxRows, int MaxCols> | |
static void | revertSchur (Matrix< ComplexScalar, Rows, Cols, Options, MaxRows, MaxCols > &res, const ComplexMatrix &T, const ComplexMatrix &U) |
template<int Rows, int Cols, int Options, int MaxRows, int MaxCols> | |
static void | revertSchur (Matrix< RealScalar, Rows, Cols, Options, MaxRows, MaxCols > &res, const ComplexMatrix &T, const ComplexMatrix &U) |
Private Attributes | |
MatrixType::Nested | m_A |
Reference to the base of matrix power. More... | |
RealScalar | m_conditionNumber |
Condition number of m_A. More... | |
ComplexMatrix | m_fT |
Store fractional power of m_T. More... | |
Index | m_nulls |
Rank deficiency of m_A. More... | |
Index | m_rank |
Rank of m_A. More... | |
ComplexMatrix | m_T |
Store the result of Schur decomposition. More... | |
MatrixType | m_tmp |
Temporary storage. More... | |
ComplexMatrix | m_U |
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:
Definition at line 15 of file MatrixPower.h.
|
private |
Definition at line 385 of file MatrixPower.h.
|
private |
Definition at line 383 of file MatrixPower.h.
|
private |
Definition at line 341 of file MatrixPower.h.
|
private |
Definition at line 340 of file MatrixPower.h.
|
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.
Definition at line 352 of file MatrixPower.h.
|
inline |
Definition at line 380 of file MatrixPower.h.
void Eigen::MatrixPower< MatrixType >::compute | ( | ResultType & | res, |
RealScalar | p | ||
) |
Compute the matrix power.
[in] | p | exponent, a real scalar. |
[out] | res | where A is specified in the constructor. |
Definition at line 448 of file MatrixPower.h.
|
private |
Definition at line 551 of file MatrixPower.h.
|
private |
Definition at line 528 of file MatrixPower.h.
|
private |
Perform Schur decomposition for fractional power.
Definition at line 489 of file MatrixPower.h.
|
inline |
Returns the matrix power.
[in] | p | exponent, a real scalar. |
Definition at line 366 of file MatrixPower.h.
|
inlinestaticprivate |
Definition at line 568 of file MatrixPower.h.
|
inlinestaticprivate |
Definition at line 576 of file MatrixPower.h.
|
inline |
Definition at line 379 of file MatrixPower.h.
|
private |
Split p into integral part and fractional part.
[in] | p | The exponent. |
[out] | p | The fractional part ranging in . |
[out] | intpart | The integral part. |
Only if the fractional part is nonzero, it calls initialize().
Definition at line 468 of file MatrixPower.h.
|
private |
Reference to the base of matrix power.
Definition at line 388 of file MatrixPower.h.
|
private |
Condition number of m_A.
It is initialized as 0 to avoid performing unnecessary Schur decomposition, which is the bottleneck.
Definition at line 405 of file MatrixPower.h.
|
private |
Store fractional power of m_T.
Definition at line 397 of file MatrixPower.h.
|
private |
Rank deficiency of m_A.
Definition at line 411 of file MatrixPower.h.
|
private |
Rank of m_A.
Definition at line 408 of file MatrixPower.h.
|
private |
Store the result of Schur decomposition.
Definition at line 394 of file MatrixPower.h.
|
private |
Temporary storage.
Definition at line 391 of file MatrixPower.h.
|
private |
Definition at line 394 of file MatrixPower.h.