1#ifndef LINEARALGEBRA_SRC_MOLPRO_LINALG_ITSOLV_INTERPOLATE_H_
2#define LINEARALGEBRA_SRC_MOLPRO_LINALG_ITSOLV_INTERPOLATE_H_
3#include <molpro/linalg/scalar_traits.h>
30template <
typename value_type =
double>
33 "the interpolant orders function values in order to minimise them, so it is defined "
34 "only for a real type; pass the real type underlying your scalar, as Optimize does");
41 value_type
f = std::numeric_limits<value_type>::quiet_NaN();
42 value_type
f1 = std::numeric_limits<value_type>::quiet_NaN();
43 value_type
f2 = std::numeric_limits<value_type>::quiet_NaN();
69 point minimize(value_type xa, value_type xb,
size_t bracket_grid = 100,
size_t max_bracket_grid = 100000,
70 bool analytic =
true)
const;
74 const std::vector<value_type>&
parameters()
const {
return m_parameters; }
77 const point m_p0, m_p1;
78 const std::string m_interpolant;
79 std::vector<value_type> m_parameters;
85template <
typename value_type>
88 return lhs.x == rhs.x && lhs.f == rhs.f && lhs.f1 == rhs.f1;
92 return lhs.
x == rhs.x && lhs.
f == rhs.f && lhs.
f1 == rhs.f1;
95template <
typename value_type>
97 for (
const auto& parameter : interpolant.
parameters())
98 os <<
" " << parameter;
102template <
typename value_type>
104 os <<
"x=" << p.x <<
", value=" << p.f <<
", gradient=" << p.f1 <<
", curvature=" << p.f2;
109 os <<
"x=" << p.
x <<
", value=" << p.
f <<
", gradient=" << p.
f1 <<
", curvature=" << p.
f2;
113extern template class Interpolator<double>;
114extern template class Interpolator<long double>;
The interpolant, in the precision of the problem it is used for.
Definition: Interpolate.h:31
const std::vector< value_type > & parameters() const
Definition: Interpolate.h:74
point minimize(value_type xa, value_type xb, size_t bracket_grid=100, size_t max_bracket_grid=100000, bool analytic=true) const
Find the minimum of the interpolant within a range.
Definition: Interpolate-implementation.h:142
point operator()(value_type x) const
Evaluate the interpolant and its derivative at a given point.
Definition: Interpolate-implementation.h:104
point minimize_cubic() const
Definition: Interpolate-implementation.h:119
Interpolator(point p0, point p1, std::string interpolant="cubic", int verbosity=0)
Construct the interpolant.
Definition: Interpolate-implementation.h:62
value_type value_t
Definition: Interpolate.h:37
static std::vector< std::string > interpolants()
Definition: Interpolate-implementation.h:99
4-parameter interpolation of a 1-dimensional function given two points for which function values and ...
Definition: helper.h:14
std::ostream & operator<<(std::ostream &o, const Statistics &statistics)
Definition: Statistics.h:39
bool operator==(const typename Interpolator< value_type >::point &lhs, const typename Interpolator< value_type >::point &rhs)
Definition: Interpolate.h:86
Definition: scalar_traits.h:19
Definition: Interpolate.h:39
value_type f
Definition: Interpolate.h:41
value_type f2
Definition: Interpolate.h:43
value_type f1
Definition: Interpolate.h:42
value_type x
Definition: Interpolate.h:40