iterative-solver 0.0
 
Loading...
Searching...
No Matches
molpro::linalg::itsolv::interpolate_detail::Morse_problem< value_type > Class Template Reference

Fits the four Morse parameters to the two defining points. More...

#include <Interpolate-implementation.h>

Inheritance diagram for molpro::linalg::itsolv::interpolate_detail::Morse_problem< value_type >:
Collaboration diagram for molpro::linalg::itsolv::interpolate_detail::Morse_problem< value_type >:

Detailed Description

template<typename value_type>
class molpro::linalg::itsolv::interpolate_detail::Morse_problem< value_type >

Fits the four Morse parameters to the two defining points.

Public Member Functions

 Morse_problem (point p0, point p1)
 
Problem< R >::value_t residual (const R &parameters, R &residual) const override
 Calculate the residual vector. Used by non-linear solvers (NonLinearEquations, Optimize) only.
 
- Public Member Functions inherited from molpro::linalg::itsolv::Problem< std::vector< value_type > >
 Problem ()=default
 
virtual ~Problem ()=default
 
virtual void action (const CVecRef< std::vector< value_type > > &parameters, const VecRef< std::vector< value_type > > &action) const
 Calculate the action of the kernel matrix on a set of parameters. Used by linear solvers, but not by the non-linear solvers (NonLinearEquations, Optimize).
 
virtual bool diagonals (container_t &d) const
 Optionally provide the diagonal elements of the underlying kernel. If implemented and returning true, the provided diagonals will be used by IterativeSolver for preconditioning (and therefore the precondition() function does not need to be implemented), and, in the case of linear problems, for selection of the P space. Otherwise, preconditioning will be done with precondition(), and any P space has to be provided manually.
 
virtual void precondition (const VecRef< std::vector< value_type > > &residual, const std::vector< value_t > &shift) const
 Apply preconditioning to a residual vector in order to predict a step towards the solution.
 
virtual void precondition (const VecRef< std::vector< value_type > > &residual, const std::vector< value_t > &shift, const std::vector< value_type > &diagonals) const
 Apply preconditioning to a residual vector in order to predict a step towards the solution.
 
virtual void precondition_with_metric (const VecRef< std::vector< value_type > > &residual, const std::vector< value_t > &shift, const std::vector< value_type > &diagonals, const std::vector< value_type > &metric_diagonals) const
 Apply preconditioning to a residual vector of a generalised eigenproblem. Used instead of precondition() when both diagonals() and metric_diagonals() are provided.
 
virtual MetricKind metric_kind () const
 The kind of metric M of the problem. Anything other than MetricKind::Identity turns the eigenproblem A v = lambda v into the generalised eigenproblem A v = lambda M v, which requires metric_action() and solving with the IterativeSolver::solve() overload that takes buffers for the actions of the metric. Which kinds are supported depends on the solver (IterativeSolver::supports_metric()); solve() throws for the others.
 
virtual MetricStorage metric_storage () const
 How IterativeSolver::solve() obtains the actions of the metric on its subspace vectors, see IterativeSolver::set_metric(). With MetricStorage::Stored (the default) it keeps the action of the metric on every subspace vector; with MetricStorage::OnTheFly it keeps none, and calls metric_action() on the solutions whenever it constructs residuals instead. OnTheFly saves the memory or disk space of one vector per subspace vector at the cost of applying the metric once more per root and iteration, which pays off where the metric is cheap to apply, e.g. diagonal or sparse.
 
virtual void metric_action (const CVecRef< std::vector< value_type > > &parameters, const VecRef< std::vector< value_type > > &metric_actions) const
 Calculate the action of the metric on a set of parameters. Called only if metric_kind() is not MetricKind::Identity.
 
virtual void action_with_metric (const CVecRef< std::vector< value_type > > &parameters, const VecRef< std::vector< value_type > > &actions, const VecRef< std::vector< value_type > > &metric_actions) const
 Calculate the actions of the kernel and of the metric on a set of parameters together. Used by IterativeSolver::solve() for problems with a metric; the default calls action() and metric_action(), and can be overridden where both are cheaper to calculate together.
 
virtual bool metric_diagonals (std::vector< value_type > &d) const
 Provide the diagonal elements of the metric. For a problem with a metric that provides diagonals(), this is required too, so that the default preconditioner divides by diag(A) - lambda diag(M); IterativeSolver::solve() throws otherwise. Approximate values are fine. The diagonal elements of the kernel and of the metric are then passed to precondition_with_metric(), and an initial guess is generated from the lowest ratios of the diagonal elements of the kernel and the metric, which needs a container supported by precondition_default().
 
virtual bool RHS (std::vector< value_type > &RHS, unsigned int instance) const
 Return the inhomogeneous part of a linear equation system.
 
virtual std::vector< value_t > pp_action_matrix (const std::vector< std::map< size_t, typename R::value_type > > &pparams) const
 Calculate the kernel matrix in the P space.
 
virtual void p_action (const std::vector< std::vector< value_t > > &p_coefficients, const CVecRef< std::map< size_t, typename R::value_type > > &pparams, const VecRef< container_t > &actions) const
 Calculate the action of the kernel matrix on a set of vectors in the P space.
 
virtual std::vector< value_t > pp_metric_matrix (const std::vector< std::map< size_t, typename R::value_type > > &pparams) const
 Calculate the metric matrix in the P space, for a problem with a metric (metric_kind())
 
virtual void p_metric_action (const std::vector< std::vector< value_t > > &p_coefficients, const CVecRef< std::map< size_t, typename R::value_type > > &pparams, const VecRef< container_t > &metric_actions) const
 Calculate the action of the metric on a set of vectors in the P space, for a problem with a metric (metric_kind()). Not used if the metric is applied on the fly (metric_storage()).
 
virtual bool test_parameters (unsigned int instance, std::vector< value_type > &parameters) const
 Provide values of R vectors for testing the problem class. For use in a non-linear solver, the first vector (instance=0) should be a reference point, and the remainder (instance>0) should be close to it, such that meaningful numerical differentation can be done to test the residual function.
 

Additional Inherited Members

- Public Types inherited from molpro::linalg::itsolv::Problem< std::vector< value_type > >
using container_t = std::vector< value_type >
 
using p_container_t = std::map< size_t, typename R::value_type >
 
using value_t = typename R::value_type
 

Constructor & Destructor Documentation

◆ Morse_problem()

template<typename value_type >
molpro::linalg::itsolv::interpolate_detail::Morse_problem< value_type >::Morse_problem ( point  p0,
point  p1 
)
inline

Member Function Documentation

◆ residual()

template<typename value_type >
Problem< R >::value_t molpro::linalg::itsolv::interpolate_detail::Morse_problem< value_type >::residual ( const R &  parameters,
R &  residual 
) const
inlineoverridevirtual

Calculate the residual vector. Used by non-linear solvers (NonLinearEquations, Optimize) only.

Parameters
parametersThe trial solution for which the residual is to be calculated
residualThe residual vector
Returns
In the case where the residual is an exact differential, the corresponding function value. Used by Optimize but not NonLinearEquations.

Reimplemented from molpro::linalg::itsolv::Problem< std::vector< value_type > >.