Class interp_base (o2scl)¶
-
template<class vec_t, class vec2_t = vec_t>
class o2scl::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
andy
, call set() and then the interpolation functions eval(), deriv(), deriv2() and integ(). If thex
andy
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_vec< arr_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 double eval(double x0) const = 0¶
Give the value of the function \( y(x=x_0) \)
-
inline virtual double operator()(double x0) const¶
Give the value of the function \( y(x=x_0) \) .
-
virtual double deriv(double x0) const = 0¶
Give the value of the derivative \( y^{\prime}(x=x_0) \) .
-
virtual double deriv2(double x0) const = 0¶
Give the value of the second derivative \( y^{\prime \prime}(x=x_0) \) .
-
virtual double integ(double a, double 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 double integ_eval(double ai, double bi, double ci, double di, double xi, double a, double 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> 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
.
-
size_t sz¶
Vector size.
Private Functions
-
interp_base(const interp_base<vec_t, vec2_t>&)¶
-
interp_base<vec_t, vec2_t> &operator=(const interp_base<vec_t, vec2_t>&)¶
-
inline interp_base()¶