#include <SymEigsSolver.h>
Public Member Functions | |
SymEigsSolver (OpType *op, Index nev, Index ncv) | |
Public Member Functions inherited from Spectra::SymEigsBase< double, LARGEST_MAGN, DenseSymMatProd< 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::Index | Index |
Additional Inherited Members | |
Protected Member Functions inherited from Spectra::SymEigsBase< double, LARGEST_MAGN, DenseSymMatProd< double >, IdentityBOp > | |
virtual void | sort_ritzpair (int sort_rule) |
Protected Attributes inherited from Spectra::SymEigsBase< double, LARGEST_MAGN, DenseSymMatProd< double >, IdentityBOp > | |
LanczosFac | m_fac |
const Index | m_n |
const Index | m_ncv |
const Index | m_nev |
Index | m_niter |
Index | m_nmatop |
DenseSymMatProd< double > * | m_op |
Vector | m_ritz_val |
This class implements the eigen solver for real symmetric matrices, i.e., to solve where is symmetric.
Spectra is designed to calculate a specified number ( ) of eigenvalues of a large square matrix ( ). Usually is much less than the size of the matrix ( ), so that only a few eigenvalues and eigenvectors are computed.
Rather than providing the whole matrix, the algorithm only requires the matrix-vector multiplication operation of . Therefore, users of this solver need to supply a class that computes the result of for any given vector . The name of this class should be given to the template parameter OpType
, and instance of this class passed to the constructor of SymEigsSolver.
If the matrix is already stored as a matrix object in Eigen, for example Eigen::MatrixXd
, then there is an easy way to construct such matrix operation class, by using the built-in wrapper class DenseSymMatProd which wraps an existing matrix object in Eigen. This is also the default template parameter for SymEigsSolver. For sparse matrices, the wrapper class SparseSymMatProd can be used similarly.
If the users need to define their own matrix-vector multiplication operation class, it should implement all the public member functions as in DenseSymMatProd.
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 requested eigenvalues, for example LARGEST_MAGN to retrieve eigenvalues with the largest magnitude. 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 DenseSymMatProd and SparseSymMatProd, or define their own that implements all the public member functions as in DenseSymMatProd. |
Below is an example that demonstrates the usage of this class.
And here is an example for user-supplied matrix operation class.
Definition at line 141 of file SymEigsSolver.h.
|
private |
Definition at line 144 of file SymEigsSolver.h.
|
inline |
Constructor to create a solver object.
op | Pointer to the matrix operation object, which should implement the matrix-vector multiplication operation of : calculating for any vector . Users could either create the object from the wrapper class such as DenseSymMatProd, or define their own that implements all the public member functions as in DenseSymMatProd. |
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 . |
Definition at line 164 of file SymEigsSolver.h.