Module: Linear Algebra Group: Nonsymmetric Eigenvalue Decomposition classes
Does not inherit
#include <rw/lapack/eig.h> RWEigDecomp<double> eig(A); // A is an
// RWGenMat<double>
The class RWEigDecomp<T> encapsulates the eigenvalues and eigenvectors of a nonsymmetric matrix. You can construct an eigenvalue decomposition object in two ways:
Use the decomposition class constructor. This has the advantage of simplicity, but allows only limited control over the computation. Your only choice is whether or not to compute eigenvectors.
Use an eigenvalue server object. This gives you more precise control over the computation. See RWEigServer<T> in this manual for details.
#include <iostream> #include <rw/lapack/eig.h> int main() { RWGenMat<double> A; std::cin >> A; RWEigDecomp<double> eig(A); std::cout << "eigenvalues: " << eig.eigenValues() << std::endl; std::cout << "left eigenvectors: " << eig.leftEigenVectors()
<< std::endl; std::cout << "right vectors: " << eig.rightEigenVectors() << endl; return 0; }
RWEigDecomp();
Default constructor. Builds a decomposition of a 0 x 0 matrix.
RWEigDecomp<T>(const RWEigDecomp<T>& A); RWEigDecomp<DComplex>(const RWEigDecomp<double>& A);
Copy and precision conversion constructors. Where possible, data is referenced for efficiency.
RWEigDecomp(const RWGenMat<T>& A,
bool computeVecs=true);
Constructs a representation of the eigenvalues and eigenvectors of the matrix A. The boolean parameter controls whether eigenvectors are computed.
unsigned cols();
Returns the number of columns in the decomposed matrix.
DComplex eigenValue(int i) const;
Returns the ith eigenvalue.
RWMathVec<DComplex> eigenValues() const;
Returns a vector of all computed eigenvalues.
void factor(const RWGenMat<T>& A,
bool computeVecs=true);
Constructs a representation of the eigenvalues and eigenvectors of the matrix A. The boolean parameter controls whether eigenvectors are computed. The current contents of the decomposition are lost.
bool fail() const;
Returns true if an eigenvalue or eigenvector that is supposed to be computed fails to be computed.
bool good() const;
Returns true if all desired eigenvalues and eigenvectors are successfully computed to full desired accuracy.
bool inaccurate() const;
Returns true if either an eigenvalue or eigenvector that is supposed to be computed fails to be computed, or some of the computed quantities are not computed to full desired accuracy.
RWMathVec<DComplex> leftEigenVector(int i) const;
Returns the ith left eigenvector.
RWGenMat<DComplex> leftEigenVectors() const;
Returns a vector of all computed left eigenvectors.
unsigned numEigenValues() const; unsigned numLeftEigenVectors() const; unsigned numRightEigenVectors() const;
Returns the number of eigenvalues or eigenvectors represented in this object.
RWMathVec<DComplex> rightEigenVector(int i) const;
Returns the ith right eigenvector.
RWGenMat<DComplex> rightEigenVectors() const;
Returns a matrix of all computed right eigenvectors.
unsigned rows();
Returns the number of rows in the decomposed matrix.
void operator=(const RWEigDecomp<T>&);
Assigns the passed value to this decomposition. The current contents of the decomposition are lost.
© Copyright Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave and SourcePro are registered trademarks of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.
Contact Rogue Wave about documentation or support issues.