version 0.4.4
Ikarus::PartialGeneralizedSymEigenSolver< MT > Struct Template Reference

This class implements a wrapper to the Spectra generalized eigen solver for square real symmetric matrices, i.e. to solve \( Ax = \lambda Bx\), where A is symmetric and B is positive definite. It calculates a selection of eigenvalues. At most \( n - 1 \), where \( n \) is the number of rows/cols of the matrices. More...

#include <ikarus/solver/eigenvaluesolver/generalizedeigensolver.hh>

Public Types

using ScalarType = typename MT::Scalar
 
using MatrixType = MT
 
using ProductType = std::conditional_t< isDense, Spectra::DenseSymMatProd< ScalarType >, Spectra::SparseSymMatProd< ScalarType > >
 
using CholeskyType = std::conditional_t< isDense, Spectra::DenseCholesky< ScalarType >, Spectra::SparseCholesky< ScalarType > >
 
using SolverType = Spectra::SymGEigsSolver< ProductType, CholeskyType, Spectra::GEigsMode::Cholesky >
 

Public Member Functions

template<typename MATA , typename MATB >
requires (Concepts::DenseOrSparseEigenMatrix<std::remove_cvref_t<MATA>>)
 PartialGeneralizedSymEigenSolver (MATA &&A, MATB &&B, Eigen::Index nev)
 Construct a new PartialGeneralizedSymEigenSolver object. More...
 
template<Concepts::FlatAssembler AssemblerA, Concepts::FlatAssembler AssemblerB>
 PartialGeneralizedSymEigenSolver (std::shared_ptr< AssemblerA > assemblerA, std::shared_ptr< AssemblerB > assemblerB, Eigen::Index nev)
 Construct a new PartialGeneralizedSymEigenSolver object. More...
 
bool compute (Spectra::SortRule selection=Spectra::SortRule::SmallestAlge, Spectra::SortRule sortRule=Spectra::SortRule::SmallestAlge, Eigen::Index maxit=1000, ScalarType tolerance=1e-10)
 Starts the computation of the eigenvalue solver. More...
 
Eigen::VectorXd eigenvalues () const
 Returns the eigenvalues of the generalized eigenvalue problem. More...
 
auto eigenvectors (std::optional< Eigen::Index > _nev=std::nullopt) const
 Returns the eigenvectors of the generalized eigenvalue problem. More...
 
Eigen::Index nev () const
 

Static Public Attributes

static constexpr bool isDense = Concepts::EigenMatrix<MT>
 

Detailed Description

template<Concepts::DenseOrSparseEigenMatrix MT>
struct Ikarus::PartialGeneralizedSymEigenSolver< MT >

Under the hood it uses the Spectra::SymGEigsSolver with Cholesky decomposition for B

Template Parameters
MTthe used Matrix Type, can be a sparse or dense Eigen::Matrix

Member Typedef Documentation

◆ CholeskyType

template<Concepts::DenseOrSparseEigenMatrix MT>
using Ikarus::PartialGeneralizedSymEigenSolver< MT >::CholeskyType = std::conditional_t<isDense, Spectra::DenseCholesky<ScalarType>, Spectra::SparseCholesky<ScalarType> >

◆ MatrixType

template<Concepts::DenseOrSparseEigenMatrix MT>
using Ikarus::PartialGeneralizedSymEigenSolver< MT >::MatrixType = MT

◆ ProductType

template<Concepts::DenseOrSparseEigenMatrix MT>
using Ikarus::PartialGeneralizedSymEigenSolver< MT >::ProductType = std::conditional_t<isDense, Spectra::DenseSymMatProd<ScalarType>, Spectra::SparseSymMatProd<ScalarType> >

◆ ScalarType

template<Concepts::DenseOrSparseEigenMatrix MT>
using Ikarus::PartialGeneralizedSymEigenSolver< MT >::ScalarType = typename MT::Scalar

◆ SolverType

template<Concepts::DenseOrSparseEigenMatrix MT>
using Ikarus::PartialGeneralizedSymEigenSolver< MT >::SolverType = Spectra::SymGEigsSolver<ProductType, CholeskyType, Spectra::GEigsMode::Cholesky>

Constructor & Destructor Documentation

◆ PartialGeneralizedSymEigenSolver() [1/2]

template<Concepts::DenseOrSparseEigenMatrix MT>
template<typename MATA , typename MATB >
requires (Concepts::DenseOrSparseEigenMatrix<std::remove_cvref_t<MATA>>)
Ikarus::PartialGeneralizedSymEigenSolver< MT >::PartialGeneralizedSymEigenSolver ( MATA &&  A,
MATB &&  B,
Eigen::Index  nev 
)
inline
Template Parameters
MATAthe deduced type of the matrix A
MATBthe deduced type of the matrix B
Parameters
Athe matrix A
Bthe matrix B

◆ PartialGeneralizedSymEigenSolver() [2/2]

template<Concepts::DenseOrSparseEigenMatrix MT>
template<Concepts::FlatAssembler AssemblerA, Concepts::FlatAssembler AssemblerB>
Ikarus::PartialGeneralizedSymEigenSolver< MT >::PartialGeneralizedSymEigenSolver ( std::shared_ptr< AssemblerA >  assemblerA,
std::shared_ptr< AssemblerB >  assemblerB,
Eigen::Index  nev 
)
inline
Template Parameters
AssemblerAthe type of the assembler for matrix A.
AssemblerBthe type of the assembler for matrix B.
Parameters
assemblerAassembler for matrix A.
assemblerBassembler for matrix B.

Member Function Documentation

◆ compute()

template<Concepts::DenseOrSparseEigenMatrix MT>
bool Ikarus::PartialGeneralizedSymEigenSolver< MT >::compute ( Spectra::SortRule  selection = Spectra::SortRule::SmallestAlge,
Spectra::SortRule  sortRule = Spectra::SortRule::SmallestAlge,
Eigen::Index  maxit = 1000,
ScalarType  tolerance = 1e-10 
)
inline
Parameters
selectiondefines which n eigenvalues should be returned (i.e. smallest or greatesst).
sortRuledefines how these eigenvalues should be sorted.
tolerancegiven tolerance for iterative eigenvalue solving (default: 1e-10).
maxitgivenn maximum iterations for eigenvalue solving (default: 1000).
Returns
true solving was successful.
false solving was not successful.

◆ eigenvalues()

template<Concepts::DenseOrSparseEigenMatrix MT>
Eigen::VectorXd Ikarus::PartialGeneralizedSymEigenSolver< MT >::eigenvalues ( ) const
inline
Returns
Eigen::VectorXd vector of eigenvalues

◆ eigenvectors()

template<Concepts::DenseOrSparseEigenMatrix MT>
auto Ikarus::PartialGeneralizedSymEigenSolver< MT >::eigenvectors ( std::optional< Eigen::Index >  _nev = std::nullopt) const
inline
Parameters
_nevoptionally specify how many eigenvectors are requested
Returns
auto matrix with the eigevectors as columns

◆ nev()

template<Concepts::DenseOrSparseEigenMatrix MT>
Eigen::Index Ikarus::PartialGeneralizedSymEigenSolver< MT >::nev ( ) const
inline

Member Data Documentation

◆ isDense

template<Concepts::DenseOrSparseEigenMatrix MT>
constexpr bool Ikarus::PartialGeneralizedSymEigenSolver< MT >::isDense = Concepts::EigenMatrix<MT>
staticconstexpr

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