#include <SymEigsShiftSolver.h>
Public Member Functions | |
SymEigsShiftSolver (OpType *op, Index nev, Index ncv, Scalar sigma) | |
Public Member Functions inherited from Spectra::SymEigsBase< double, LARGEST_MAGN, DenseSymShiftSolve< double >, IdentityBOp > | |
Index | compute (Index maxit=1000, double tol=1e-10, int sort_rule=LARGEST_ALGE) |
Vector | eigenvalues () const |
virtual Matrix | eigenvectors () const |
virtual Matrix | eigenvectors (Index nvec) const |
int | info () const |
void | init () |
void | init (const double *init_resid) |
Index | num_iterations () const |
Index | num_operations () const |
Private Types | |
typedef Eigen::Array< Scalar, Eigen::Dynamic, 1 > | Array |
typedef Eigen::Index | Index |
Private Member Functions | |
void | sort_ritzpair (int sort_rule) |
Private Attributes | |
const Scalar | m_sigma |
Additional Inherited Members | |
Protected Attributes inherited from Spectra::SymEigsBase< double, LARGEST_MAGN, DenseSymShiftSolve< double >, IdentityBOp > | |
LanczosFac | m_fac |
const Index | m_n |
const Index | m_ncv |
const Index | m_nev |
Index | m_niter |
Index | m_nmatop |
DenseSymShiftSolve< double > * | m_op |
Vector | m_ritz_val |
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 and are a pair of eigenvalue and eigenvector of matrix , such that , then for any , we have
where
which indicates that is an eigenpair of the matrix .
Therefore, if we pass the matrix operation (rather than ) to the eigen solver, then we would get the desired values of , and can also be easily obtained by noting that .
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 , find the largest eigenvalues of , and then transform back to , since in this case largest values of implies smallest values of .
To summarize, in the shift-and-invert mode, the selection rule will apply to rather than . So a selection rule of LARGEST_MAGN
combined with shift will find eigenvalues of that are closest to . But note that the eigenvalues() method will always return the eigenvalues in the original problem (i.e., returning rather than ), and eigenvectors are the same for both the original problem and the shifted-and-inverted problem.
Scalar | The element type of the matrix. Currently supported types are float , double and long double . |
SelectionRule | An enumeration value indicating the selection rule of the shifted-and-inverted eigenvalues. The full list of enumeration values can be found in Enumerations. |
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 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:
Definition at line 158 of file SymEigsShiftSolver.h.
|
private |
Definition at line 162 of file SymEigsShiftSolver.h.
|
private |
Definition at line 161 of file SymEigsShiftSolver.h.
|
inline |
Constructor to create a eigen solver object using the shift-and-invert mode.
op | Pointer to the matrix operation object, which should implement the shift-solve operation of : calculating for any vector . Users could either create the object from the wrapper class such as DenseSymShiftSolve, or define their own that implements all the public member functions as in DenseSymShiftSolve. |
nev | Number of eigenvalues requested. This should satisfy , where 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 , and is advised to take . |
sigma | The value of the shift. |
Definition at line 193 of file SymEigsShiftSolver.h.
|
inlineprivatevirtual |
Reimplemented from Spectra::SymEigsBase< double, LARGEST_MAGN, DenseSymShiftSolve< double >, IdentityBOp >.
Definition at line 167 of file SymEigsShiftSolver.h.
|
private |
Definition at line 164 of file SymEigsShiftSolver.h.