![]() |
Eigen
3.4.90 (git rev 9589cc4e7fd8e4538bedef80dd36c7738977a8be)
|
#include <Eigen/src/Eigenvalues/ComplexEigenSolver.h>
Computes eigenvalues and eigenvectors of general complex matrices.
This is defined in the 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
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.
Public Types | |
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, MaxColsAtCompileTime > | EigenvectorType |
Type for matrix of eigenvectors as returned by eigenvectors(). | |
typedef Eigen::Index | Index |
typedef MatrixType_ | MatrixType |
Synonym for the template parameter MatrixType_ . | |
typedef MatrixType::Scalar | Scalar |
Scalar type for matrices of type MatrixType. | |
Public Member Functions | |
ComplexEigenSolver () | |
Default constructor. | |
template<typename InputType> | |
ComplexEigenSolver (const EigenBase< InputType > &matrix, bool computeEigenvectors=true) | |
Constructor; computes eigendecomposition of given matrix. | |
ComplexEigenSolver (Index size) | |
Default Constructor with memory preallocation. | |
template<typename InputType> | |
ComplexEigenSolver & | compute (const EigenBase< InputType > &matrix, bool computeEigenvectors=true) |
Computes eigendecomposition of given matrix. | |
const EigenvalueType & | eigenvalues () const |
Returns the eigenvalues of given matrix. | |
const EigenvectorType & | eigenvectors () const |
Returns the eigenvectors of given matrix. | |
Index | getMaxIterations () |
Returns the maximum number of iterations. | |
ComputationInfo | info () const |
Reports whether previous computation was successful. | |
ComplexEigenSolver & | setMaxIterations (Index maxIters) |
Sets the maximum number of iterations allowed. | |
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 |
|
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.
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
Example:
Output:
Here is a random 4x4 matrix, A: (0.924,-0.824) (0.633,-0.779) (0.256,0.484) (0.284,-0.78) (-0.199,-0.0532) (0.982,-0.573) (-0.232,-0.499) (0.71,-0.547) (0.146,-0.237) (-0.139,-0.23) (-0.642,-0.654) (0.748,0.449) (0.334,0.634) (0.0919,0.542) (0.738,-0.737) (0.625,-0.379) The eigenvalues of A are: (1.02,-0.0991) (0.311,-1.26) (-1.36,-0.519) (1.92,-0.556) The matrix of eigenvectors, V, is: (-0.698,-0.283) (0.425,-0.461) (0.153,-0.297) (0.496,-0.579) (0.584,-0.145) (-0.417,-0.429) (0.105,0.0334) (0.378,0.0761) (-0.221,0.0391) (-0.339,-0.0621) (0.48,0.609) (0.0231,0.0479) (-0.144,-0.00303) (-0.175,0.315) (-0.523,-0.0407) (0.402,0.326) Consider the first eigenvalue, lambda = (1.02,-0.0991) If v is the corresponding eigenvector, then lambda * v = (-0.739,-0.219) (0.582,-0.205) (-0.222,0.0618) (-0.147,0.0111) ... and A * v = (-0.739,-0.219) (0.582,-0.205) (-0.222,0.0618) (-0.147,0.0111) Finally, V * D * V^(-1) = (0.924,-0.824) (0.633,-0.779) (0.256,0.484) (0.284,-0.78) (-0.199,-0.0532) (0.982,-0.573) (-0.232,-0.499) (0.71,-0.547) (0.146,-0.237) (-0.139,-0.23) (-0.642,-0.654) (0.748,0.449) (0.334,0.634) (0.0919,0.542) (0.738,-0.737) (0.625,-0.379)
|
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:
The eigenvalues of the 3x3 matrix of ones are: (0,-0) (0,0) (3,0)
|
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
Example:
Output:
The first eigenvector of the 3x3 matrix of ones is: (-0.816,0) (0.408,0) (0.408,0)
|
inline |
Reports whether previous computation was successful.
Success
if computation was successful, NoConvergence
otherwise.