Computes eigenvalues and eigenvectors of general complex matrices
_MatrixType | the type of the matrix of which we are computing the eigendecomposition; this is expected to be an instantiation of the Matrix class template. |
The eigenvalues and eigenvectors of a matrix are scalars
and vectors
such that
. If
is a diagonal matrix with the eigenvalues on the diagonal, and
is a matrix with the eigenvectors as its columns, then
. The matrix
is almost always invertible, in which case we have
. This is called the eigendecomposition.
The main function in this class is compute(), which computes the eigenvalues and eigenvectors of a given function. The documentation for that function contains an example showing the main features of the class.
Definition at line 59 of file ComplexEigenSolver.h.
#include <src/Eigenvalues/ComplexEigenSolver.h>
Public Types | |
enum | { RowsAtCompileTime = MatrixType::RowsAtCompileTime, ColsAtCompileTime = MatrixType::ColsAtCompileTime, Options = MatrixType::Options, MaxRowsAtCompileTime = MatrixType::MaxRowsAtCompileTime, MaxColsAtCompileTime = MatrixType::MaxColsAtCompileTime } |
typedef _MatrixType | MatrixType |
Synonym for the template parameter _MatrixType . | |
typedef MatrixType::Scalar | Scalar |
Scalar type for matrices of type MatrixType. | |
typedef NumTraits< Scalar >::Real | RealScalar |
typedef MatrixType::Index | Index |
typedef std::complex< RealScalar > | ComplexScalar |
Complex scalar type for MatrixType. | |
typedef Matrix< ComplexScalar, ColsAtCompileTime, 1, Options &(~RowMajor), MaxColsAtCompileTime, 1 > | EigenvalueType |
Type for vector of eigenvalues as returned by eigenvalues(). | |
typedef Matrix< ComplexScalar, RowsAtCompileTime, ColsAtCompileTime, Options, MaxRowsAtCompileTime, ColsAtCompileTime > | EigenvectorType |
Type for matrix of eigenvectors as returned by eigenvectors(). | |
Public Member Functions | |
ComplexEigenSolver () | |
Default constructor. | |
ComplexEigenSolver (Index size) | |
Default Constructor with memory preallocation. | |
ComplexEigenSolver (const MatrixType &matrix, bool computeEigenvectors=true) | |
Constructor; computes eigendecomposition of given matrix. | |
const EigenvectorType & | eigenvectors () const |
Returns the eigenvectors of given matrix. | |
const EigenvalueType & | eigenvalues () const |
Returns the eigenvalues of given matrix. | |
ComplexEigenSolver & | compute (const MatrixType &matrix, bool computeEigenvectors=true) |
Computes eigendecomposition of given matrix. | |
ComputationInfo | info () const |
Reports whether previous computation was successful. | |
Protected Attributes | |
EigenvectorType | m_eivec |
EigenvalueType | m_eivalues |
ComplexSchur< MatrixType > | m_schur |
bool | m_isInitialized |
bool | m_eigenvectorsOk |
EigenvectorType | m_matX |
Private Member Functions | |
void | doComputeEigenvectors (RealScalar matrixnorm) |
void | sortEigenvalues (bool computeEigenvectors) |
typedef std::complex<RealScalar> ComplexEigenSolver< _MatrixType >::ComplexScalar |
Complex scalar type for MatrixType.
This is std::complex<Scalar>
if Scalar is real (e.g., float
or double
) and just Scalar
if Scalar is complex.
Definition at line 85 of file ComplexEigenSolver.h.
typedef Matrix<ComplexScalar, ColsAtCompileTime, 1, Options&(~RowMajor), MaxColsAtCompileTime, 1> ComplexEigenSolver< _MatrixType >::EigenvalueType |
Type for vector of eigenvalues as returned by eigenvalues().
This is a column vector with entries of type ComplexScalar. The length of the vector is the size of MatrixType.
Definition at line 92 of file ComplexEigenSolver.h.
typedef Matrix<ComplexScalar, RowsAtCompileTime, ColsAtCompileTime, Options, MaxRowsAtCompileTime, ColsAtCompileTime> ComplexEigenSolver< _MatrixType >::EigenvectorType |
Type for matrix of eigenvectors as returned by eigenvectors().
This is a square matrix with entries of type ComplexScalar. The size is the same as the size of MatrixType.
Definition at line 99 of file ComplexEigenSolver.h.
typedef MatrixType::Index ComplexEigenSolver< _MatrixType >::Index |
Definition at line 77 of file ComplexEigenSolver.h.
typedef _MatrixType ComplexEigenSolver< _MatrixType >::MatrixType |
Synonym for the template parameter _MatrixType
.
Definition at line 64 of file ComplexEigenSolver.h.
typedef NumTraits<Scalar>::Real ComplexEigenSolver< _MatrixType >::RealScalar |
Definition at line 76 of file ComplexEigenSolver.h.
typedef MatrixType::Scalar ComplexEigenSolver< _MatrixType >::Scalar |
Scalar type for matrices of type MatrixType.
Definition at line 75 of file ComplexEigenSolver.h.
anonymous enum |
Definition at line 66 of file ComplexEigenSolver.h.
ComplexEigenSolver< _MatrixType >::ComplexEigenSolver | ( | ) | [inline] |
Default constructor.
The default constructor is useful in cases in which the user intends to perform decompositions via compute().
Definition at line 106 of file ComplexEigenSolver.h.
ComplexEigenSolver< _MatrixType >::ComplexEigenSolver | ( | Index | size ) | [inline] |
Default Constructor with memory preallocation.
Like the default constructor but with preallocation of the internal data according to the specified problem size.
Definition at line 121 of file ComplexEigenSolver.h.
ComplexEigenSolver< _MatrixType >::ComplexEigenSolver | ( | const MatrixType & | matrix, |
bool | computeEigenvectors = true |
||
) | [inline] |
Constructor; computes eigendecomposition of given matrix.
[in] | matrix | Square matrix whose eigendecomposition is to be computed. |
[in] | computeEigenvectors | If true, both the eigenvectors and the eigenvalues are computed; if false, only the eigenvalues are computed. |
This constructor calls compute() to compute the eigendecomposition.
Definition at line 139 of file ComplexEigenSolver.h.
References ComplexEigenSolver< _MatrixType >::compute().
ComplexEigenSolver< MatrixType > & ComplexEigenSolver< MatrixType >::compute | ( | const MatrixType & | matrix, |
bool | computeEigenvectors = true |
||
) |
Computes eigendecomposition of given matrix.
[in] | matrix | Square matrix whose eigendecomposition is to be computed. |
[in] | computeEigenvectors | If true, both the eigenvectors and the eigenvalues are computed; if false, only the eigenvalues are computed. |
*this
This function computes the eigenvalues of the complex matrix matrix
. The eigenvalues() function can be used to retrieve them. If computeEigenvectors
is true, then the eigenvectors are also computed and can be retrieved by calling eigenvectors().
The matrix is first reduced to Schur form using the ComplexSchur class. The Schur decomposition is then used to compute the eigenvalues and eigenvectors.
The cost of the computation is dominated by the cost of the Schur decomposition, which is where
is the size of the matrix.
Example:
Output:
Definition at line 251 of file ComplexEigenSolver.h.
References ComplexEigenSolver< _MatrixType >::compute(), and Success.
Referenced by ComplexEigenSolver< _MatrixType >::ComplexEigenSolver(), and ComplexEigenSolver< _MatrixType >::compute().
void ComplexEigenSolver< MatrixType >::doComputeEigenvectors | ( | RealScalar | matrixnorm ) | [private] |
Definition at line 275 of file ComplexEigenSolver.h.
References internal::real_ref().
const EigenvalueType& ComplexEigenSolver< _MatrixType >::eigenvalues | ( | ) | const [inline] |
Returns the eigenvalues of given matrix.
This function returns a column vector containing the eigenvalues. Eigenvalues are repeated according to their algebraic multiplicity, so there are as many eigenvalues as rows in the matrix.
Example:
Output:
Definition at line 194 of file ComplexEigenSolver.h.
References eigen_assert, ComplexEigenSolver< _MatrixType >::m_eivalues, and ComplexEigenSolver< _MatrixType >::m_isInitialized.
const EigenvectorType& ComplexEigenSolver< _MatrixType >::eigenvectors | ( | ) | const [inline] |
Returns the eigenvectors of given matrix.
computeEigenvectors
was set to true (the default).This function returns a matrix whose columns are the eigenvectors. Column is an eigenvector corresponding to eigenvalue number
as returned by eigenvalues(). The eigenvectors are normalized to have (Euclidean) norm equal to one. The matrix returned by this function is the matrix
in the eigendecomposition
, if it exists.
Example:
Output:
Definition at line 170 of file ComplexEigenSolver.h.
References eigen_assert, ComplexEigenSolver< _MatrixType >::m_eigenvectorsOk, ComplexEigenSolver< _MatrixType >::m_eivec, and ComplexEigenSolver< _MatrixType >::m_isInitialized.
ComputationInfo ComplexEigenSolver< _MatrixType >::info | ( | ) | const [inline] |
Reports whether previous computation was successful.
Success
if computation was succesful, NoConvergence
otherwise. Definition at line 230 of file ComplexEigenSolver.h.
References eigen_assert, ComplexSchur< _MatrixType >::info(), ComplexEigenSolver< _MatrixType >::m_isInitialized, and ComplexEigenSolver< _MatrixType >::m_schur.
void ComplexEigenSolver< MatrixType >::sortEigenvalues | ( | bool | computeEigenvectors ) | [private] |
Definition at line 313 of file ComplexEigenSolver.h.
bool ComplexEigenSolver< _MatrixType >::m_eigenvectorsOk [protected] |
Definition at line 241 of file ComplexEigenSolver.h.
Referenced by ComplexEigenSolver< _MatrixType >::eigenvectors().
EigenvalueType ComplexEigenSolver< _MatrixType >::m_eivalues [protected] |
Definition at line 238 of file ComplexEigenSolver.h.
Referenced by ComplexEigenSolver< _MatrixType >::eigenvalues().
EigenvectorType ComplexEigenSolver< _MatrixType >::m_eivec [protected] |
Definition at line 237 of file ComplexEigenSolver.h.
Referenced by ComplexEigenSolver< _MatrixType >::eigenvectors().
bool ComplexEigenSolver< _MatrixType >::m_isInitialized [protected] |
Definition at line 240 of file ComplexEigenSolver.h.
Referenced by ComplexEigenSolver< _MatrixType >::eigenvalues(), ComplexEigenSolver< _MatrixType >::eigenvectors(), and ComplexEigenSolver< _MatrixType >::info().
EigenvectorType ComplexEigenSolver< _MatrixType >::m_matX [protected] |
Definition at line 242 of file ComplexEigenSolver.h.
ComplexSchur<MatrixType> ComplexEigenSolver< _MatrixType >::m_schur [protected] |
Definition at line 239 of file ComplexEigenSolver.h.
Referenced by ComplexEigenSolver< _MatrixType >::info().
Page generated by Doxygen 1.7.2 for MRPT 0.9.4 SVN: at Mon Jan 10 22:46:17 UTC 2011 |