Object-oriented Scientific Computing Library: Version 0.910
Public Member Functions | Protected Member Functions
smart_interp< vec_t, svec_t > Class Template Reference

Smart interpolation class. More...

#include <smart_interp.h>


Detailed Description

template<class vec_t = ovector_const_view, class svec_t = ovector_const_subvector>
class smart_interp< vec_t, svec_t >

This class can semi-intelligently handle arrays which are not-well formed outside the interpolation region. In particular, if an initial interpolation or derivative calculation fails, the arrays are searched for the largest neighborhood around the point x for which an interpolation or differentiation will likely produce a finite result.

Definition at line 51 of file smart_interp.h.

Public Member Functions

 smart_interp (base_interp_mgr< vec_t > &im1, base_interp_mgr< svec_t > &im3)
 Create a new interpolation object with the specified interpolation managers.
 smart_interp ()
 Create an interpolation object with the default cubic spline interpolation managers.
virtual double interp (const double x0, size_t n, const vec_t &x, const vec_t &y)
 Give the value of the function $ y(x=x_0) $ .
virtual double deriv (const double x0, size_t n, const vec_t &x, const vec_t &y)
 Give the value of the derivative $ y^{prime}(x=x_0) $ .
virtual double deriv2 (const double x0, size_t n, const vec_t &x, const vec_t &y)
 Give the value of the second derivative $ y^{prime \prime}(x=x_0) $ .
virtual double integ (const double a, const double b, size_t n, const vec_t &x, const vec_t &y)
 Give the value of the integral $ \int_a^{b}y(x)~dx $ .

Data Fields

Default interpolation managers
def_interp_mgr< vec_t,
cspline_interp
dim1
def_interp_mgr< svec_t,
cspline_interp
dim3

Protected Member Functions

size_t local_lookup (size_t n, const vec_t &x, double x0)
 A lookup function for generic vectors.
int find_subset (const double a, const double b, size_t sz, const vec_t &x, const vec_t &y, size_t &nsz)
 Try to find the largest monotonic and finite region around the desired location.

Protected Attributes

Storage internally created subvectors
bool sxalloc
const svec_t * sx
const svec_t * sy
Pointers to interpolation objects
base_interp< vec_t > * rit1
base_interp< svec_t > * rit3
Pointers to interpolation managers
base_interp_mgr< vec_t > * bim1
base_interp_mgr< svec_t > * bim3

Member Function Documentation

template<class vec_t = ovector_const_view, class svec_t = ovector_const_subvector>
virtual double smart_interp< vec_t, svec_t >::interp ( const double  x0,
size_t  n,
const vec_t &  x,
const vec_t &  y 
) [inline, virtual]
Todo:
After calling find_subset, I think we might need to double check that nn is larger than the minimum interpolation size.

Definition at line 134 of file smart_interp.h.

template<class vec_t = ovector_const_view, class svec_t = ovector_const_subvector>
int smart_interp< vec_t, svec_t >::find_subset ( const double  a,
const double  b,
size_t  sz,
const vec_t &  x,
const vec_t &  y,
size_t &  nsz 
) [inline, protected]

This function tries to find the largest monotonic region enclosing both a and b in the vector x. If it succeeds, it returns gsl_success, and if it fails, it returns gsl_efailed. It does not call the error handler.

Todo:
The error handling is a bit off here, as it can return a non-zero value even with there is no real "error". We should just make a new bool reference paramter.

Definition at line 409 of file smart_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.