ergo
eigvec Namespace Reference

Functions

template<typename Treal , typename MatrixType , typename VectorType >
Treal compute_rayleigh_quotient (const MatrixType &A, const VectorType &eigVec)
 Get Rayleigh quotient: A = (y'Ay)/(y'y), y = eigVecPtr. More...
 
template<typename Treal , typename MatrixType , typename VectorType >
void lanczos_method (const MatrixType &A, std::vector< Treal > &eigVal, std::vector< VectorType > &eigVec, int number_of_eigenvalues, const Treal TOL, std::vector< int > &num_iter, int maxit=200, bool do_deflation=false)
 Use Lanzcos method for computing eigenvectors. More...
 
template<typename Treal , typename MatrixType , typename VectorType >
void power_method (const MatrixType &A, Treal &eigVal, VectorType &eigVec, const Treal TOL, int &num_iter, int maxit=200)
 Use power method for computing eigenvectors. More...
 
template<typename Treal , typename MatrixType , typename VectorType >
int computeEigenvectors (const MatrixType &A, Treal tol, std::vector< Treal > &eigVal, std::vector< VectorType > &eigVec, int number_of_eigenvalues_to_compute, std::string method, std::vector< int > &num_iter, int maxit=200, bool do_deflation=false)
 Function for choosing method for computing eigenvectors. More...
 

Function Documentation

◆ compute_rayleigh_quotient()

template<typename Treal , typename MatrixType , typename VectorType >
Treal eigvec::compute_rayleigh_quotient ( const MatrixType A,
const VectorType eigVec 
)

Get Rayleigh quotient: A = (y'Ay)/(y'y), y = eigVecPtr.

References A, mat::VectorGeneral< Treal, Tvector >::eucl(), and mat::transpose().

◆ computeEigenvectors()

template<typename Treal , typename MatrixType , typename VectorType >
int eigvec::computeEigenvectors ( const MatrixType A,
Treal  tol,
std::vector< Treal > &  eigVal,
std::vector< VectorType > &  eigVec,
int  number_of_eigenvalues_to_compute,
std::string  method,
std::vector< int > &  num_iter,
int  maxit = 200,
bool  do_deflation = false 
)

Function for choosing method for computing eigenvectors.

Parameters
[in]AMatrix for which to compute eigenvectors.
[in]tolEigensolver tolerance.
[out]eigValEigenvalue(s).
[in,out]eigVecEigenvector(s).
[in]number_of_eigenvalues_to_computeNumber of eigenvalues which Lanczos should compute.
[in]methodChosen eigensolver (power or Lanczos).
[out]num_iterActual number of iterations (now just num_iter[0] is used).
[in]maxitMaximum number of iterations.
[in]do_deflationUse deflation with eigVec[0].

References A, lanczos_method(), and power_method().

Referenced by PurificationGeneral< MatrixType >::compute_eigenvector(), PurificationGeneral< MatrixType >::compute_eigenvectors_without_diagonalization_on_F(), and main().

◆ lanczos_method()

template<typename Treal , typename MatrixType , typename VectorType >
void eigvec::lanczos_method ( const MatrixType A,
std::vector< Treal > &  eigVal,
std::vector< VectorType > &  eigVec,
int  number_of_eigenvalues,
const Treal  TOL,
std::vector< int > &  num_iter,
int  maxit = 200,
bool  do_deflation = false 
)

◆ power_method()

template<typename Treal , typename MatrixType , typename VectorType >
void eigvec::power_method ( const MatrixType A,
Treal &  eigVal,
VectorType eigVec,
const Treal  TOL,
int &  num_iter,
int  maxit = 200 
)

Use power method for computing eigenvectors.

See function computeEigenvectors for the meaning of parameters.

References A, mat::VectorGeneral< Treal, Tvector >::eucl(), template_blas_fabs(), and mat::transpose().

Referenced by computeEigenvectors().