LTI-Lib latest version v1.9 - last update 10 Apr 2010

lti::cubicSpline< T > Class Template Reference

This functor implements a cubic spline interpolation for tabulated functions. More...

#include <ltiCubicSpline.h>

Inheritance diagram for lti::cubicSpline< T >:
Inheritance graph
[legend]
Collaboration diagram for lti::cubicSpline< T >:
Collaboration graph
[legend]

List of all members.

Classes

class  parameters
 the parameters for the class cubicSpline More...

Public Member Functions

 cubicSpline ()
 cubicSpline (const cubicSpline &other)
virtual ~cubicSpline ()
virtual const char * getTypeName () const
bool apply (tpointList< T > &srcdest) const
bool apply (const T &x, T &fx) const
cubicSplinecopy (const cubicSpline &other)
virtual functorclone () const
const parametersgetParameters () const
virtual bool updateParameters ()

Protected Member Functions

void spline (const tpointList< T > &in, const double &yp1, const double &ypn, const bool &natural)
bool splint (const tpointList< T > &function, const T &x, T &y) const

Protected Attributes

std::vector< double > secondDerivatives

Detailed Description

template<class T>
class lti::cubicSpline< T >

This functor implements a cubic spline interpolation for tabulated functions.

The input parameters are some sampling points in a tpointList<double>. The requirements of the input points are that they must be a kind of function. Therefore this rule x(n) < x(n+1) is required for each n and the list must consist of at least three points. Furthermore the parameters consist of the derivatives at the beginning (first point) and end of the function (last point). If the parameter useNaturalDerivatives is true the derivatives from the parameters are ignored and the algorithm calculates the optimal derivatives at the beginning and end.

The template T type corresponds to the coordinate types. Only the float, double and int types are supported.


Constructor & Destructor Documentation

template<class T >
lti::cubicSpline< T >::cubicSpline (  ) 

default constructor

template<class T >
lti::cubicSpline< T >::cubicSpline ( const cubicSpline< T > &  other  ) 

copy constructor

Parameters:
other the object to be copied
template<class T >
virtual lti::cubicSpline< T >::~cubicSpline (  )  [virtual]

destructor


Member Function Documentation

template<class T >
bool lti::cubicSpline< T >::apply ( const T &  x,
T &  fx 
) const

operates on a copy of the given parameters.

Parameters:
x double with the source data.
fx double where the result will be left.
Returns:
true if apply successful or false otherwise.
template<class T >
bool lti::cubicSpline< T >::apply ( tpointList< T > &  srcdest  )  const

operates on the given parameter.

Parameters:
srcdest tpointList<double> with the source data in the x part of the tpoints. The result for every x value is writen in the y part of the same tpoint.
Returns:
true if apply successful or false otherwise.
template<class T >
virtual functor* lti::cubicSpline< T >::clone (  )  const [virtual]

returns a pointer to a clone of this functor.

Implements lti::variablySpacedSamplesInterpolator.

template<class T >
cubicSpline& lti::cubicSpline< T >::copy ( const cubicSpline< T > &  other  ) 

copy data of "other" functor.

Parameters:
other the functor to be copied
Returns:
a reference to this functor object

Reimplemented from lti::variablySpacedSamplesInterpolator.

template<class T >
const parameters& lti::cubicSpline< T >::getParameters (  )  const

returns used parameters

Reimplemented from lti::variablySpacedSamplesInterpolator.

template<class T >
virtual const char* lti::cubicSpline< T >::getTypeName (  )  const [virtual]

returns the name of this type ("cubicSpline")

Reimplemented from lti::variablySpacedSamplesInterpolator.

template<class T >
void lti::cubicSpline< T >::spline ( const tpointList< T > &  in,
const double &  yp1,
const double &  ypn,
const bool &  natural 
) [protected]

This function calcualtes the second derivatives at each point of the tpointList<double> &in.

Parameters:
in the point list with the source data
yp1 the first derivative an the first point of the tpointlist
ypn the first derivative an the last point of the tpointlist
natural if true constructs a natural spline
template<class T >
bool lti::cubicSpline< T >::splint ( const tpointList< T > &  function,
const T &  x,
T &  y 
) const [protected]

This function evaluate the spline at one x value.

Parameters:
function list of points to be interpolated
x the value where the spline is evaluated
y the return value
Returns:
true if successful, false otherwise
template<class T >
virtual bool lti::cubicSpline< T >::updateParameters (  )  [virtual]

sets the functor's parameters.

Reimplemented from lti::functor.


Member Data Documentation

template<class T >
std::vector<double> lti::cubicSpline< T >::secondDerivatives [protected]

This vector saves the second derivatives at each point of the sampling points.


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

Generated on Sat Apr 10 15:28:12 2010 for LTI-Lib by Doxygen 1.6.1