Class interp_base (o2scl)

O2scl : Class List

template<class vec_t, class vec2_t = vec_t, class fp_t = double>
class interp_base

Base low-level interpolation class [abstract base].

See also the Interpolation section of the O2scl User’s guide.

To interpolate a set vectors x and y, call set() and then the interpolation functions eval(), deriv(), deriv2() and integ(). If the x and y vectors do not change, then you may call the interpolation functions multiple times in succession. These classes do not copy the user-specified vectors but store pointers to them. Thus, if the vector is changed without a new call to interp_base::set(), the behavior of the interpolation functions is undefined.

Subclassed by o2scl::interp_akima< vec_t, vec_t, double >, o2scl::interp_cspline< vec_t, vec_t, double >, o2scl::interp_krige< boost::numeric::ublas::vector< double >, boost::numeric::ublas::vector< double >, std::function< double(double, double)>, std::function< double(double, double, double)>, boost::numeric::ublas::matrix< double >, o2scl_linalg::matrix_invert_det_cholesky< boost::numeric::ublas::matrix< double > > >, o2scl::interp_vec< std::vector< double > >, o2scl::interp_vec< vec_t >, o2scl::interp_vec< vector< double > >, o2scl::interp_akima< vec_t, vec2_t, fp_t >, o2scl::interp_cspline< vec_t, vec2_t, fp_t >, o2scl::interp_krige< vec_t, vec2_t, covar_func_t, covar_integ_t, mat_t, mat_inv_t >, o2scl::interp_linear< vec_t, vec2_t, fp_t >, o2scl::interp_monotonic< vec_t, vec2_t, fp_t >, o2scl::interp_nearest_neigh< vec_t, vec2_t, fp_t >, o2scl::interp_steffen< vec_t, vec2_t, fp_t >, o2scl::interp_vec< vec_t, vec2_t, fp_t >

Public Functions

inline interp_base()
inline virtual ~interp_base()
virtual void set(size_t size, const vec_t &x, const vec2_t &y) = 0

Initialize interpolation routine.

virtual fp_t eval(fp_t x0) const = 0

Give the value of the function \( y(x=x_0) \)

inline virtual fp_t operator()(fp_t x0) const

Give the value of the function \( y(x=x_0) \) .

virtual fp_t deriv(fp_t x0) const = 0

Give the value of the derivative \( y^{\prime}(x=x_0) \) .

virtual fp_t deriv2(fp_t x0) const = 0

Give the value of the second derivative \( y^{\prime \prime}(x=x_0) \) .

virtual fp_t integ(fp_t a, fp_t b) const = 0

Give the value of the integral \( \int_a^{b}y(x)~dx \) .

virtual const char *type() const = 0

Return the type.

Public Members

size_t min_size

The minimum size of the vectors to interpolate between.

This variable must be set in the constructor of the children for access by the class user.

Protected Functions

inline fp_t integ_eval(fp_t ai, fp_t bi, fp_t ci, fp_t di, fp_t xi, fp_t a, fp_t b) const

An internal function to assist in computing the integral for both the cspline and Akima types.

Protected Attributes

search_vec<const vec_t, double> svx

To perform binary searches.

This pointer is set to zero in the constructor and should be non-zero only if it has been allocated with new.

const vec_t *px

Independent vector.

const vec2_t *py

Dependent vector.

size_t sz

Vector size.

Private Functions

interp_base(const interp_base<vec_t, vec2_t, fp_t>&)
interp_base<vec_t, vec2_t, fp_t> &operator=(const interp_base<vec_t, vec2_t, fp_t>&)