Public Member Functions | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
Eigen::MatrixPower< MatrixType > Class Template Reference

Class for computing matrix powers. More...

#include <MatrixPower.h>

Inheritance diagram for Eigen::MatrixPower< MatrixType >:
Inheritance graph
[legend]

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< RealScalarComplexScalar
 
typedef MatrixType::Index Index
 
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...
 
- Private Member Functions inherited from Eigen::internal::noncopyable
EIGEN_DEVICE_FUNC noncopyable ()
 
EIGEN_DEVICE_FUNC ~noncopyable ()
 

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
 

Detailed Description

template<typename MatrixType>
class Eigen::MatrixPower< MatrixType >

Class for computing matrix powers.

Template Parameters
MatrixTypetype 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>
using namespace Eigen;
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;
}

Output:

 

Definition at line 15 of file MatrixPower.h.

Member Typedef Documentation

template<typename MatrixType>
typedef Matrix<ComplexScalar, Dynamic, Dynamic, 0, MatrixType::RowsAtCompileTime, MatrixType::ColsAtCompileTime> Eigen::MatrixPower< MatrixType >::ComplexMatrix
private

Definition at line 387 of file MatrixPower.h.

template<typename MatrixType>
typedef std::complex<RealScalar> Eigen::MatrixPower< MatrixType >::ComplexScalar
private

Definition at line 385 of file MatrixPower.h.

template<typename MatrixType>
typedef MatrixType::Index Eigen::MatrixPower< MatrixType >::Index
private

Definition at line 343 of file MatrixPower.h.

template<typename MatrixType>
typedef MatrixType::RealScalar Eigen::MatrixPower< MatrixType >::RealScalar
private

Definition at line 342 of file MatrixPower.h.

template<typename MatrixType>
typedef MatrixType::Scalar Eigen::MatrixPower< MatrixType >::Scalar
private

Definition at line 341 of file MatrixPower.h.

Constructor & Destructor Documentation

template<typename MatrixType>
Eigen::MatrixPower< MatrixType >::MatrixPower ( const MatrixType &  A)
inlineexplicit

Constructor.

Parameters
[in]Athe 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 354 of file MatrixPower.h.

Member Function Documentation

template<typename MatrixType>
Index Eigen::MatrixPower< MatrixType >::cols ( void  ) const
inline

Definition at line 382 of file MatrixPower.h.

template<typename MatrixType >
template<typename ResultType >
void Eigen::MatrixPower< MatrixType >::compute ( ResultType &  res,
RealScalar  p 
)

Compute the matrix power.

Parameters
[in]pexponent, a real scalar.
[out]res$ A^p $ where A is specified in the constructor.

Definition at line 450 of file MatrixPower.h.

template<typename MatrixType >
template<typename ResultType >
void Eigen::MatrixPower< MatrixType >::computeFracPower ( ResultType &  res,
RealScalar  p 
)
private

Definition at line 553 of file MatrixPower.h.

template<typename MatrixType >
template<typename ResultType >
void Eigen::MatrixPower< MatrixType >::computeIntPower ( ResultType &  res,
RealScalar  p 
)
private

Definition at line 530 of file MatrixPower.h.

template<typename MatrixType >
void Eigen::MatrixPower< MatrixType >::initialize ( )
private

Perform Schur decomposition for fractional power.

Definition at line 491 of file MatrixPower.h.

template<typename MatrixType>
const MatrixPowerParenthesesReturnValue<MatrixType> Eigen::MatrixPower< MatrixType >::operator() ( RealScalar  p)
inline

Returns the matrix power.

Parameters
[in]pexponent, a real scalar.
Returns
The expression $ A^p $, where A is specified in the constructor.

Definition at line 368 of file MatrixPower.h.

template<typename MatrixType >
template<int Rows, int Cols, int Options, int MaxRows, int MaxCols>
void Eigen::MatrixPower< MatrixType >::revertSchur ( Matrix< ComplexScalar, Rows, Cols, Options, MaxRows, MaxCols > &  res,
const ComplexMatrix T,
const ComplexMatrix U 
)
inlinestaticprivate

Definition at line 570 of file MatrixPower.h.

template<typename MatrixType >
template<int Rows, int Cols, int Options, int MaxRows, int MaxCols>
void Eigen::MatrixPower< MatrixType >::revertSchur ( Matrix< RealScalar, Rows, Cols, Options, MaxRows, MaxCols > &  res,
const ComplexMatrix T,
const ComplexMatrix U 
)
inlinestaticprivate

Definition at line 578 of file MatrixPower.h.

template<typename MatrixType>
Index Eigen::MatrixPower< MatrixType >::rows ( void  ) const
inline

Definition at line 381 of file MatrixPower.h.

template<typename MatrixType >
void Eigen::MatrixPower< MatrixType >::split ( RealScalar p,
RealScalar intpart 
)
private

Split p into integral part and fractional part.

Parameters
[in]pThe exponent.
[out]pThe fractional part ranging in $ (-1, 1) $.
[out]intpartThe integral part.

Only if the fractional part is nonzero, it calls initialize().

Definition at line 470 of file MatrixPower.h.

Member Data Documentation

template<typename MatrixType>
MatrixType::Nested Eigen::MatrixPower< MatrixType >::m_A
private

Reference to the base of matrix power.

Definition at line 390 of file MatrixPower.h.

template<typename MatrixType>
RealScalar Eigen::MatrixPower< MatrixType >::m_conditionNumber
private

Condition number of m_A.

It is initialized as 0 to avoid performing unnecessary Schur decomposition, which is the bottleneck.

Definition at line 407 of file MatrixPower.h.

template<typename MatrixType>
ComplexMatrix Eigen::MatrixPower< MatrixType >::m_fT
private

Store fractional power of m_T.

Definition at line 399 of file MatrixPower.h.

template<typename MatrixType>
Index Eigen::MatrixPower< MatrixType >::m_nulls
private

Rank deficiency of m_A.

Definition at line 413 of file MatrixPower.h.

template<typename MatrixType>
Index Eigen::MatrixPower< MatrixType >::m_rank
private

Rank of m_A.

Definition at line 410 of file MatrixPower.h.

template<typename MatrixType>
ComplexMatrix Eigen::MatrixPower< MatrixType >::m_T
private

Store the result of Schur decomposition.

Definition at line 396 of file MatrixPower.h.

template<typename MatrixType>
MatrixType Eigen::MatrixPower< MatrixType >::m_tmp
private

Temporary storage.

Definition at line 393 of file MatrixPower.h.

template<typename MatrixType>
ComplexMatrix Eigen::MatrixPower< MatrixType >::m_U
private

Definition at line 396 of file MatrixPower.h.


The documentation for this class was generated from the following file:


hebiros
Author(s): Xavier Artache , Matthew Tesch
autogenerated on Thu Sep 3 2020 04:10:10