#include <SymEigsSolver.h>
Public Member Functions | |
SymEigsSolver (OpType &op, Index nev, Index ncv) | |
![]() | |
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 | |
![]() | |
virtual void | sort_ritzpair (SortRule sort_rule) |
![]() | |
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 ![]() ![]() ![]() |
nev | Number of eigenvalues requested. This should satisfy ![]() ![]() |
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 ![]() ![]() |
Definition at line 157 of file SymEigsSolver.h.