Description
template<typename OpType = DenseSymShiftSolve<double>>
class Spectra::SymEigsShiftSolver< OpType >
This class implements the eigen solver for real symmetric matrices using the shift-and-invert mode. The background information of the symmetric eigen solver is documented in the SymEigsSolver class. Here we focus on explaining the shift-and-invert mode.
The shift-and-invert mode is based on the following fact: If \(\lambda\) and \(x\) are a pair of eigenvalue and eigenvector of matrix \(A\), such that \(Ax=\lambda x\), then for any \(\sigma\), we have
\[(A-\sigma I)^{-1}x=\nu x\]
where
\[\nu=\frac{1}{\lambda-\sigma}\]
which indicates that \((\nu, x)\) is an eigenpair of the matrix \((A-\sigma I)^{-1}\).
Therefore, if we pass the matrix operation \((A-\sigma I)^{-1}y\) (rather than \(Ay\)) to the eigen solver, then we would get the desired values of \(\nu\), and \(\lambda\) can also be easily obtained by noting that \(\lambda=\sigma+\nu^{-1}\).
The reason why we need this type of manipulation is that the algorithm of Spectra (and also ARPACK) is good at finding eigenvalues with large magnitude, but may fail in looking for eigenvalues that are close to zero. However, if we really need them, we can set \(\sigma=0\), find the largest eigenvalues of \(A^{-1}\), and then transform back to \(\lambda\), since in this case largest values of \(\nu\) implies smallest values of \(\lambda\).
To summarize, in the shift-and-invert mode, the selection rule will apply to \(\nu=1/(\lambda-\sigma)\) rather than \(\lambda\). So a selection rule of LARGEST_MAGN combined with shift \(\sigma\) will find eigenvalues of \(A\) that are closest to \(\sigma\). But note that the eigenvalues() method will always return the eigenvalues in the original problem (i.e., returning \(\lambda\) rather than \(\nu\)), and eigenvectors are the same for both the original problem and the shifted-and-inverted problem.
- Template Parameters
-
OpType The name of the matrix operation class. Users could either use the wrapper classes such as DenseSymShiftSolve and SparseSymShiftSolve, or define their own that implements the type definition Scalarand all the public member functions as in DenseSymShiftSolve.
Below is an example that illustrates the use of the shift-and-invert mode:
Also an example for user-supplied matrix shift-solve operation class:
#include <SymEigsShiftSolver.h>


Public Member Functions | |
| SymEigsShiftSolver (OpType &op, Index nev, Index ncv, const Scalar &sigma) | |
| Constructor to create a eigen solver object using the shift-and-invert mode. More... | |
Public Member Functions inherited from Spectra::HermEigsBase< DenseSymShiftSolve< double >, IdentityBOp > | |
| void | init (const Scalar *init_resid) |
| Initializes the solver by providing an initial residual vector. More... | |
| void | init () |
| Initializes the solver by providing a random initial residual vector. More... | |
| Index | compute (SortRule selection=SortRule::LargestMagn, Index maxit=1000, RealScalar tol=1e-10, SortRule sorting=SortRule::LargestAlge) |
| Conducts the major computation procedure. More... | |
| CompInfo | info () const |
| Returns the status of the computation. More... | |
| Index | num_iterations () const |
| Returns the number of iterations used in the computation. | |
| Index | num_operations () const |
| Returns the number of matrix operations used in the computation. | |
| RealVector | eigenvalues () const |
| Returns the converged eigenvalues. More... | |
| virtual Matrix | eigenvectors (Index nvec) const |
| Returns the eigenvectors associated with the converged eigenvalues. More... | |
| virtual Matrix | eigenvectors () const |
| Returns all converged eigenvectors. | |
Additional Inherited Members | |
Protected Attributes inherited from Spectra::HermEigsBase< DenseSymShiftSolve< double >, IdentityBOp > | |
| std::vector< DenseSymShiftSolve< double > > | m_op_container |
| const DenseSymShiftSolve< double > & | m_op |
| const Index | m_n |
| const Index | m_nev |
| const Index | m_ncv |
| Index | m_nmatop |
| Index | m_niter |
| LanczosFac | m_fac |
| RealVector | m_ritz_val |
Constructor & Destructor Documentation
◆ SymEigsShiftSolver()
|
inline |
Constructor to create a eigen solver object using the shift-and-invert mode.
- Parameters
-
op The matrix operation object that implements the shift-solve operation of \(A\): calculating \((A-\sigma I)^{-1}v\) for any vector \(v\). Users could either create the object from the wrapper class such as DenseSymShiftSolve, or define their own that implements all the public members as in DenseSymShiftSolve. nev Number of eigenvalues requested. This should satisfy \(1\le nev \le n-1\), where \(n\) is the size of matrix. ncv Parameter that controls the convergence speed of the algorithm. Typically a larger ncv_means faster convergence, but it may also result in greater memory use and more matrix operations in each iteration. This parameter must satisfy \(nev < ncv \le n\), and is advised to take \(ncv \ge 2\cdot nev\).sigma The value of the shift.
The documentation for this class was generated from the following file:
- /builds/uwsbel/chrono/src/chrono_thirdparty/spectra/Spectra/SymEigsShiftSolver.h
Public Member Functions inherited from