votca 2024.2-dev
Loading...
Searching...
No Matches
votca::xtp::DavidsonSolver Class Reference

Use Davidson algorithm to solve A*V=E*V. More...

#include <davidsonsolver.h>

Collaboration diagram for votca::xtp::DavidsonSolver:

Classes

struct  ProjectedSpace
 
struct  RitzEigenPair
 

Public Member Functions

 DavidsonSolver (Logger &log)
 
void set_iter_max (Index N)
 
void set_max_search_space (Index N)
 
void set_tolerance (std::string tol)
 
void set_correction (std::string method)
 
void set_size_update (std::string update_size)
 
void set_matrix_type (std::string mt)
 
Eigen::ComputationInfo info () const
 
Eigen::VectorXd eigenvalues () const
 
Eigen::MatrixXd eigenvectors () const
 
Index num_iterations () const
 
template<typename MatrixReplacement >
void solve (const MatrixReplacement &A, Index neigen, Index size_initial_guess=0)
 

Private Types

enum  CORR { DPR , OLSEN }
 
enum  UPDATE { MIN , SAFE , MAX }
 
enum  MATRIX_TYPE { SYMM , HAM }
 
using ArrayXb = Eigen::Array<bool, Eigen::Dynamic, 1>
 

Private Member Functions

template<typename MatrixReplacement >
void updateProjection (const MatrixReplacement &A, ProjectedSpace &proj) const
 
RitzEigenPair getRitzEigenPairs (const ProjectedSpace &proj) const
 
Eigen::MatrixXd qr (const Eigen::MatrixXd &A) const
 
RitzEigenPair getHarmonicRitz (const ProjectedSpace &proj) const
 
RitzEigenPair getRitz (const ProjectedSpace &proj) const
 
Index getSizeUpdate (Index neigen) const
 
void checkOptions (Index operator_size)
 
void printOptions (Index operator_size) const
 
void printTiming (const std::chrono::time_point< std::chrono::system_clock > &start) const
 
void printIterationData (const RitzEigenPair &rep, const ProjectedSpace &proj, Index neigen) const
 
ArrayXl argsort (const Eigen::VectorXd &V) const
 
Eigen::MatrixXd setupInitialEigenvectors (Index size_initial_guess) const
 
Eigen::MatrixXd extract_vectors (const Eigen::MatrixXd &V, const ArrayXl &idx) const
 
void orthogonalize (Eigen::MatrixXd &V, Index nupdate) const
 
void gramschmidt (Eigen::MatrixXd &A, Index nstart) const
 
Eigen::VectorXd computeCorrectionVector (const Eigen::VectorXd &qj, double lambdaj, const Eigen::VectorXd &Aqj) const
 
Eigen::VectorXd dpr (const Eigen::VectorXd &r, double lambda) const
 
Eigen::VectorXd olsen (const Eigen::VectorXd &r, const Eigen::VectorXd &x, double lambda) const
 
ProjectedSpace initProjectedSpace (Index neigen, Index size_initial_guess) const
 
Index extendProjection (const RitzEigenPair &rep, ProjectedSpace &proj) const
 
bool checkConvergence (const RitzEigenPair &rep, ProjectedSpace &proj, Index neigen) const
 
void restart (const RitzEigenPair &rep, ProjectedSpace &proj, Index newtestvectors) const
 
void storeConvergedData (const RitzEigenPair &rep, Index neigen)
 
void storeNotConvergedData (const RitzEigenPair &rep, const ArrayXb &root_converged, Index neigen)
 
void storeEigenPairs (const RitzEigenPair &rep, Index neigen)
 

Private Attributes

Loggerlog_
 
Index iter_max_ = 50
 
Index i_iter_ = 0
 
double tol_ = 1E-4
 
Index max_search_space_ = 0
 
Eigen::VectorXd Adiag_
 
Index restart_size_ = 0
 
CORR davidson_correction_ = CORR::DPR
 
UPDATE davidson_update_ = UPDATE::SAFE
 
MATRIX_TYPE matrix_type_ = MATRIX_TYPE::SYMM
 
Eigen::VectorXd eigenvalues_
 
Eigen::MatrixXd eigenvectors_
 
Eigen::ComputationInfo info_ = Eigen::ComputationInfo::NoConvergence
 

Detailed Description

Use Davidson algorithm to solve A*V=E*V.

For a rough overview https://joshuagoings.com/2013/08/23/davidsons-method/ For the symmetric case we simply extract the smallest eigenvalues For the non-symmetric case we need the smallest non-negative eigenvalues These are harder to extract, because iterative methods tend to converge towards extreme eigenvalues, thus we use harmonic ritz values.

Definition at line 47 of file davidsonsolver.h.

Member Typedef Documentation

◆ ArrayXb

using votca::xtp::DavidsonSolver::ArrayXb = Eigen::Array<bool, Eigen::Dynamic, 1>
private

Definition at line 125 of file davidsonsolver.h.

Member Enumeration Documentation

◆ CORR

Enumerator
DPR 
OLSEN 

Definition at line 133 of file davidsonsolver.h.

◆ MATRIX_TYPE

Enumerator
SYMM 
HAM 

Definition at line 139 of file davidsonsolver.h.

◆ UPDATE

Enumerator
MIN 
SAFE 
MAX 

Definition at line 136 of file davidsonsolver.h.

Constructor & Destructor Documentation

◆ DavidsonSolver()

votca::xtp::DavidsonSolver::DavidsonSolver ( Logger & log)

Definition at line 32 of file davidsonsolver.cc.

Member Function Documentation

◆ argsort()

ArrayXl votca::xtp::DavidsonSolver::argsort ( const Eigen::VectorXd & V) const
private

Definition at line 175 of file davidsonsolver.cc.

◆ checkConvergence()

bool votca::xtp::DavidsonSolver::checkConvergence ( const RitzEigenPair & rep,
DavidsonSolver::ProjectedSpace & proj,
Index neigen ) const
private

Definition at line 350 of file davidsonsolver.cc.

◆ checkOptions()

void votca::xtp::DavidsonSolver::checkOptions ( Index operator_size)
private

Definition at line 47 of file davidsonsolver.cc.

◆ computeCorrectionVector()

Eigen::VectorXd votca::xtp::DavidsonSolver::computeCorrectionVector ( const Eigen::VectorXd & qj,
double lambdaj,
const Eigen::VectorXd & Aqj ) const
private

Definition at line 392 of file davidsonsolver.cc.

◆ dpr()

Eigen::VectorXd votca::xtp::DavidsonSolver::dpr ( const Eigen::VectorXd & r,
double lambda ) const
private

Definition at line 419 of file davidsonsolver.cc.

◆ eigenvalues()

Eigen::VectorXd votca::xtp::DavidsonSolver::eigenvalues ( ) const
inline

Definition at line 60 of file davidsonsolver.h.

◆ eigenvectors()

Eigen::MatrixXd votca::xtp::DavidsonSolver::eigenvectors ( ) const
inline

Definition at line 61 of file davidsonsolver.h.

◆ extendProjection()

Index votca::xtp::DavidsonSolver::extendProjection ( const RitzEigenPair & rep,
DavidsonSolver::ProjectedSpace & proj ) const
private

Definition at line 357 of file davidsonsolver.cc.

◆ extract_vectors()

Eigen::MatrixXd votca::xtp::DavidsonSolver::extract_vectors ( const Eigen::MatrixXd & V,
const ArrayXl & idx ) const
private

Definition at line 383 of file davidsonsolver.cc.

◆ getHarmonicRitz()

DavidsonSolver::RitzEigenPair votca::xtp::DavidsonSolver::getHarmonicRitz ( const ProjectedSpace & proj) const
private

Definition at line 244 of file davidsonsolver.cc.

◆ getRitz()

DavidsonSolver::RitzEigenPair votca::xtp::DavidsonSolver::getRitz ( const ProjectedSpace & proj) const
private

Definition at line 224 of file davidsonsolver.cc.

◆ getRitzEigenPairs()

DavidsonSolver::RitzEigenPair votca::xtp::DavidsonSolver::getRitzEigenPairs ( const ProjectedSpace & proj) const
private

Definition at line 210 of file davidsonsolver.cc.

◆ getSizeUpdate()

Index votca::xtp::DavidsonSolver::getSizeUpdate ( Index neigen) const
private

Definition at line 152 of file davidsonsolver.cc.

◆ gramschmidt()

void votca::xtp::DavidsonSolver::gramschmidt ( Eigen::MatrixXd & A,
Index nstart ) const
private

Definition at line 445 of file davidsonsolver.cc.

◆ info()

Eigen::ComputationInfo votca::xtp::DavidsonSolver::info ( ) const
inline

Definition at line 59 of file davidsonsolver.h.

◆ initProjectedSpace()

DavidsonSolver::ProjectedSpace votca::xtp::DavidsonSolver::initProjectedSpace ( Index neigen,
Index size_initial_guess ) const
private

Definition at line 337 of file davidsonsolver.cc.

◆ num_iterations()

Index votca::xtp::DavidsonSolver::num_iterations ( ) const
inline

Definition at line 62 of file davidsonsolver.h.

◆ olsen()

Eigen::VectorXd votca::xtp::DavidsonSolver::olsen ( const Eigen::VectorXd & r,
const Eigen::VectorXd & x,
double lambda ) const
private

Definition at line 427 of file davidsonsolver.cc.

◆ orthogonalize()

void votca::xtp::DavidsonSolver::orthogonalize ( Eigen::MatrixXd & V,
Index nupdate ) const
private

Definition at line 441 of file davidsonsolver.cc.

◆ printIterationData()

void votca::xtp::DavidsonSolver::printIterationData ( const RitzEigenPair & rep,
const ProjectedSpace & proj,
Index neigen ) const
private

Definition at line 90 of file davidsonsolver.cc.

◆ printOptions()

void votca::xtp::DavidsonSolver::printOptions ( Index operator_size) const
private

Definition at line 67 of file davidsonsolver.cc.

◆ printTiming()

void votca::xtp::DavidsonSolver::printTiming ( const std::chrono::time_point< std::chrono::system_clock > & start) const
private

Definition at line 34 of file davidsonsolver.cc.

◆ qr()

Eigen::MatrixXd votca::xtp::DavidsonSolver::qr ( const Eigen::MatrixXd & A) const
private

Definition at line 483 of file davidsonsolver.cc.

◆ restart()

void votca::xtp::DavidsonSolver::restart ( const RitzEigenPair & rep,
DavidsonSolver::ProjectedSpace & proj,
Index newtestvectors ) const
private

Definition at line 493 of file davidsonsolver.cc.

◆ set_correction()

void votca::xtp::DavidsonSolver::set_correction ( std::string method)

Definition at line 114 of file davidsonsolver.cc.

◆ set_iter_max()

void votca::xtp::DavidsonSolver::set_iter_max ( Index N)
inline

Definition at line 52 of file davidsonsolver.h.

◆ set_matrix_type()

void votca::xtp::DavidsonSolver::set_matrix_type ( std::string mt)

Definition at line 104 of file davidsonsolver.cc.

◆ set_max_search_space()

void votca::xtp::DavidsonSolver::set_max_search_space ( Index N)
inline

Definition at line 53 of file davidsonsolver.h.

◆ set_size_update()

void votca::xtp::DavidsonSolver::set_size_update ( std::string update_size)

Definition at line 139 of file davidsonsolver.cc.

◆ set_tolerance()

void votca::xtp::DavidsonSolver::set_tolerance ( std::string tol)

Definition at line 125 of file davidsonsolver.cc.

◆ setupInitialEigenvectors()

Eigen::MatrixXd votca::xtp::DavidsonSolver::setupInitialEigenvectors ( Index size_initial_guess) const
private

Definition at line 183 of file davidsonsolver.cc.

◆ solve()

template<typename MatrixReplacement >
void votca::xtp::DavidsonSolver::solve ( const MatrixReplacement & A,
Index neigen,
Index size_initial_guess = 0 )
inline

Definition at line 65 of file davidsonsolver.h.

◆ storeConvergedData()

void votca::xtp::DavidsonSolver::storeConvergedData ( const RitzEigenPair & rep,
Index neigen )
private

Definition at line 518 of file davidsonsolver.cc.

◆ storeEigenPairs()

void votca::xtp::DavidsonSolver::storeEigenPairs ( const RitzEigenPair & rep,
Index neigen )
private

Definition at line 552 of file davidsonsolver.cc.

◆ storeNotConvergedData()

void votca::xtp::DavidsonSolver::storeNotConvergedData ( const RitzEigenPair & rep,
const ArrayXb & root_converged,
Index neigen )
private

Definition at line 527 of file davidsonsolver.cc.

◆ updateProjection()

template<typename MatrixReplacement >
void votca::xtp::DavidsonSolver::updateProjection ( const MatrixReplacement & A,
ProjectedSpace & proj ) const
inlineprivate

Definition at line 172 of file davidsonsolver.h.

Member Data Documentation

◆ Adiag_

Eigen::VectorXd votca::xtp::DavidsonSolver::Adiag_
private

Definition at line 131 of file davidsonsolver.h.

◆ davidson_correction_

CORR votca::xtp::DavidsonSolver::davidson_correction_ = CORR::DPR
private

Definition at line 134 of file davidsonsolver.h.

◆ davidson_update_

UPDATE votca::xtp::DavidsonSolver::davidson_update_ = UPDATE::SAFE
private

Definition at line 137 of file davidsonsolver.h.

◆ eigenvalues_

Eigen::VectorXd votca::xtp::DavidsonSolver::eigenvalues_
private

Definition at line 142 of file davidsonsolver.h.

◆ eigenvectors_

Eigen::MatrixXd votca::xtp::DavidsonSolver::eigenvectors_
private

Definition at line 143 of file davidsonsolver.h.

◆ i_iter_

Index votca::xtp::DavidsonSolver::i_iter_ = 0
private

Definition at line 128 of file davidsonsolver.h.

◆ info_

Eigen::ComputationInfo votca::xtp::DavidsonSolver::info_ = Eigen::ComputationInfo::NoConvergence
private

Definition at line 144 of file davidsonsolver.h.

◆ iter_max_

Index votca::xtp::DavidsonSolver::iter_max_ = 50
private

Definition at line 127 of file davidsonsolver.h.

◆ log_

Logger& votca::xtp::DavidsonSolver::log_
private

Definition at line 126 of file davidsonsolver.h.

◆ matrix_type_

MATRIX_TYPE votca::xtp::DavidsonSolver::matrix_type_ = MATRIX_TYPE::SYMM
private

Definition at line 140 of file davidsonsolver.h.

◆ max_search_space_

Index votca::xtp::DavidsonSolver::max_search_space_ = 0
private

Definition at line 130 of file davidsonsolver.h.

◆ restart_size_

Index votca::xtp::DavidsonSolver::restart_size_ = 0
private

Definition at line 132 of file davidsonsolver.h.

◆ tol_

double votca::xtp::DavidsonSolver::tol_ = 1E-4
private

Definition at line 129 of file davidsonsolver.h.


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