G+Smo  24.08.0
Geometry + Simulation Modules
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
gsLanczosMatrix< T > Class Template Reference

Detailed Description

template<class T>
class gismo::gsLanczosMatrix< T >

Class for representing a Lanczos matrix and calculating its eigenvalues.

The Lanczos matrix is a symmetric tridiagonal matrix with diagonal delta and offdiagonal gamma.

Public Member Functions

 gsLanczosMatrix (const std::vector< T > &gamma, const std::vector< T > &delta)
 Constructor for the Lanczos matrix The Lanczos matrix is a symmetric tridiagonal matrix with diagonal delta and offdiagonal gamma. More...
 
gsSparseMatrix< T > matrix ()
 This function returns the Lanczos matrix as gsSparseMatrix.
 
maxEigenvalue (index_t maxIter=20, T tol=1.e-6)
 Calculates the largest eigenvalue. More...
 
minEigenvalue (index_t maxIter=20, T tol=1.e-6)
 Calculates the smallest eigenvalue. More...
 

Private Member Functions

std::pair< T, T > eval (T lambda)
 Evalutates characteristic polynomial. More...
 
newtonIteration (T x0, index_t maxIter, T tol)
 Newton iteration for searching the zeros of the characteristic polynomial. More...
 

Constructor & Destructor Documentation

gsLanczosMatrix ( const std::vector< T > &  gamma,
const std::vector< T > &  delta 
)
inline

Constructor for the Lanczos matrix The Lanczos matrix is a symmetric tridiagonal matrix with diagonal delta and offdiagonal gamma.

Parameters
gammaThe off diagonal (the object stores a reference to this vector)
deltaThe diagonal (the object stores a reference to this vector)

Member Function Documentation

std::pair<T,T> eval ( lambda)
inlineprivate

Evalutates characteristic polynomial.

Parameters
lambdaevaluation point
Returns
the value and the derivative at position lambda
T maxEigenvalue ( index_t  maxIter = 20,
tol = 1.e-6 
)
inline

Calculates the largest eigenvalue.

Parameters
maxIterThe number of maximal iterations of the Newton algorithm
tolTolerace for the Newton algorithm
Returns
The largest eigenvalue
T minEigenvalue ( index_t  maxIter = 20,
tol = 1.e-6 
)
inline

Calculates the smallest eigenvalue.

Parameters
maxIterThe number of maximal iterations of the Newton algorithm
tolTolerace for the Newton algorithm
Returns
The smallest eigenvalue
T newtonIteration ( x0,
index_t  maxIter,
tol 
)
inlineprivate

Newton iteration for searching the zeros of the characteristic polynomial.

Parameters
x0the initial value
maxIterThe number of maximal iterations of the Newton algorithm
tolTolerace for the Newton algorithm
Returns
the root (= eigenvalue of the matrix)