#include <SymEigsSolver.h>

Public Member Functions | |
| SymEigsSolver (OpType &op, Index nev, Index ncv) | |
Public Member Functions inherited from Spectra::HermEigsBase< DenseSymMatProd< double >, IdentityBOp > | |
| Index | compute (SortRule selection=SortRule::LargestMagn, Index maxit=1000, RealScalar tol=1e-10, SortRule sorting=SortRule::LargestAlge) |
| RealVector | eigenvalues () const |
| virtual Matrix | eigenvectors () const |
| virtual Matrix | eigenvectors (Index nvec) const |
| CompInfo | info () const |
| void | init () |
| void | init (const Scalar *init_resid) |
| Index | num_iterations () const |
| Index | num_operations () const |
Private Types | |
| using | Index = Eigen::Index |
Additional Inherited Members | |
Protected Member Functions inherited from Spectra::HermEigsBase< DenseSymMatProd< double >, IdentityBOp > | |
| virtual void | sort_ritzpair (SortRule sort_rule) |
Protected Attributes inherited from Spectra::HermEigsBase< DenseSymMatProd< double >, IdentityBOp > | |
| LanczosFac | m_fac |
| const Index | m_n |
| const Index | m_ncv |
| const Index | m_nev |
| Index | m_niter |
| Index | m_nmatop |
| const DenseSymMatProd< double > & | m_op |
| std::vector< DenseSymMatProd< double > > | m_op_container |
| RealVector | 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 a matrix operation class, by using the built-in wrapper class DenseSymMatProd that 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 define a public type Scalar to indicate the element type, and implement all the public member functions as in DenseSymMatProd.
| 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 the type definition Scalar and 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 134 of file SymEigsSolver.h.
|
private |
Definition at line 137 of file SymEigsSolver.h.
|
inline |
Constructor to create a solver object.
| op | The matrix operation object that implements 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 members 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 157 of file SymEigsSolver.h.