libmoost
moost::algorithm::spline_interpolation Class Reference

Generate a spline interpolation of X and Y data points using the GNU Scientific Library. More...

#include <spline_interpolation.hpp>

Inheritance diagram for moost::algorithm::spline_interpolation:
Collaboration diagram for moost::algorithm::spline_interpolation:

List of all members.

Public Member Functions

 spline_interpolation (std::vector< double > const &x, std::vector< double > const &y)
 create a spline interpolation object
bool operator() (double const x, double &y, double const z=0) const
 Given a value of X return Y (or Z if X is out of range)
double operator() (double const x) const
 Given a value of X return Y (or throw if out of range)

Private Types

typedef
moost::utils::scope_exit::type
< gsl_interp * >
::call_free_function_with_val 
interp_t
typedef
moost::utils::scope_exit::type
< gsl_interp_accel * >
::call_free_function_with_val 
accel_t

Private Member Functions

void validate_construction () const

Private Attributes

interp_t interp_
accel_t accel_
std::vector< double > const & x_
std::vector< double > const & y_

Detailed Description

Generate a spline interpolation of X and Y data points using the GNU Scientific Library.

http://www.gnu.org/software/gsl/manual/html_node/Interpolation.html

Definition at line 60 of file spline_interpolation.hpp.


Member Typedef Documentation

typedef moost::utils::scope_exit::type< gsl_interp_accel *>::call_free_function_with_val moost::algorithm::spline_interpolation::accel_t [private]

Definition at line 67 of file spline_interpolation.hpp.

typedef moost::utils::scope_exit::type< gsl_interp *>::call_free_function_with_val moost::algorithm::spline_interpolation::interp_t [private]

Definition at line 64 of file spline_interpolation.hpp.


Constructor & Destructor Documentation

moost::algorithm::spline_interpolation::spline_interpolation ( std::vector< double > const &  x,
std::vector< double > const &  y 
) [inline]

create a spline interpolation object

Parameters:
x: A vector of X data points
y: A vector of Y data points
Note:
The X vector MUST be sorted in ascending order.

Given a vector of X/Y data points, this class will interpolate a value of Y for any value of X providing the value of X is given within the range of X_begin to X_end.

Definition at line 85 of file spline_interpolation.hpp.

Here is the call graph for this function:


Member Function Documentation

bool moost::algorithm::spline_interpolation::operator() ( double const  x,
double &  y,
double const  z = 0 
) const [inline]

Given a value of X return Y (or Z if X is out of range)

Parameters:
xAn X data point
yAn interpolated Y data point
zUsed as the default if X is out of range
Note:
the value of X doesn't have to be one of the original values of the X vector, it just has to be within the range of the lowest to the highest X value (hence, Y is an interpolation).
Returns:
Interpolation of Y or Z if X is out of range

Definition at line 113 of file spline_interpolation.hpp.

double moost::algorithm::spline_interpolation::operator() ( double const  x) const [inline]

Given a value of X return Y (or throw if out of range)

Parameters:
xAn X data point
Note:
the value of X doesn't have to be one of the original values of the X vector, it just has to be within the range of the lowest to the highest X value (hence, Y is an interpolation).
Returns:
An interpolation of Y data point

Definition at line 137 of file spline_interpolation.hpp.

Definition at line 151 of file spline_interpolation.hpp.

Here is the caller graph for this function:


Member Data Documentation

std::vector<double> const& moost::algorithm::spline_interpolation::x_ [private]

Definition at line 172 of file spline_interpolation.hpp.

std::vector<double> const& moost::algorithm::spline_interpolation::y_ [private]

Definition at line 173 of file spline_interpolation.hpp.


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