cspline_interp Class Template Reference

Cubic spline interpolation (GSL). More...

#include <interp.h>

Inheritance diagram for cspline_interp:

base_interp cspline_peri_interp

Detailed Description

template<class vec_t>
class cspline_interp< vec_t >

By default, this uses natural boundary conditions, where the second derivative vanishes at each end point. Extrapolation effectively assumes that the second derivative is linear outside of the endpoints. If the boolean argument to the constructor is set to true, then periodic boundary conditions are assumed. Alternatively, use cspline_peri_interp for perodic bounary conditions.

Idea for future:
Could use O2scl 's native tridiagonal routines instead of calling the GSL ones.

Definition at line 304 of file interp.h.


Public Member Functions

 cspline_interp (bool periodic=false)
 Create a base interpolation object with natural or periodic boundary conditions.
virtual int allocate (size_t size)
 Allocate memory, assuming x and y have size size.
virtual int init (const vec_t &xa, const vec_t &ya, size_t size)
 Initialize interpolation routine.
virtual int free ()
 Free allocated memory.
virtual int interp (const vec_t &x_array, const vec_t &y_array, size_t size, double x, double &y)
 Give the value of the function $ y(x=x_0) $ .
virtual int deriv (const vec_t &x_array, const vec_t &y_array, size_t size, double x, double &dydx)
 Give the value of the derivative $ y^{\prime}(x=x_0) $ .
virtual int deriv2 (const vec_t &x_array, const vec_t &y_array, size_t size, double x, double &d2ydx2)
 Give the value of the second derivative $ y^{\prime \prime}(x=x_0) $ .
virtual int integ (const vec_t &x_array, const vec_t &y_array, size_t size, double a, double b, double &result)
 Give the value of the integral $ \int_a^{b}y(x)~dx $ .
virtual const char * type ()
 Return the type, "cspline_interp".

Protected Member Functions

void coeff_calc (const double c_array[], double dy, double dx, size_t index, double *b, double *c2, double *d)
 Compute coefficients for cubic spline interpolation.

Protected Attributes

bool peri
 True for periodic boundary conditions.
Storage for cubic spline interpolation
double * c
double * g
double * diag
double * offdiag

Private Member Functions

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

Member Function Documentation

virtual int init ( const vec_t &  xa,
const vec_t &  ya,
size_t  size 
) [inline, virtual]

Periodic boundary conditions

Natural boundary conditions

Reimplemented from base_interp.

Definition at line 389 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