Class interp_vec (o2scl)

O2scl : Class List

template<class vec_t = boost::numeric::ublas::vector<double>, class vec2_t = vec_t, class fp_t = double>
class interp_vec : public o2scl::interp_base<boost::numeric::ublas::vector<double>, boost::numeric::ublas::vector<double>, double>

Interpolation class for pre-specified vector.

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

This interpolation class is intended to be sufficiently general to handle any vector type. Interpolation of ublas vector like objects is performed with the default template parameters.

This class does not double check the vector to ensure that all of the intervals for the abcissa are all increasing or all decreasing.

The type of interpolation to be performed can be specified using the set_type() function. The default is cubic splines with natural boundary conditions.

Todo

Future: In class interp_vec, make a version which copies vectors rather than storing pointers might be better and then has copy constructors.

Set methods

inline void set_type(size_t interp_type = itp_cspline)

Set the interpolation type.

inline virtual void set(size_t n, const vec_t &x, const vec2_t &y)

Modify the interpolation object to operate on the first n entries of vectors x and y.

inline void set(size_t n, const vec_t &x, const vec2_t &y, size_t interp_type)

Set a new vector to interpolate.

Interpolation methods

inline virtual fp_t eval(const fp_t x0) const

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) \) .

inline virtual fp_t deriv(const fp_t x0) const

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

inline virtual fp_t deriv2(const fp_t x0) const

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

inline virtual fp_t integ(const fp_t x1, const fp_t x2) const

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

Other methods

inline void clear()

Clear the base interpolation object and covariance function (if necessary)

inline virtual const char *type() const

Return the type, “interp_vec”.

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

Public Functions

inline interp_vec(size_t interp_type = itp_cspline)

Create an interpolation object with interpolation type interp_type.

inline interp_vec(size_t n, const vec_t &x, const vec2_t &y, size_t interp_type = itp_cspline)

Create an interpolation object with interpolation type interp_type based on the first n entries of vectors x and y.

inline virtual ~interp_vec()

Free the memory associated with the interpolation object.

Protected Attributes

interp_base<vec_t, vec2_t, fp_t> *itp

Base interpolation object.

size_t itype

Interpolation type.

covar_funct *cf

Covariance function for Gaussian process interpolation.

std::vector<std::vector<fp_t>> param_list

Parameter list for Gaussian process interpolation.