![]() |
|
Computes eigenvalues and eigenvectors of general complex matrices. More...
#include <ComplexEigenSolver.h>
Public Types | |
enum | { RowsAtCompileTime = MatrixType::RowsAtCompileTime , ColsAtCompileTime = MatrixType::ColsAtCompileTime , Options = internal::traits<MatrixType>::Options , MaxRowsAtCompileTime = MatrixType::MaxRowsAtCompileTime , MaxColsAtCompileTime = MatrixType::MaxColsAtCompileTime } |
typedef MatrixType_ | MatrixType |
Synonym for the template parameter MatrixType_ . More... | |
typedef MatrixType::Scalar | Scalar |
Scalar type for matrices of type MatrixType. More... | |
typedef NumTraits< Scalar >::Real | RealScalar |
typedef Eigen::Index | Index |
typedef std::complex< RealScalar > | ComplexScalar |
Complex scalar type for MatrixType. More... | |
typedef Matrix< ComplexScalar, ColsAtCompileTime, 1, Options &(~RowMajor), MaxColsAtCompileTime, 1 > | EigenvalueType |
Type for vector of eigenvalues as returned by eigenvalues(). More... | |
typedef Matrix< ComplexScalar, RowsAtCompileTime, ColsAtCompileTime, Options, MaxRowsAtCompileTime, MaxColsAtCompileTime > | EigenvectorType |
Type for matrix of eigenvectors as returned by eigenvectors(). More... | |
Public Member Functions | |
ComplexEigenSolver () | |
Default constructor. More... | |
ComplexEigenSolver (Index size) | |
Default Constructor with memory preallocation. More... | |
template<typename InputType > | |
ComplexEigenSolver (const EigenBase< InputType > &matrix, bool computeEigenvectors=true) | |
Constructor; computes eigendecomposition of given matrix. More... | |
const EigenvectorType & | eigenvectors () const |
Returns the eigenvectors of given matrix. More... | |
const EigenvalueType & | eigenvalues () const |
Returns the eigenvalues of given matrix. More... | |
template<typename InputType > | |
ComplexEigenSolver & | compute (const EigenBase< InputType > &matrix, bool computeEigenvectors=true) |
Computes eigendecomposition of given matrix. More... | |
ComputationInfo | info () const |
Reports whether previous computation was successful. More... | |
ComplexEigenSolver & | setMaxIterations (Index maxIters) |
Sets the maximum number of iterations allowed. More... | |
Index | getMaxIterations () |
Returns the maximum number of iterations. More... | |
template<typename InputType > | |
ComplexEigenSolver< MatrixType > & | compute (const EigenBase< InputType > &matrix, bool computeEigenvectors) |
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) |
Computes eigenvalues and eigenvectors of general complex matrices.
\eigenvalues_module
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 \( A \) are scalars \( \lambda \) and vectors \( v \) such that \( Av = \lambda v \). If \( D \) is a diagonal matrix with the eigenvalues on the diagonal, and \( V \) is a matrix with the eigenvectors as its columns, then \( A V = V D \). The matrix \( V \) is almost always invertible, in which case we have \( A = V D V^{-1} \). 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.
typedef std::complex<RealScalar> Eigen::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.
typedef Matrix<ComplexScalar, ColsAtCompileTime, 1, Options & (~RowMajor), MaxColsAtCompileTime, 1> Eigen::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.
typedef Matrix<ComplexScalar, RowsAtCompileTime, ColsAtCompileTime, Options, MaxRowsAtCompileTime, MaxColsAtCompileTime> Eigen::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.
typedef Eigen::Index Eigen::ComplexEigenSolver< MatrixType_ >::Index |
typedef MatrixType_ Eigen::ComplexEigenSolver< MatrixType_ >::MatrixType |
Synonym for the template parameter MatrixType_
.
typedef NumTraits<Scalar>::Real Eigen::ComplexEigenSolver< MatrixType_ >::RealScalar |
typedef MatrixType::Scalar Eigen::ComplexEigenSolver< MatrixType_ >::Scalar |
Scalar type for matrices of type MatrixType.
anonymous enum |
|
inline |
Default constructor.
The default constructor is useful in cases in which the user intends to perform decompositions via compute().
|
inlineexplicit |
Default Constructor with memory preallocation.
Like the default constructor but with preallocation of the internal data according to the specified problem size.
|
inlineexplicit |
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.
References Eigen::ComplexEigenSolver< MatrixType_ >::compute(), and matrix().
ComplexEigenSolver<MatrixType>& Eigen::ComplexEigenSolver< MatrixType_ >::compute | ( | const EigenBase< InputType > & | matrix, |
bool | computeEigenvectors | ||
) |
References Eigen::ComplexSchur< MatrixType_ >::compute(), Eigen::ComplexEigenSolver< MatrixType_ >::doComputeEigenvectors(), eigen_assert, Eigen::ComplexSchur< MatrixType_ >::info(), Eigen::ComplexEigenSolver< MatrixType_ >::m_eigenvectorsOk, Eigen::ComplexEigenSolver< MatrixType_ >::m_eivalues, Eigen::ComplexEigenSolver< MatrixType_ >::m_isInitialized, Eigen::ComplexEigenSolver< MatrixType_ >::m_schur, matrix(), Eigen::ComplexSchur< MatrixType_ >::matrixT(), Eigen::ComplexEigenSolver< MatrixType_ >::sortEigenvalues(), and Eigen::Success.
ComplexEigenSolver& Eigen::ComplexEigenSolver< MatrixType_ >::compute | ( | const EigenBase< InputType > & | 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 \( O(n^3) \) where \( n \) is the size of the matrix.
Example:
Output:
Referenced by Eigen::ComplexEigenSolver< MatrixType_ >::ComplexEigenSolver(), ctms_decompositions(), eigensolver(), and eigensolver_verify_assert().
|
private |
References Eigen::PlainObjectBase< Derived >::coeff(), Eigen::Matrix< Scalar_, Rows_, Cols_, Options_, MaxRows_, MaxCols_ >::coeffRef(), oomph::SarahBL::epsilon, i, k, Eigen::ComplexEigenSolver< MatrixType_ >::m_eivalues, Eigen::ComplexEigenSolver< MatrixType_ >::m_eivec, Eigen::ComplexEigenSolver< MatrixType_ >::m_matX, Eigen::ComplexEigenSolver< MatrixType_ >::m_schur, Eigen::ComplexSchur< MatrixType_ >::matrixT(), Eigen::ComplexSchur< MatrixType_ >::matrixU(), Eigen::numext::maxi(), min, n, Eigen::numext::real_ref(), Eigen::value, and oomph::PseudoSolidHelper::Zero.
Referenced by Eigen::ComplexEigenSolver< MatrixType_ >::compute().
|
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. The eigenvalues are not sorted in any particular order.
Example:
Output:
References eigen_assert, Eigen::ComplexEigenSolver< MatrixType_ >::m_eivalues, and Eigen::ComplexEigenSolver< MatrixType_ >::m_isInitialized.
Referenced by eigensolver(), eigensolver_verify_assert(), and Eigen::internal::eigenvalues_selector< Derived, IsComplex >::run().
|
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 \( k \) is an eigenvector corresponding to eigenvalue number \( k \) as returned by eigenvalues(). The eigenvectors are normalized to have (Euclidean) norm equal to one. The matrix returned by this function is the matrix \( V \) in the eigendecomposition \( A = V D V^{-1} \), if it exists.
Example:
Output:
References eigen_assert, Eigen::ComplexEigenSolver< MatrixType_ >::m_eigenvectorsOk, Eigen::ComplexEigenSolver< MatrixType_ >::m_eivec, and Eigen::ComplexEigenSolver< MatrixType_ >::m_isInitialized.
Referenced by eigensolver(), and eigensolver_verify_assert().
|
inline |
Returns the maximum number of iterations.
References Eigen::ComplexSchur< MatrixType_ >::getMaxIterations(), and Eigen::ComplexEigenSolver< MatrixType_ >::m_schur.
Referenced by eigensolver().
|
inline |
Reports whether previous computation was successful.
Success
if computation was successful, NoConvergence
otherwise. References eigen_assert, Eigen::ComplexSchur< MatrixType_ >::info(), Eigen::ComplexEigenSolver< MatrixType_ >::m_isInitialized, and Eigen::ComplexEigenSolver< MatrixType_ >::m_schur.
Referenced by eigensolver().
|
inline |
Sets the maximum number of iterations allowed.
References Eigen::ComplexEigenSolver< MatrixType_ >::m_schur, and Eigen::ComplexSchur< MatrixType_ >::setMaxIterations().
Referenced by eigensolver().
|
private |
References i, k, Eigen::ComplexEigenSolver< MatrixType_ >::m_eivalues, Eigen::ComplexEigenSolver< MatrixType_ >::m_eivec, n, Eigen::PlainObjectBase< Derived >::swap(), and swap().
Referenced by Eigen::ComplexEigenSolver< MatrixType_ >::compute().
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
Referenced by Eigen::ComplexEigenSolver< MatrixType_ >::compute(), Eigen::ComplexEigenSolver< MatrixType_ >::doComputeEigenvectors(), Eigen::ComplexEigenSolver< MatrixType_ >::getMaxIterations(), Eigen::ComplexEigenSolver< MatrixType_ >::info(), and Eigen::ComplexEigenSolver< MatrixType_ >::setMaxIterations().