Class interp_vec (o2scl)

O2scl : Class List

template<class vec_t = boost::numeric::ublas::vector<double>, class vec2_t = vec_t>
class o2scl::interp_vec : public o2scl::interp_base<boost::numeric::ublas::vector<double>, boost::numeric::ublas::vector<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.

Idea for Future:

Make version which copies vectors rather than storing pointers might be better and then has copy constructors.

Public Functions

interp_vec()

Blank interpolator.

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 itp_cspline based on the first n entries of vectors x and y.

~interp_vec()
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.

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

Set a new vector to interpolate.

void clear()

Manually clear the pointer to the user-specified vector.

double eval(const double x0) const

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

double operator()(double x0) const

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

double deriv(const double x0) const

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

double deriv2(const double x0) const

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

double integ(const double x1, const double x2) const

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

const char *type() const

Return the type, “interp_vec”.

Protected Attributes

interp_base<vec_t, vec2_t> *itp

Base interpolation object.

size_t itype

Interpolation type.

Private Functions

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