o2scl_interp_vec Class Template Reference

Interpolation class for pre-specified vector. More...

#include <interp.h>

Inheritance diagram for o2scl_interp_vec:

array_interp_vec

Detailed Description

template<class vec_t = ovector_const_view, class alloc_vec_t = ovector, class alloc_t = ovector_alloc>
class o2scl_interp_vec< vec_t, alloc_vec_t, alloc_t >

Interpolation class for pre-specified vector.

This interpolation class is intended to be sufficiently general to handle any vector type. Interpolation of ovector like objects is performed with the default template parameters, and array_interp_vec is provided for simple interpolation on C-style arrays.

The class automatically handles decreasing arrays by copying the old array to a reversed version. For several interpolations on the same data, copying the initial array can be faster than overloading operator[].

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:
Need to fix constructor to behave properly if init() fails. It should free the memory and set ln to zero.
Todo:
Specify a base_interp_mgr object instead of base_interp objects

Definition at line 1389 of file interp.h.


Public Member Functions

 o2scl_interp_vec (base_interp_mgr< vec_t > &it, size_t n, const vec_t &x, const vec_t &y)
 Create with base interpolation object it.
virtual double interp (const double x0)
 Give the value of the function $ y(x=x_0) $ .
virtual double deriv (const double x0)
 Give the value of the derivative $ y^{\prime}(x=x_0) $ .
virtual double deriv2 (const double x0)
 Give the value of the second derivative $ y^{\prime \prime}(x=x_0) $ .
virtual double integ (const double x1, const double x2)
 Give the value of the integral $ \int_a^{b}y(x)~dx $ .
int set_type (base_interp< vec_t > &it)
 Set base interpolation object.

Protected Attributes

alloc_t ao
 Memory allocator for objects of type alloc_vec_t.
base_interp< vec_t > * itp
 Base interpolation object.
base_interp_mgr< vec_t > * bim
 The interpolation manager.
bool inc
 True if the original array was increasing.
const vec_t * lx
 Pointer to the user-specified x vector.
const vec_t * ly
 Pointer to the user-specified x vector.
alloc_vec_t lrx
 Reversed version of x.
alloc_vec_t lry
 Reversed version of y.
size_t ln
 Size of user-specified vectors.

Private Member Functions

 o2scl_interp_vec (const o2scl_interp_vec< vec_t, alloc_vec_t, alloc_t > &)
o2scl_interp_vec< vec_t,
alloc_vec_t, alloc_t > & 
operator= (const o2scl_interp_vec< vec_t, alloc_vec_t, alloc_t > &)

The documentation for this class was generated from the following file:

Documentation generated with Doxygen and provided under the GNU Free Documentation License. See License Information for details.

Project hosting provided by SourceForge.net Logo, O2scl Sourceforge Project Page