Object-oriented Scientific Computing Library: Version 0.910
Public Member Functions | Data Fields | Protected Member Functions | Protected Attributes | Private Member Functions
base_interp< vec_t > Class Template Reference

Base low-level interpolation class [abstract base]. More...

#include <interp.h>

Inheritance diagram for base_interp< vec_t >:
akima_interp< vec_t > cspline_interp< vec_t > linear_interp< vec_t > akima_peri_interp< vec_t > cspline_peri_interp< vec_t >

Detailed Description

template<class vec_t>
class base_interp< vec_t >

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 (you don't need to reallocate). If the x and y vectors do not change, then you may call the interpolation functions in succession.

These interpolation class work so long as the vector x is either monotonically increasing or monotonically decreasing. All of the descendants give identical results to the GSL interpolation routines when the vector is monotonically increasing.

Definition at line 56 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)=0
 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)=0
 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)=0
 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)=0
 Give the value of the integral $ \int_a^{b}y(x)~dx $ .
virtual const char * type ()
 Return the type, "base_interp".

Data Fields

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

Protected Member Functions

double integ_eval (double ai, double bi, double ci, double di, double xi, double a, double b)
 An internal function to assist in computing the integral for both the cspline and Akima types.

Protected Attributes

search_vec< vec_t > * sv
 To perform binary searches.
size_t n_sv
 The size of the allocated search_vec object.
bool mem_alloc
 True if memory has been allocated.

Private Member Functions

 base_interp (const base_interp< vec_t > &)
base_interp< vec_t > & operator= (const base_interp< vec_t > &)

Field Documentation

template<class vec_t>
size_t base_interp< vec_t >::min_size

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

Definition at line 109 of file interp.h.


The documentation for this class was generated from the following file:
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Documentation generated with Doxygen. Provided under the GNU Free Documentation License (see License Information).

Get Object-oriented Scientific Computing
Lib at SourceForge.net. Fast, secure and Free Open Source software
downloads.