Implements IterativeSolver interface that is common to all solvers. More...
#include <IterativeSolverTemplate.h>
Inherits Solver< R, Q, P >.
Implements IterativeSolver interface that is common to all solvers.
Solver | one of the solvers that inherits from IterativeSolver. |
Public Member Functions | |
IterativeSolverTemplate ()=delete | |
IterativeSolverTemplate (const IterativeSolverTemplate< Solver, R, Q, P > &)=delete | |
IterativeSolverTemplate (IterativeSolverTemplate< Solver, R, Q, P > &&) noexcept=default | |
IterativeSolverTemplate< Solver, R, Q, P > & | operator= (const IterativeSolverTemplate< Solver, R, Q, P > &)=delete |
IterativeSolverTemplate< Solver, R, Q, P > & | operator= (IterativeSolverTemplate< Solver, R, Q, P > &&) noexcept=default |
int | add_vector (const VecRef< R > ¶meters, const VecRef< R > &actions) override |
int | add_vector (std::vector< R > ¶meters, std::vector< R > &actions) override |
int | add_vector (R ¶meters, R &actions, value_type value=0) override |
size_t | add_p (const CVecRef< P > &pparams, const array::Span< value_type > &pp_action_matrix, const VecRef< R > ¶meters, const VecRef< R > &actions, fapply_on_p_type apply_p) override |
void | clearP () override |
void | solution (const std::vector< int > &roots, const VecRef< R > ¶meters, const VecRef< R > &residual) override |
void | solution (const std::vector< int > &roots, std::vector< R > ¶meters, std::vector< R > &residual) override |
void | solution (R ¶meters, R &residual) override |
void | solution_params (const std::vector< int > &roots, std::vector< R > ¶meters) override |
void | solution_params (const std::vector< int > &roots, const VecRef< R > ¶meters) override |
void | solution_params (R ¶meters) override |
std::vector< size_t > | suggest_p (const CVecRef< R > &solution, const CVecRef< R > &residual, size_t max_number, double threshold) override |
const std::vector< int > & | working_set () const override |
size_t | n_roots () const override |
void | set_n_roots (size_t roots) override |
void | set_options (const Options &options) override |
std::shared_ptr< Options > | get_options () const override |
const std::vector< scalar_type > & | errors () const override |
const Statistics & | statistics () const override |
void | report (std::ostream &cout, bool endl=true) const override |
void | report () const override |
void | set_convergence_threshold (double thresh) override |
double | convergence_threshold () const override |
void | set_convergence_threshold_value (double thresh) override |
double | convergence_threshold_value () const override |
void | set_verbosity (Verbosity v) override |
void | set_verbosity (int v) override |
Verbosity | get_verbosity () const override |
void | set_max_iter (int n) override |
int | get_max_iter () const override |
void | set_max_p (int n) override |
int | get_max_p () const override |
void | set_p_threshold (double threshold) override |
double | get_p_threshold () const override |
const subspace::Dimensions & | dimensions () const override |
Access dimensions of the subspace. More... | |
scalar_type | value () const override |
void | set_profiler (molpro::profiler::Profiler &profiler) override |
const std::shared_ptr< molpro::profiler::Profiler > & | profiler () const override |
bool | solve (const VecRef< R > ¶meters, const VecRef< R > &actions, const Problem< R > &problem, bool generate_initial_guess=false) override |
bool | solve (R ¶meters, R &actions, const Problem< R > &problem, bool generate_initial_guess=false) override |
bool | solve (std::vector< R > ¶meters, std::vector< R > &actions, const Problem< R > &problem, bool generate_initial_guess=false) override |
bool | test_problem (const Problem< R > &problem, R &v0, R &v1, int verbosity, double threshold) const override |
Protected Member Functions | |
IterativeSolverTemplate (std::shared_ptr< subspace::IXSpace< R, Q, P > > xspace, std::shared_ptr< subspace::ISubspaceSolver< R, Q, P > > solver, std::shared_ptr< ArrayHandlers< R, Q, P > > handlers, std::shared_ptr< Statistics > stats, std::shared_ptr< Logger > logger) | |
virtual | ~IterativeSolverTemplate () |
virtual void | set_value_errors () |
Implementation class should overload this to set errors in the current values (e.g. change in eigenvalues) More... | |
virtual void | construct_residual (const std::vector< int > &roots, const CVecRef< R > ¶ms, const VecRef< R > &actions)=0 |
Constructs residual for given roots provided their parameters and actions. More... | |
virtual bool | linearEigensystem () const |
size_t | solve_and_generate_working_set (const VecRef< R > ¶meters, const VecRef< R > &action) |
Solves the subspace problems and selects the working set of roots, returning their parameters and residual in parameters and action. More... | |
template<typename TTT > | |
void | check_consistent_number_of_roots_and_solutions (const std::vector< TTT > &roots, const size_t nparams) |
bool | end_iteration_needed () override |
Protected Attributes | |
std::shared_ptr< ArrayHandlers< R, Q, P > > | m_handlers |
Array handlers. More... | |
std::shared_ptr< subspace::IXSpace< R, Q, P > > | m_xspace |
manages the subspace and associated data More... | |
std::shared_ptr< subspace::ISubspaceSolver< R, Q, P > > | m_subspace_solver |
solves the subspace problem More... | |
std::vector< double > | m_errors |
errors from the most recent solution More... | |
std::vector< double > | m_value_errors |
value errors from the most recent solution More... | |
std::vector< int > | m_working_set |
indices of roots in the working set More... | |
size_t | m_nroots {0} |
number of roots the solver is searching for More... | |
double | m_convergence_threshold {1.0e-8} |
residual norms less than this mark a converged solution More... | |
double | m_convergence_threshold_value |
value changes less than this mark a converged solution More... | |
std::shared_ptr< Statistics > | m_stats |
accumulates statistics of operations performed by the solver More... | |
std::shared_ptr< Logger > | m_logger |
logger More... | |
bool | m_normalise_solution = false |
whether to normalise the solutions More... | |
fapply_on_p_type | m_apply_p = {} |
function that evaluates effect of action on the P space projection More... | |
Verbosity | m_verbosity = Verbosity::Iteration |
how much output to print in solve() More... | |
int | m_max_iter = 100 |
maximum number of iterations in solve() More... | |
size_t | m_max_p = 0 |
maximum size of P space More... | |
double | m_p_threshold = std::numeric_limits<double>::max() |
threshold for selecting P space More... | |
bool | m_end_iteration_needed = true |
whether end_iteration should be called after any preconditioner More... | |
|
delete |
|
delete |
|
defaultnoexcept |
|
inlineprotected |
|
inlineprotectedvirtual |
|
inlineoverride |
|
inlineoverride |
|
inlineoverride |
|
inlineoverride |
|
inlineprotected |
|
inlineoverride |
|
protectedpure virtual |
Constructs residual for given roots provided their parameters and actions.
Implemented in molpro::linalg::itsolv::LinearEigensystemDavidson< R, Q, P >, molpro::linalg::itsolv::LinearEigensystemRSPT< R, Q, P >, molpro::linalg::itsolv::LinearEquationsDavidson< R, Q, P >, molpro::linalg::itsolv::OptimizeBFGS< R, Q, P >, and molpro::linalg::itsolv::OptimizeSD< R, Q, P >.
|
inlineoverride |
|
inlineoverride |
|
inlineoverride |
Access dimensions of the subspace.
|
inlineoverrideprotected |
|
inlineoverride |
|
inlineoverride |
|
inlineoverride |
|
inlineoverride |
|
inlineoverride |
|
inlineoverride |
|
inlineprotectedvirtual |
Reimplemented in molpro::linalg::itsolv::LinearEigensystemRSPT< R, Q, P >.
|
inlineoverride |
|
delete |
|
defaultnoexcept |
|
inlineoverride |
|
inlineoverride |
|
inlineoverride |
|
inlineoverride |
|
inlineoverride |
|
inlineoverride |
|
inlineoverride |
|
inlineoverride |
|
inlineoverride |
|
inlineoverride |
|
inlineoverride |
|
inlineprotectedvirtual |
Implementation class should overload this to set errors in the current values (e.g. change in eigenvalues)
Reimplemented in molpro::linalg::itsolv::LinearEigensystemDavidson< R, Q, P >, molpro::linalg::itsolv::OptimizeBFGS< R, Q, P >, and molpro::linalg::itsolv::OptimizeSD< R, Q, P >.
|
inlineoverride |
|
inlineoverride |
|
inlineoverride |
|
inlineoverride |
|
inlineoverride |
|
inlineoverride |
|
inlineoverride |
|
inlineoverride |
|
inlineoverride |
|
inlineoverride |
|
inlineoverride |
|
inlineprotected |
Solves the subspace problems and selects the working set of roots, returning their parameters and residual in parameters and action.
parameters | container for storing parameters of the working set |
action | container for storing the residual of the working set |
apply_p | function that accumulates action from the P space projection of parameters |
|
inlineoverride |
|
inlineoverride |
|
inlineoverride |
|
inlineoverride |
|
inlineoverride |
|
protected |
function that evaluates effect of action on the P space projection
|
protected |
residual norms less than this mark a converged solution
|
protected |
value changes less than this mark a converged solution
|
protected |
whether end_iteration should be called after any preconditioner
|
protected |
errors from the most recent solution
|
protected |
Array handlers.
|
protected |
logger
|
protected |
maximum number of iterations in solve()
|
protected |
maximum size of P space
|
protected |
whether to normalise the solutions
|
protected |
number of roots the solver is searching for
|
protected |
threshold for selecting P space
|
protected |
accumulates statistics of operations performed by the solver
|
protected |
solves the subspace problem
|
protected |
value errors from the most recent solution
|
protected |
how much output to print in solve()
|
protected |
indices of roots in the working set
|
protected |
manages the subspace and associated data