Module: Linear Algebra Group: Symmetric Eigenvalue Decomposition classes
Does not inherit
#include <rw/lapack/symeig.h> // RWSymEigDecomp<T> #include <rw/lapack/hermeig.h> // RWHermEigDecomp<T> RWSymEigDecomp<double> eig(A); // A is an
// RWGenMat<double>
The class RWSymEigDecomp<T> encapsulates the eigenvalues and eigenvectors of a symmetric matrix, a Hermitian in the complex case. 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 RWSymEigServer<T> in this manual for details.
#include <iostream> #include <rw/lapack/eig.h> int main() { RWSymMat<double> A; std::cin >> A; RWSymEigDecomp<double> eig(A); std::cout << "eigenvalues: " << eig.eigenValues() << std::endl; std::cout << "eigenvectors: " << eig.eigenVectors() << std::endl; return 0; }
RWSymEigDecomp(); RWHermEigDecomp();
Default constructor. Builds a decomposition of a 0 x 0 matrix.
RWSymEigDecomp(const RWSymEigDecomp<T>& A); RWHermEigDecomp(const RWHermEigDecomp<T>& A); RWHermEigDecomp(const RWHermEigDecomp<double>& A);
Copy and precision conversion constructors. Where possible, data is referenced for efficiency.
RWSymEigDecomp(const RWSymMat<T>& A,
bool computeVecs=true); RWHermEigDecomp(const RWHermMat<T>& A,
bool computeVecs=true); RWSymEigDecomp(const RWSymBandMat<T>& A,
bool cv=true); RWHermEigDecomp(const RWHermBandMat<T>& A,
bool =true);
Constructs a representation of the eigenvalues and eigenvectors of the matrix A. The boolean parameter controls whether eigenvectors are computed.
unsigned RWSymEigDecomp<T>::cols(); unsigned RWHermEigDecomp<T>::cols();
Returns the number of columns in the decomposed matrix.
T RWSymEigDecomp<T>::eigenValue(int i) const; double RWHermEigDecomp<DComplex>::eigenValue(int i) const;
Returns the ith eigenvalue.
RWMathVec<T> RWSymEigDecomp<T>::eigenValues() const; RWMathVec<double> RWHermEigDecomp<DComplex>::eigenValues() const;
Returns a vector of all computed eigenvalues.
RWMathVec<T> RWSymEigDecomp<T>::eigenVector(int i) const; RWMathVec<T> RWHermEigDecomp<T>::eigenVector(int i) const;
Returns the ith eigenvector.
RWGenMat<T> RWSymEigDecomp<T>::eigenVectors() const; RWGenMat<T> RWHermEigDecomp<T>::eigenVectors() const;
Returns a matrix whose columns are the eigenvectors.
void RWSymEigDecomp<T>::factor(const RWSymMat<T>& A,
bool computeVecs=true); void RWHermEigDecomp<T>::factor(const RWHermMat<T>& A,
bool computeVecs =true); void RWSymEigDecomp<T>::factor(const RWSymBandMat<T>& A,
bool computeVecs=true); void RWHermEigDecomp<T>::factor(RWHermBandMat<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 RWSymEigDecomp<T>::fail() const; bool RWHermEigDecomp<T>::fail() const;
Returns true if an eigenvalue or eigenvector that is supposed to be computed fails to be computed.
bool RWSymEigDecomp<T>::good() const; bool RWHermEigDecomp<T>::good() const;
Returns true if all desired eigenvalues and eigenvectors are successfully computed to full desired accuracy.
bool RWSymEigDecomp<T>::inaccurate() const; bool RWHermEigDecomp<T>::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.
unsigned RWSymEigDecomp<T>::numEigenValues() const; unsigned RWHermEigDecomp<T>::numEigenValues() const;
Returns the number of eigenvalues in this object.
unsigned RWSymEigDecomp<T>::numEigenVectors() const; unsigned RWHermEigDecomp<T>::numEigenVectors() const;
Returns the number of eigenvectors in this object.
unsigned RWSymEigDecomp<T>::rows(); unsigned RWHermEigDecomp<T>::rows();
Returns the number of rows in the decomposed matrix.
void RWSymEigDecomp<T>::operator=
(const RWSymEigDecomp<T>&); void RWHermEigDecomp<T>::operator=
(const RWHermEigDecomp<T>&);
Assigns this decomposition the passed value. 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.