base_interp Class Template Reference

#include <interp.h>

Inheritance diagram for base_interp:

cspline_interp linear_interp cspline_peri_interp

Detailed Description

template<class vec_t>
class base_interp< vec_t >

Base low-level interpolation class.

The descendants of this class are intended to be fast interpolation routines for increasing functions, leaving the some error handling, user-friendliness, and other more complicated improvements for other classes.

For any pair of vectors x and y into which you would like to interpolate, you need to call allocate() and init() first, and then the interpolation functions, and then free(). If the next pair of vectors has the same size, then you need only to call init() before the next call to an interpolation function. If the vectors do not change, then you may call the interpolation functions in succession.

All of the descendants are based on the GSL interpolation routines and give identical results.

Idea for future:
These might work for decreasing functions by just replacing calls to search_vec::bsearch_inc() with search_vec::bsearch_dec(). If this is the case, then this should be rewritten accordingly.

Definition at line 65 of file interp.h.


Public Member Functions

virtual int allocate (size_t size)
 Allocate memory, assuming x and y have size size.
virtual int free ()
 Free allocated memory.
virtual int init (const vec_t &x, const vec_t &y, size_t size)
 Initialize interpolation routine.
virtual int interp (const vec_t &x, const vec_t &y, size_t size, double x0, double &y0)
 Give the value of the function $ y(x=x_0) $ .
virtual int deriv (const vec_t &x, const vec_t &y, size_t size, double x0, double &dydx)
 Give the value of the derivative $ y^{\prime}(x=x_0) $ .
virtual int deriv2 (const vec_t &x, const vec_t &y, size_t size, double x0, double &d2ydx2)
 Give the value of the second derivative $ y^{\prime \prime}(x=x_0) $ .
virtual int integ (const vec_t &x, const vec_t &y, size_t size, double a, double b, double &result)
 Give the value of the integral $ \int_a^{b}y(x)~dx $ .

Data Fields

size_t min_size
 The minimum size of the vectors to interpolate between.

Protected Attributes

search_vec< vec_t > sv
 The binary search object.

Field Documentation

size_t min_size

The minimum size of the vectors to interpolate between.

This needs to be set in the constructor of the children for access by the class user

Definition at line 86 of file interp.h.


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