Psi4
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
psi::CGRSolver Class Reference

#include <solver.h>

Inheritance diagram for psi::CGRSolver:
psi::RSolver psi::Solver

Public Member Functions

 CGRSolver (std::shared_ptr< RHamiltonian > H)
 
virtual ~CGRSolver ()
 
std::vector< std::shared_ptr
< Vector > > & 
x ()
 
std::vector< std::shared_ptr
< Vector > > & 
b ()
 
void print_header () const
 
size_t memory_estimate ()
 Estimate of maximum memory usage (in doubles) More...
 
void initialize ()
 
void solve ()
 
void finalize ()
 
void set_shifts (const std::vector< std::vector< double > > &shifts)
 
void set_A (SharedMatrix A, const std::vector< std::vector< int > > inds)
 
void set_nguess (int nguess)
 
- Public Member Functions inherited from psi::RSolver
 RSolver (std::shared_ptr< RHamiltonian > H)
 
virtual ~RSolver ()
 Destructor. More...
 
void set_Hamiltonian (std::shared_ptr< RHamiltonian > H)
 
std::shared_ptr< RHamiltonianH () const
 
- Public Member Functions inherited from psi::Solver
 Solver ()
 Default Constructor. More...
 
virtual ~Solver ()
 Destructor. More...
 
void set_precondition (const std::string &precondition)
 Set precondition type (specific to solver type) More...
 
void set_memory (size_t memory)
 Set maximum vector storage space (defaults to 0 MB => Unlimited storage) More...
 
void set_maxiter (int maxiter)
 Set maximum number of iterations (defaults to 100) More...
 
void set_convergence (double criteria)
 Set convergence criteria (defaults to 1.0E-6) More...
 
void set_print (int print)
 Print flag (defaults to 1) More...
 
void set_debug (int debug)
 Debug flag (defaults to 0) More...
 
void set_bench (int bench)
 Bench flag (defaults to 0) More...
 
int iteration () const
 What iteration is it? More...
 
bool converged () const
 Did the solver converge? More...
 

Static Public Member Functions

static std::shared_ptr< CGRSolverbuild_solver (Options &options, std::shared_ptr< RHamiltonian > H)
 Static constructor, uses Options object. More...
 

Protected Member Functions

void setup ()
 
void guess ()
 
void residual ()
 
void products_x ()
 
void products_p ()
 
void alpha ()
 
void update_x ()
 
void update_r ()
 
void check_convergence ()
 
void update_z ()
 
void beta ()
 
void update_p ()
 
- Protected Member Functions inherited from psi::Solver
void common_init ()
 Common initialization. More...
 

Protected Attributes

std::vector< std::shared_ptr
< Vector > > 
b_
 Force vectors. More...
 
std::vector< std::shared_ptr
< Vector > > 
x_
 Solution vectors. More...
 
std::vector< std::shared_ptr
< Vector > > 
Ap_
 Product vectors. More...
 
std::vector< std::shared_ptr
< Vector > > 
z_
 M^-1 x. More...
 
std::vector< std::shared_ptr
< Vector > > 
r_
 Residual vectors. More...
 
std::vector< std::shared_ptr
< Vector > > 
p_
 Conjugate directions. More...
 
std::vector< double > alpha_
 Alpha values. More...
 
std::vector< double > beta_
 Beta values. More...
 
std::vector< double > r_nrm2_
 Residual norm. More...
 
std::vector< double > z_r_
 z'r More...
 
std::vector< bool > r_converged_
 Which vectors are converged? More...
 
int nconverged_
 Number of converged vectors. More...
 
std::shared_ptr< Vectordiag_
 Diagonal M, for guess and Jacobi preconditioning. More...
 
SharedMatrix A_
 A subspace matrix, for preconditioning. More...
 
std::vector< std::vector< int > > A_inds_
 A subspace indices. More...
 
std::vector< std::vector
< double > > 
shifts_
 Shifts (to solve (A-mI) More...
 
int nguess_
 Number of guess vectors to use for subspace preconditioner. More...
 
- Protected Attributes inherited from psi::RSolver
std::shared_ptr< RHamiltonianH_
 Reference to underlying RHamiltonian. More...
 
- Protected Attributes inherited from psi::Solver
int print_
 Print flag, defaults to 1. More...
 
int debug_
 Debug flag, defaults to 0. More...
 
int bench_
 Bench flag, defaults to 0. More...
 
std::string name_
 Name of solver (set by subclasses) More...
 
size_t memory_
 Memory available, in doubles, defaults to 0 => Unlimited storage. More...
 
double criteria_
 Convergence criteria, defaults to 1.0E-6. More...
 
int maxiter_
 Maximum number of iterations, defaults to 100. More...
 
bool converged_
 Converged or not? More...
 
double convergence_
 Convergence measure at this iteration. More...
 
int iteration_
 Current iteration count. More...
 
std::string precondition_
 Preconditioner type. More...
 

Constructor & Destructor Documentation

psi::CGRSolver::CGRSolver ( std::shared_ptr< RHamiltonian H)
psi::CGRSolver::~CGRSolver ( )
virtual

Member Function Documentation

void psi::CGRSolver::alpha ( )
protected
std::vector<std::shared_ptr<Vector> >& psi::CGRSolver::b ( )
inline
void psi::CGRSolver::beta ( )
protected
std::shared_ptr< CGRSolver > psi::CGRSolver::build_solver ( Options options,
std::shared_ptr< RHamiltonian H 
)
static

Static constructor, uses Options object.

void psi::CGRSolver::check_convergence ( )
protected
void psi::CGRSolver::finalize ( )
virtual

Method to clear off overhead memory without destroying the object

Implements psi::Solver.

void psi::CGRSolver::guess ( )
protected
void psi::CGRSolver::initialize ( )
virtual

Warm it all up, everything you got. Cmon you apes, you wanna live forever?!

Implements psi::Solver.

size_t psi::CGRSolver::memory_estimate ( )
virtual

Estimate of maximum memory usage (in doubles)

Implements psi::Solver.

void psi::CGRSolver::print_header ( ) const
virtual

Print header information regarding Solver type on output file

Implements psi::Solver.

void psi::CGRSolver::products_p ( )
protected
void psi::CGRSolver::products_x ( )
protected
void psi::CGRSolver::residual ( )
protected
void psi::CGRSolver::set_A ( SharedMatrix  A,
const std::vector< std::vector< int > >  inds 
)
inline
void psi::CGRSolver::set_nguess ( int  nguess)
inline
void psi::CGRSolver::set_shifts ( const std::vector< std::vector< double > > &  shifts)
inline
void psi::CGRSolver::setup ( )
protected
void psi::CGRSolver::solve ( )
virtual

Perform iterative solution, based on current state

Implements psi::Solver.

void psi::CGRSolver::update_p ( )
protected
void psi::CGRSolver::update_r ( )
protected
void psi::CGRSolver::update_x ( )
protected
void psi::CGRSolver::update_z ( )
protected
std::vector<std::shared_ptr<Vector> >& psi::CGRSolver::x ( )
inline

Member Data Documentation

SharedMatrix psi::CGRSolver::A_
protected

A subspace matrix, for preconditioning.

std::vector<std::vector<int> > psi::CGRSolver::A_inds_
protected

A subspace indices.

std::vector<double> psi::CGRSolver::alpha_
protected

Alpha values.

std::vector<std::shared_ptr<Vector> > psi::CGRSolver::Ap_
protected

Product vectors.

std::vector<std::shared_ptr<Vector> > psi::CGRSolver::b_
protected

Force vectors.

std::vector<double> psi::CGRSolver::beta_
protected

Beta values.

std::shared_ptr<Vector> psi::CGRSolver::diag_
protected

Diagonal M, for guess and Jacobi preconditioning.

int psi::CGRSolver::nconverged_
protected

Number of converged vectors.

int psi::CGRSolver::nguess_
protected

Number of guess vectors to use for subspace preconditioner.

std::vector<std::shared_ptr<Vector> > psi::CGRSolver::p_
protected

Conjugate directions.

std::vector<std::shared_ptr<Vector> > psi::CGRSolver::r_
protected

Residual vectors.

std::vector<bool> psi::CGRSolver::r_converged_
protected

Which vectors are converged?

std::vector<double> psi::CGRSolver::r_nrm2_
protected

Residual norm.

std::vector<std::vector<double> > psi::CGRSolver::shifts_
protected

Shifts (to solve (A-mI)

std::vector<std::shared_ptr<Vector> > psi::CGRSolver::x_
protected

Solution vectors.

std::vector<std::shared_ptr<Vector> > psi::CGRSolver::z_
protected

M^-1 x.

std::vector<double> psi::CGRSolver::z_r_
protected

z'r


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