Public Member Functions | Protected Member Functions | Protected Attributes | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
Spectra::HermEigsBase< OpType, BOpType > Class Template Reference

#include <HermEigsBase.h>

Public Member Functions

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
 

Protected Member Functions

virtual void sort_ritzpair (SortRule sort_rule)
 

Protected Attributes

LanczosFac m_fac
 
const Index m_n
 
const Index m_ncv
 
const Index m_nev
 
Index m_niter
 
Index m_nmatop
 
const OpType & m_op
 
std::vector< OpType > m_op_container
 
RealVector m_ritz_val
 

Private Types

using ArnoldiOpType = ArnoldiOp< Scalar, OpType, BOpType >
 
using BoolArray = Eigen::Array< bool, Eigen::Dynamic, 1 >
 
using Index = Eigen::Index
 
using LanczosFac = Lanczos< Scalar, ArnoldiOpType >
 
using MapConstVec = Eigen::Map< const Vector >
 
using MapMat = Eigen::Map< Matrix >
 
using MapVec = Eigen::Map< Vector >
 
using Matrix = Eigen::Matrix< Scalar, Eigen::Dynamic, Eigen::Dynamic >
 
using RealArray = Eigen::Array< RealScalar, Eigen::Dynamic, 1 >
 
using RealMatrix = Eigen::Matrix< RealScalar, Eigen::Dynamic, Eigen::Dynamic >
 
using RealScalar = typename Eigen::NumTraits< Scalar >::Real
 
using RealVector = Eigen::Matrix< RealScalar, Eigen::Dynamic, 1 >
 
using Scalar = typename OpType::Scalar
 
using Vector = Eigen::Matrix< Scalar, Eigen::Dynamic, 1 >
 

Private Member Functions

Index nev_adjusted (Index nconv)
 
Index num_converged (const RealScalar &tol)
 
void restart (Index k, SortRule selection)
 
void retrieve_ritzpair (SortRule selection)
 

Static Private Member Functions

static std::vector< OpType > create_op_container (OpType &&rval)
 

Private Attributes

CompInfo m_info
 
BoolArray m_ritz_conv
 
RealVector m_ritz_est
 
RealMatrix m_ritz_vec
 

Detailed Description

template<typename OpType, typename BOpType>
class Spectra::HermEigsBase< OpType, BOpType >

This is the base class for Hermitian (and real symmetric) eigen solvers, mainly for internal use. It is kept here to provide the documentation for member functions of concrete eigen solvers such as SymEigsSolver, HermEigsSolver, SymEigsShiftSolver, etc.

Definition at line 44 of file HermEigsBase.h.

Member Typedef Documentation

◆ ArnoldiOpType

template<typename OpType , typename BOpType >
using Spectra::HermEigsBase< OpType, BOpType >::ArnoldiOpType = ArnoldiOp<Scalar, OpType, BOpType>
private

Definition at line 63 of file HermEigsBase.h.

◆ BoolArray

template<typename OpType , typename BOpType >
using Spectra::HermEigsBase< OpType, BOpType >::BoolArray = Eigen::Array<bool, Eigen::Dynamic, 1>
private

Definition at line 58 of file HermEigsBase.h.

◆ Index

template<typename OpType , typename BOpType >
using Spectra::HermEigsBase< OpType, BOpType >::Index = Eigen::Index
private

Definition at line 52 of file HermEigsBase.h.

◆ LanczosFac

template<typename OpType , typename BOpType >
using Spectra::HermEigsBase< OpType, BOpType >::LanczosFac = Lanczos<Scalar, ArnoldiOpType>
private

Definition at line 64 of file HermEigsBase.h.

◆ MapConstVec

template<typename OpType , typename BOpType >
using Spectra::HermEigsBase< OpType, BOpType >::MapConstVec = Eigen::Map<const Vector>
private

Definition at line 61 of file HermEigsBase.h.

◆ MapMat

template<typename OpType , typename BOpType >
using Spectra::HermEigsBase< OpType, BOpType >::MapMat = Eigen::Map<Matrix>
private

Definition at line 59 of file HermEigsBase.h.

◆ MapVec

template<typename OpType , typename BOpType >
using Spectra::HermEigsBase< OpType, BOpType >::MapVec = Eigen::Map<Vector>
private

Definition at line 60 of file HermEigsBase.h.

◆ Matrix

template<typename OpType , typename BOpType >
using Spectra::HermEigsBase< OpType, BOpType >::Matrix = Eigen::Matrix<Scalar, Eigen::Dynamic, Eigen::Dynamic>
private

Definition at line 53 of file HermEigsBase.h.

◆ RealArray

template<typename OpType , typename BOpType >
using Spectra::HermEigsBase< OpType, BOpType >::RealArray = Eigen::Array<RealScalar, Eigen::Dynamic, 1>
private

Definition at line 57 of file HermEigsBase.h.

◆ RealMatrix

template<typename OpType , typename BOpType >
using Spectra::HermEigsBase< OpType, BOpType >::RealMatrix = Eigen::Matrix<RealScalar, Eigen::Dynamic, Eigen::Dynamic>
private

Definition at line 55 of file HermEigsBase.h.

◆ RealScalar

template<typename OpType , typename BOpType >
using Spectra::HermEigsBase< OpType, BOpType >::RealScalar = typename Eigen::NumTraits<Scalar>::Real
private

Definition at line 51 of file HermEigsBase.h.

◆ RealVector

template<typename OpType , typename BOpType >
using Spectra::HermEigsBase< OpType, BOpType >::RealVector = Eigen::Matrix<RealScalar, Eigen::Dynamic, 1>
private

Definition at line 56 of file HermEigsBase.h.

◆ Scalar

template<typename OpType , typename BOpType >
using Spectra::HermEigsBase< OpType, BOpType >::Scalar = typename OpType::Scalar
private

Definition at line 47 of file HermEigsBase.h.

◆ Vector

template<typename OpType , typename BOpType >
using Spectra::HermEigsBase< OpType, BOpType >::Vector = Eigen::Matrix<Scalar, Eigen::Dynamic, 1>
private

Definition at line 54 of file HermEigsBase.h.

Member Function Documentation

◆ compute()

template<typename OpType , typename BOpType >
Index Spectra::HermEigsBase< OpType, BOpType >::compute ( SortRule  selection = SortRule::LargestMagn,
Index  maxit = 1000,
RealScalar  tol = 1e-10,
SortRule  sorting = SortRule::LargestAlge 
)
inline

Conducts the major computation procedure.

Parameters
selectionAn enumeration value indicating the selection rule of the requested eigenvalues, for example SortRule::LargestMagn to retrieve eigenvalues with the largest magnitude. The full list of enumeration values can be found in Enumerations.
maxitMaximum number of iterations allowed in the algorithm.
tolPrecision parameter for the calculated eigenvalues.
sortingRule to sort the eigenvalues and eigenvectors. Supported values are SortRule::LargestAlge, SortRule::LargestMagn, SortRule::SmallestAlge, and SortRule::SmallestMagn. For example, SortRule::LargestAlge indicates that largest eigenvalues come first. Note that this argument is only used to sort the final result, and the selection rule (e.g. selecting the largest or smallest eigenvalues in the full spectrum) is specified by the parameter selection.
Returns
Number of converged eigenvalues.

Definition at line 360 of file HermEigsBase.h.

◆ create_op_container()

template<typename OpType , typename BOpType >
static std::vector<OpType> Spectra::HermEigsBase< OpType, BOpType >::create_op_container ( OpType &&  rval)
inlinestaticprivate

Definition at line 94 of file HermEigsBase.h.

◆ eigenvalues()

template<typename OpType , typename BOpType >
RealVector Spectra::HermEigsBase< OpType, BOpType >::eigenvalues ( ) const
inline

Returns the converged eigenvalues.

Returns
A vector containing the real-valued eigenvalues. Returned vector type will be Eigen::Vector<RealScalar, ...>, depending on the Scalar type defined in the matrix operation class. For example, if Scalar is double or std::complex<double>, then RealScalar would be double.

Definition at line 411 of file HermEigsBase.h.

◆ eigenvectors() [1/2]

template<typename OpType , typename BOpType >
virtual Matrix Spectra::HermEigsBase< OpType, BOpType >::eigenvectors ( ) const
inlinevirtual

Returns all converged eigenvectors.

Definition at line 469 of file HermEigsBase.h.

◆ eigenvectors() [2/2]

template<typename OpType , typename BOpType >
virtual Matrix Spectra::HermEigsBase< OpType, BOpType >::eigenvectors ( Index  nvec) const
inlinevirtual

Returns the eigenvectors associated with the converged eigenvalues.

Parameters
nvecThe number of eigenvectors to return.
Returns
A matrix containing the eigenvectors. Returned matrix type will be Eigen::Matrix<Scalar, ...>, depending on the Scalar type defined in the matrix operation class.

Definition at line 441 of file HermEigsBase.h.

◆ info()

template<typename OpType , typename BOpType >
CompInfo Spectra::HermEigsBase< OpType, BOpType >::info ( ) const
inline

Returns the status of the computation. The full list of enumeration values can be found in Enumerations.

Definition at line 390 of file HermEigsBase.h.

◆ init() [1/2]

template<typename OpType , typename BOpType >
void Spectra::HermEigsBase< OpType, BOpType >::init ( )
inline

Initializes the solver by providing a random initial residual vector.

This overloaded function generates a random initial residual vector (with a fixed random seed) for the algorithm. Elements in the vector follow independent Uniform(-0.5, 0.5) distribution.

Definition at line 331 of file HermEigsBase.h.

◆ init() [2/2]

template<typename OpType , typename BOpType >
void Spectra::HermEigsBase< OpType, BOpType >::init ( const Scalar init_resid)
inline

Initializes the solver by providing an initial residual vector.

Parameters
init_residPointer to the initial residual vector.

Spectra (and also ARPACK) uses an iterative algorithm to find eigenvalues. This function allows the user to provide the initial residual vector.

Definition at line 303 of file HermEigsBase.h.

◆ nev_adjusted()

template<typename OpType , typename BOpType >
Index Spectra::HermEigsBase< OpType, BOpType >::nev_adjusted ( Index  nconv)
inlineprivate

Definition at line 172 of file HermEigsBase.h.

◆ num_converged()

template<typename OpType , typename BOpType >
Index Spectra::HermEigsBase< OpType, BOpType >::num_converged ( const RealScalar tol)
inlineprivate

Definition at line 152 of file HermEigsBase.h.

◆ num_iterations()

template<typename OpType , typename BOpType >
Index Spectra::HermEigsBase< OpType, BOpType >::num_iterations ( ) const
inline

Returns the number of iterations used in the computation.

Definition at line 395 of file HermEigsBase.h.

◆ num_operations()

template<typename OpType , typename BOpType >
Index Spectra::HermEigsBase< OpType, BOpType >::num_operations ( ) const
inline

Returns the number of matrix operations used in the computation.

Definition at line 400 of file HermEigsBase.h.

◆ restart()

template<typename OpType , typename BOpType >
void Spectra::HermEigsBase< OpType, BOpType >::restart ( Index  k,
SortRule  selection 
)
inlineprivate

Definition at line 102 of file HermEigsBase.h.

◆ retrieve_ritzpair()

template<typename OpType , typename BOpType >
void Spectra::HermEigsBase< OpType, BOpType >::retrieve_ritzpair ( SortRule  selection)
inlineprivate

Definition at line 199 of file HermEigsBase.h.

◆ sort_ritzpair()

template<typename OpType , typename BOpType >
virtual void Spectra::HermEigsBase< OpType, BOpType >::sort_ritzpair ( SortRule  sort_rule)
inlineprotectedvirtual

Member Data Documentation

◆ m_fac

template<typename OpType , typename BOpType >
LanczosFac Spectra::HermEigsBase< OpType, BOpType >::m_fac
protected

Definition at line 83 of file HermEigsBase.h.

◆ m_info

template<typename OpType , typename BOpType >
CompInfo Spectra::HermEigsBase< OpType, BOpType >::m_info
private

Definition at line 90 of file HermEigsBase.h.

◆ m_n

template<typename OpType , typename BOpType >
const Index Spectra::HermEigsBase< OpType, BOpType >::m_n
protected

Definition at line 77 of file HermEigsBase.h.

◆ m_ncv

template<typename OpType , typename BOpType >
const Index Spectra::HermEigsBase< OpType, BOpType >::m_ncv
protected

Definition at line 79 of file HermEigsBase.h.

◆ m_nev

template<typename OpType , typename BOpType >
const Index Spectra::HermEigsBase< OpType, BOpType >::m_nev
protected

Definition at line 78 of file HermEigsBase.h.

◆ m_niter

template<typename OpType , typename BOpType >
Index Spectra::HermEigsBase< OpType, BOpType >::m_niter
protected

Definition at line 81 of file HermEigsBase.h.

◆ m_nmatop

template<typename OpType , typename BOpType >
Index Spectra::HermEigsBase< OpType, BOpType >::m_nmatop
protected

Definition at line 80 of file HermEigsBase.h.

◆ m_op

template<typename OpType , typename BOpType >
const OpType& Spectra::HermEigsBase< OpType, BOpType >::m_op
protected

Definition at line 76 of file HermEigsBase.h.

◆ m_op_container

template<typename OpType , typename BOpType >
std::vector<OpType> Spectra::HermEigsBase< OpType, BOpType >::m_op_container
protected

Definition at line 75 of file HermEigsBase.h.

◆ m_ritz_conv

template<typename OpType , typename BOpType >
BoolArray Spectra::HermEigsBase< OpType, BOpType >::m_ritz_conv
private

Definition at line 89 of file HermEigsBase.h.

◆ m_ritz_est

template<typename OpType , typename BOpType >
RealVector Spectra::HermEigsBase< OpType, BOpType >::m_ritz_est
private

Definition at line 88 of file HermEigsBase.h.

◆ m_ritz_val

template<typename OpType , typename BOpType >
RealVector Spectra::HermEigsBase< OpType, BOpType >::m_ritz_val
protected

Definition at line 84 of file HermEigsBase.h.

◆ m_ritz_vec

template<typename OpType , typename BOpType >
RealMatrix Spectra::HermEigsBase< OpType, BOpType >::m_ritz_vec
private

Definition at line 87 of file HermEigsBase.h.


The documentation for this class was generated from the following file:


gtsam
Author(s):
autogenerated on Fri Mar 28 2025 03:16:38