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

#include <GenEigsBase.h>

Public Member Functions

Index compute (SortRule selection=SortRule::LargestMagn, Index maxit=1000, Scalar tol=1e-10, SortRule sorting=SortRule::LargestMagn)
 
ComplexVector eigenvalues () const
 
ComplexMatrix eigenvectors () const
 
ComplexMatrix 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

ArnoldiFac m_fac
 
const Index m_n
 
const Index m_ncv
 
const Index m_nev
 
Index m_niter
 
Index m_nmatop
 
OpType & m_op
 
ComplexVector m_ritz_est
 
ComplexVector m_ritz_val
 
ComplexMatrix m_ritz_vec
 

Private Types

using ArnoldiFac = Arnoldi< Scalar, ArnoldiOpType >
 
using ArnoldiOpType = ArnoldiOp< Scalar, OpType, BOpType >
 
using Array = Eigen::Array< Scalar, Eigen::Dynamic, 1 >
 
using BoolArray = Eigen::Array< bool, Eigen::Dynamic, 1 >
 
using Complex = std::complex< Scalar >
 
using ComplexMatrix = Eigen::Matrix< Complex, Eigen::Dynamic, Eigen::Dynamic >
 
using ComplexVector = Eigen::Matrix< Complex, Eigen::Dynamic, 1 >
 
using Index = Eigen::Index
 
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 Scalar = typename OpType::Scalar
 
using Vector = Eigen::Matrix< Scalar, Eigen::Dynamic, 1 >
 

Private Member Functions

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

Static Private Member Functions

static bool is_complex (const Complex &v)
 
static bool is_conj (const Complex &v1, const Complex &v2)
 

Private Attributes

CompInfo m_info
 
BoolArray m_ritz_conv
 

Detailed Description

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

This is the base class for general eigen solvers, mainly for internal use. It is kept here to provide the documentation for member functions of concrete eigen solvers such as GenEigsSolver and GenEigsRealShiftSolver.

Definition at line 38 of file GenEigsBase.h.

Member Typedef Documentation

◆ ArnoldiFac

template<typename OpType , typename BOpType >
using Spectra::GenEigsBase< OpType, BOpType >::ArnoldiFac = Arnoldi<Scalar, ArnoldiOpType>
private

Definition at line 56 of file GenEigsBase.h.

◆ ArnoldiOpType

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

Definition at line 55 of file GenEigsBase.h.

◆ Array

template<typename OpType , typename BOpType >
using Spectra::GenEigsBase< OpType, BOpType >::Array = Eigen::Array<Scalar, Eigen::Dynamic, 1>
private

Definition at line 45 of file GenEigsBase.h.

◆ BoolArray

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

Definition at line 46 of file GenEigsBase.h.

◆ Complex

template<typename OpType , typename BOpType >
using Spectra::GenEigsBase< OpType, BOpType >::Complex = std::complex<Scalar>
private

Definition at line 51 of file GenEigsBase.h.

◆ ComplexMatrix

template<typename OpType , typename BOpType >
using Spectra::GenEigsBase< OpType, BOpType >::ComplexMatrix = Eigen::Matrix<Complex, Eigen::Dynamic, Eigen::Dynamic>
private

Definition at line 52 of file GenEigsBase.h.

◆ ComplexVector

template<typename OpType , typename BOpType >
using Spectra::GenEigsBase< OpType, BOpType >::ComplexVector = Eigen::Matrix<Complex, Eigen::Dynamic, 1>
private

Definition at line 53 of file GenEigsBase.h.

◆ Index

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

Definition at line 42 of file GenEigsBase.h.

◆ MapConstVec

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

Definition at line 49 of file GenEigsBase.h.

◆ MapMat

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

Definition at line 47 of file GenEigsBase.h.

◆ MapVec

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

Definition at line 48 of file GenEigsBase.h.

◆ Matrix

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

Definition at line 43 of file GenEigsBase.h.

◆ Scalar

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

Definition at line 41 of file GenEigsBase.h.

◆ Vector

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

Definition at line 44 of file GenEigsBase.h.

Member Function Documentation

◆ compute()

template<typename OpType , typename BOpType >
Index Spectra::GenEigsBase< OpType, BOpType >::compute ( SortRule  selection = SortRule::LargestMagn,
Index  maxit = 1000,
Scalar  tol = 1e-10,
SortRule  sorting = SortRule::LargestMagn 
)
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::LargestMagn, SortRule::LargestReal, SortRule::LargestImag, SortRule::SmallestMagn, SortRule::SmallestReal and SortRule::SmallestImag, for example SortRule::LargestMagn indicates that eigenvalues with largest magnitude 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 417 of file GenEigsBase.h.

◆ eigenvalues()

template<typename OpType , typename BOpType >
ComplexVector Spectra::GenEigsBase< OpType, BOpType >::eigenvalues ( ) const
inline

Returns the converged eigenvalues.

Returns
A complex-valued vector containing the eigenvalues. Returned vector type will be Eigen::Vector<std::complex<Scalar>, ...>, depending on the template parameter Scalar defined.

Definition at line 466 of file GenEigsBase.h.

◆ eigenvectors() [1/2]

template<typename OpType , typename BOpType >
ComplexMatrix Spectra::GenEigsBase< OpType, BOpType >::eigenvectors ( ) const
inline

Returns all converged eigenvectors.

Definition at line 524 of file GenEigsBase.h.

◆ eigenvectors() [2/2]

template<typename OpType , typename BOpType >
ComplexMatrix Spectra::GenEigsBase< OpType, BOpType >::eigenvectors ( Index  nvec) const
inline

Returns the eigenvectors associated with the converged eigenvalues.

Parameters
nvecThe number of eigenvectors to return.
Returns
A complex-valued matrix containing the eigenvectors. Returned matrix type will be Eigen::Matrix<std::complex<Scalar>, ...>, depending on the template parameter Scalar defined.

Definition at line 496 of file GenEigsBase.h.

◆ info()

template<typename OpType , typename BOpType >
CompInfo Spectra::GenEigsBase< 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 447 of file GenEigsBase.h.

◆ init() [1/2]

template<typename OpType , typename BOpType >
void Spectra::GenEigsBase< 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 386 of file GenEigsBase.h.

◆ init() [2/2]

template<typename OpType , typename BOpType >
void Spectra::GenEigsBase< 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 358 of file GenEigsBase.h.

◆ is_complex()

template<typename OpType , typename BOpType >
static bool Spectra::GenEigsBase< OpType, BOpType >::is_complex ( const Complex v)
inlinestaticprivate

Definition at line 82 of file GenEigsBase.h.

◆ is_conj()

template<typename OpType , typename BOpType >
static bool Spectra::GenEigsBase< OpType, BOpType >::is_conj ( const Complex v1,
const Complex v2 
)
inlinestaticprivate

Definition at line 83 of file GenEigsBase.h.

◆ nev_adjusted()

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

Definition at line 161 of file GenEigsBase.h.

◆ num_converged()

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

Definition at line 141 of file GenEigsBase.h.

◆ num_iterations()

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

Returns the number of iterations used in the computation.

Definition at line 452 of file GenEigsBase.h.

◆ num_operations()

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

Returns the number of matrix operations used in the computation.

Definition at line 457 of file GenEigsBase.h.

◆ restart()

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

Definition at line 86 of file GenEigsBase.h.

◆ retrieve_ritzpair()

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

Definition at line 196 of file GenEigsBase.h.

◆ sort_ritzpair()

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

Member Data Documentation

◆ m_fac

template<typename OpType , typename BOpType >
ArnoldiFac Spectra::GenEigsBase< OpType, BOpType >::m_fac
protected

Definition at line 68 of file GenEigsBase.h.

◆ m_info

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

Definition at line 76 of file GenEigsBase.h.

◆ m_n

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

Definition at line 62 of file GenEigsBase.h.

◆ m_ncv

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

Definition at line 64 of file GenEigsBase.h.

◆ m_nev

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

Definition at line 63 of file GenEigsBase.h.

◆ m_niter

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

Definition at line 66 of file GenEigsBase.h.

◆ m_nmatop

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

Definition at line 65 of file GenEigsBase.h.

◆ m_op

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

Definition at line 60 of file GenEigsBase.h.

◆ m_ritz_conv

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

Definition at line 75 of file GenEigsBase.h.

◆ m_ritz_est

template<typename OpType , typename BOpType >
ComplexVector Spectra::GenEigsBase< OpType, BOpType >::m_ritz_est
protected

Definition at line 72 of file GenEigsBase.h.

◆ m_ritz_val

template<typename OpType , typename BOpType >
ComplexVector Spectra::GenEigsBase< OpType, BOpType >::m_ritz_val
protected

Definition at line 70 of file GenEigsBase.h.

◆ m_ritz_vec

template<typename OpType , typename BOpType >
ComplexMatrix Spectra::GenEigsBase< OpType, BOpType >::m_ritz_vec
protected

Definition at line 71 of file GenEigsBase.h.


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


gtsam
Author(s):
autogenerated on Wed May 28 2025 03:15:49