template<
class R,
class Q = R,
class P = std::map<size_t, typename R::value_type>>
class molpro::linalg::itsolv::LinearEquationsDavidson< R, Q, P >
Solves a system of linear equation, A x = b.
The equations are solved using a Krylov subspace projection method with the P and D space. This is the same approach as LinearEigenvalue.
Residual
The residual is scaled down by the norm of the RHS vector so that thresholds are consistent.
Value
The value of solution i is , the diagonal element of the susceptibility (second-order property) when the equations are for first-order perturbed wavefunctions. The value error used with the value convergence threshold is the absolute change in since the previous iteration, without the scaling applied to the residual. With the augmented Hessian it is instead the change in the subspace eigenvalue.
Preconditioner
Augmented Hessian
LinearEquationsDavidson (const std::shared_ptr< ArrayHandlers < R, Q, P > > &handlers , const std::shared_ptr< Logger > &logger_ =std::make_shared< Logger >())
bool solve (const VecRef < R > ¶meters, const VecRef < R > &actions, const Problem < R > &problem, bool generate_initial_guess =false ) override
bool nonlinear () const override
size_t end_iteration (const VecRef < R > ¶meters, const VecRef < R > &action) override
size_t end_iteration (std::vector< R > ¶meters, std::vector< R > &action) override
size_t end_iteration (R ¶meters, R &actions) override
void add_equations (const CVecRef < R > &rhs ) override
void add_equations (const R &rhs ) override
void add_equations (const std::vector< R > &rhs ) override
CVecRef < Q > rhs () const override
void set_norm_thresh (value_type_abs thresh )
Set threshold on the norm of parameters that should be considered null.
value_type_abs get_norm_thresh () const
void set_svd_thresh (value_type_abs thresh )
value_type_abs get_svd_thresh () const
void set_reset_D (size_t n )
Set the period in iterations for resetting the D space, 0 for never.
size_t get_reset_D () const
void set_reset_D_maxQ_size (size_t n )
Set the maximum size of Q space after resetting the D space.
int get_reset_D_maxQ_size () const
void set_max_size_qspace (std::size_t n )
std::size_t get_max_size_qspace () const
void set_min_size_qspace (std::size_t n )
std::size_t get_min_size_qspace () const
void set_hermiticity (bool hermitian ) override
bool get_hermiticity () const override
void set_augmented_hessian (const value_type_abs parameter )
Set value of augmented hessian parameter. If 0, than augmented Hessian is not used.
value_type_abs get_augmented_hessian () const
void set_options (const Options &options ) override
std::shared_ptr< Options > get_options () const override
void report (std::ostream &cout , bool endl =true ) const override
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
void set_logger (std::shared_ptr< Logger > logger ) override
Logger & logger () override
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 , value_type_abs 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< value_type_abs > & errors () const override
const Statistics & statistics () const override
void report (std::ostream &cout , bool endl =true ) const override
void iteration_report () const
void summary_report () const
void report () const override
void set_convergence_threshold (value_type_abs thresh ) override
value_type_abs convergence_threshold () const override
void set_convergence_threshold_value (value_type_abs thresh ) override
value_type_abs 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 (value_type_abs threshold ) override
value_type_abs get_p_threshold () const override
const subspace::Dimensions & dimensions () const override
Access dimensions of the subspace.
scalar_type value () const override
void set_profiler (molpro::profiler::Profiler &profiler ) override
void set_profiler (std::shared_ptr< 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, value_type_abs threshold ) const override
std::vector< value_type > values () const
The values chi_ii = <b_i|x_i> of the current solutions, or with the augmented Hessian the subspace eigenvalues.
void set_value_errors () override
Implementation class should overload this to set errors in the current values (e.g. change in eigenvalues)
void construct_residual (const std::vector< int > &roots , const CVecRef < R > ¶ms, const VecRef < R > &actions) override
Constructs residual for given roots provided their parameters and actions.
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 combine_errors ()
Implementation class can overload this to combine the errors of solutions, once those of all are known.
virtual void compute_errors (const std::vector< int > &roots , const CVecRef < R > ¶ms, const CVecRef < R > &residuals , std::vector< value_type_abs > &errors )
Computes the errors of roots, given their parameters and residuals; by default the norms of the residuals.
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.
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
void finalize () override
bool verbosity_at_least (Verbosity v) const
Whether output of verbosity v is printed in solve() ; everything is printed if no verbosity was set.
void generate_initial_guess_from_diagonals (const VecRef < R > ¶meters, const Q &diagonals)
Fills parameters with unit vectors at the positions of the lowest diagonal elements.
std::vector< P > select_pspace (const Q &diagonals)
Selects the P space from the lowest diagonal elements, subject to max_p and p_threshold.
size_t initialise_pspace (const std::vector< P > &pspace, const Problem < R > &problem, const VecRef < R > ¶meters, const VecRef < R > &actions)
Adds the P space to the subspace using the P-space kernel provided by problem; returns the working-set size.