library of assembled shared sources

http://lass.cocamware.com

lass::num::SplineCubic< ScalarType, DataType, DataTraits > Class Template Reference

#include <spline_cubic.h>

Inheritance diagram for lass::num::SplineCubic< ScalarType, DataType, DataTraits >:

Inheritance graph
[legend]
Collaboration diagram for lass::num::SplineCubic< ScalarType, DataType, DataTraits >:

Collaboration graph
[legend]

Data Structures

struct  Node

Public Types

typedef DataTraits TDataTraits
typedef Spline< ScalarType,
DataType > 
TSplineBase
typedef TSplineBase::TScalar TScalar
typedef TSplineBase::TData TData
typedef TSplineBase::ControlRange TControlRange

Public Member Functions

 SplineCubic ()
 construct an empty spline
template<typename PairInputIterator >
 SplineCubic (PairInputIterator iFirst, PairInputIterator iLast)
 construct a spline from a range of control/data pairs.
template<typename ScalarInputIterator , typename DataInputIterator >
 SplineCubic (ScalarInputIterator iFirstControl, ScalarInputIterator iLastControl, DataInputIterator iFirstData)
 construct a spline from seperate ranges.
const TData operator() (TScalar iX) const
 Get the linear interpolated data value that corresponds with constrol value iX.
const TData derivative (TScalar iX) const
 Get the first derivative of data value that corresponds with constrol value iX.
const TData derivative2 (TScalar iX) const
 Get the second derivative of data value that corresponds with constrol value iX.
const TData integral (TScalar iA, TScalar iB) const
 Get the integrated data value between control points iA and iB.
const bool isEmpty () const
 return true if the spline contains any nodes at all.
const TControlRange controlRange () const
 return the range of control values for which the spline can interpolate.
virtual const TData operator() (TScalar iX) const =0
virtual const TData derivative (TScalar iX) const =0
virtual const TData derivative2 (TScalar iX) const =0
virtual const TData integral (TScalar iA, TScalar iB) const =0

Private Types

typedef std::vector< NodeTNodes
typedef TNodes::const_iterator TNodeConstIterator

Private Member Functions

void init ()
const TNodeConstIterator findNode (TScalar iX) const
 binary search to find node that belongs to iX

Private Attributes

TNodes nodes_
size_t dataDimension_

Detailed Description

template<typename ScalarType, typename DataType, typename DataTraits>
class lass::num::SplineCubic< ScalarType, DataType, DataTraits >

Definition at line 67 of file spline_cubic.h.


Member Typedef Documentation

template<typename ScalarType , typename DataType , typename DataTraits >
typedef DataTraits lass::num::SplineCubic< ScalarType, DataType, DataTraits >::TDataTraits

Definition at line 71 of file spline_cubic.h.

template<typename ScalarType , typename DataType , typename DataTraits >
typedef Spline<ScalarType, DataType> lass::num::SplineCubic< ScalarType, DataType, DataTraits >::TSplineBase

Definition at line 72 of file spline_cubic.h.

template<typename ScalarType , typename DataType , typename DataTraits >
typedef TSplineBase::TScalar lass::num::SplineCubic< ScalarType, DataType, DataTraits >::TScalar

Reimplemented from lass::num::Spline< ScalarType, DataType >.

Definition at line 73 of file spline_cubic.h.

template<typename ScalarType , typename DataType , typename DataTraits >
typedef TSplineBase::TData lass::num::SplineCubic< ScalarType, DataType, DataTraits >::TData

Reimplemented from lass::num::Spline< ScalarType, DataType >.

Definition at line 74 of file spline_cubic.h.

template<typename ScalarType , typename DataType , typename DataTraits >
typedef TSplineBase::ControlRange lass::num::SplineCubic< ScalarType, DataType, DataTraits >::TControlRange

Definition at line 75 of file spline_cubic.h.

template<typename ScalarType , typename DataType , typename DataTraits >
typedef std::vector<Node> lass::num::SplineCubic< ScalarType, DataType, DataTraits >::TNodes [private]

Definition at line 103 of file spline_cubic.h.

template<typename ScalarType , typename DataType , typename DataTraits >
typedef TNodes::const_iterator lass::num::SplineCubic< ScalarType, DataType, DataTraits >::TNodeConstIterator [private]

Definition at line 104 of file spline_cubic.h.


Constructor & Destructor Documentation

template<typename S , typename D , typename T >
lass::num::SplineCubic< S, D, T >::SplineCubic (  )  [inline]

construct an empty spline

Definition at line 63 of file spline_cubic.inl.

template<typename S , typename D , typename T >
template<typename PairInputIterator >
lass::num::SplineCubic< S, D, T >::SplineCubic ( PairInputIterator  iFirst,
PairInputIterator  iLast 
) [inline]

construct a spline from a range of control/data pairs.

Each node consists of a control value and a data value. This contstructor accepts a single range [iFirst, iLast) of control/data pairs. The iterator type should have two fields first and second that contain respectively the control and data values. This is choosen so that a std::pair can be used as a representatin of the control/data pair.

Precondition:
  • [iFirst, iLast) is a valid range.
  • PairInputIterator has a member first containing the control value
  • PairInputIterator has a member second containing the data value
complexity:
O(D * log(N)) with
  • D = a figure that indicates the complexity of operations on data values. Is most probably linear with the dimension of the data value
  • N = number of nodes

Definition at line 89 of file spline_cubic.inl.

References lass::num::SplineCubic< ScalarType, DataType, DataTraits >::Node::d, lass::num::SplineCubic< ScalarType, DataType, DataTraits >::init(), lass::num::SplineCubic< ScalarType, DataType, DataTraits >::nodes_, and lass::num::SplineCubic< ScalarType, DataType, DataTraits >::Node::x.

template<typename S , typename D , typename T >
template<typename ScalarInputIterator , typename DataInputIterator >
lass::num::SplineCubic< S, D, T >::SplineCubic ( ScalarInputIterator  iFirstControl,
ScalarInputIterator  iLastControl,
DataInputIterator  iFirstData 
) [inline]

construct a spline from seperate ranges.

Each node consists of a control value and a data value. This contstructor accepts seperate ranges for control and data values. The control values are given by the range [iFirstControl , iLastControl). Of the range of the data values, only the iterator iFirstData to the the first element is given.

Precondition:
  • [iFirstControl, iLastControl) is a valid range.
  • [iFirstData, iFirstData + (iLastControl - iFirstControl)) is a valid range.
complexity:
O(D * log(N)) with
  • D = a figure that indicates the complexity of operations on data values. Is most probably linear with the dimension of the data value
  • N = number of nodes

Definition at line 123 of file spline_cubic.inl.

References lass::num::SplineCubic< ScalarType, DataType, DataTraits >::Node::d, lass::num::SplineCubic< ScalarType, DataType, DataTraits >::init(), lass::num::SplineCubic< ScalarType, DataType, DataTraits >::nodes_, and lass::num::SplineCubic< ScalarType, DataType, DataTraits >::Node::x.


Member Function Documentation

template<typename S , typename D , typename T >
const SplineCubic< S, D, T >::TData lass::num::SplineCubic< S, D, T >::operator() ( TScalar  iX  )  const [inline]

Get the linear interpolated data value that corresponds with constrol value iX.

Precondition:
this->isEmpty() == false
Complexity:
O(D * log(N)) with
  • D = a figure that indicates the complexity of operations on data values. Is most probably linear with the dimension of the data value
  • N = number of nodes

Definition at line 151 of file spline_cubic.inl.

References lass::num::cubic(), lass::num::SplineCubic< ScalarType, DataType, DataTraits >::findNode(), lass::num::SplineCubic< ScalarType, DataType, DataTraits >::isEmpty(), LASS_ASSERT, and lass::num::sqr().

template<typename S , typename D , typename T >
const SplineCubic< S, D, T >::TData lass::num::SplineCubic< S, D, T >::derivative ( TScalar  iX  )  const [inline]

Get the first derivative of data value that corresponds with constrol value iX.

Precondition:
this->isEmpty() == false
Complexity:
O(D * log(N)) with
  • D = a figure that indicates the complexity of operations on data values. Is most probably linear with the dimension of the data value
  • N = number of nodes

Definition at line 178 of file spline_cubic.inl.

References lass::num::SplineCubic< ScalarType, DataType, DataTraits >::findNode(), lass::num::SplineCubic< ScalarType, DataType, DataTraits >::isEmpty(), LASS_ASSERT, and lass::num::sqr().

template<typename S , typename D , typename T >
const SplineCubic< S, D, T >::TData lass::num::SplineCubic< S, D, T >::derivative2 ( TScalar  iX  )  const [inline]

Get the second derivative of data value that corresponds with constrol value iX.

Precondition:
this->isEmpty() == false
Complexity:
O(D * log(N)) with
  • D = a figure that indicates the complexity of operations on data values. Is most probably linear with the dimension of the data value
  • N = number of nodes

Definition at line 204 of file spline_cubic.inl.

References lass::num::SplineCubic< ScalarType, DataType, DataTraits >::findNode(), lass::num::SplineCubic< ScalarType, DataType, DataTraits >::isEmpty(), and LASS_ASSERT.

template<typename S , typename D , typename T >
const SplineCubic< S, D, T >::TData lass::num::SplineCubic< S, D, T >::integral ( TScalar  iBegin,
TScalar  iEnd 
) const [inline]

Get the integrated data value between control points iA and iB.

Precondition:
this->isEmpty() == false
Complexity:
O(D * M * log(N)) with
  • D = a figure that indicates the complexity of operations on data values. Is most probably linear with the dimension of the data value
  • M = number of nodes between iA and iB.
  • N = total number of nodes in spline

Definition at line 230 of file spline_cubic.inl.

References lass::num::cubic(), lass::num::SplineCubic< ScalarType, DataType, DataTraits >::findNode(), lass::num::SplineCubic< ScalarType, DataType, DataTraits >::isEmpty(), LASS_ASSERT, lass::stde::next(), lass::num::sqr(), and std::swap().

template<typename S , typename D , typename T >
const bool lass::num::SplineCubic< S, D, T >::isEmpty (  )  const [inline, virtual]

template<typename S , typename D , typename T >
const SplineCubic< S, D, T >::TControlRange lass::num::SplineCubic< S, D, T >::controlRange (  )  const [inline, virtual]

return the range of control values for which the spline can interpolate.

complexity:
O(1)

Implements lass::num::Spline< ScalarType, DataType >.

Definition at line 310 of file spline_cubic.inl.

References lass::num::SplineCubic< ScalarType, DataType, DataTraits >::nodes_.

template<typename S , typename D , typename T >
void lass::num::SplineCubic< S, D, T >::init (  )  [inline, private]

template<typename S , typename D , typename T >
const SplineCubic< S, D, T >::TNodeConstIterator lass::num::SplineCubic< S, D, T >::findNode ( TScalar  iX  )  const [inline, private]

binary search to find node that belongs to iX

Returns:
  • the index i if iX is in the interval [nodes_[i].x, nodes_[i+1].x)
  • 0 if iX is smaller than nodes_[0].x
  • nodes_.size()-2 if iX is greater than nodes_[nodes_.size()-1].x
complexity:
O(log N)

Definition at line 447 of file spline_cubic.inl.

References lass::prim::distance(), LASS_ASSERT, lass::stde::next(), lass::num::SplineCubic< ScalarType, DataType, DataTraits >::nodes_, and lass::stde::prev().

Referenced by lass::num::SplineCubic< ScalarType, DataType, DataTraits >::derivative(), lass::num::SplineCubic< ScalarType, DataType, DataTraits >::derivative2(), lass::num::SplineCubic< ScalarType, DataType, DataTraits >::integral(), and lass::num::SplineCubic< ScalarType, DataType, DataTraits >::operator()().

template<typename ScalarType , typename DataType >
virtual const TData lass::num::Spline< ScalarType, DataType >::operator() ( TScalar  iX  )  const [pure virtual, inherited]

template<typename ScalarType , typename DataType >
virtual const TData lass::num::Spline< ScalarType, DataType >::derivative ( TScalar  iX  )  const [pure virtual, inherited]

template<typename ScalarType , typename DataType >
virtual const TData lass::num::Spline< ScalarType, DataType >::derivative2 ( TScalar  iX  )  const [pure virtual, inherited]

template<typename ScalarType , typename DataType >
virtual const TData lass::num::Spline< ScalarType, DataType >::integral ( TScalar  iA,
TScalar  iB 
) const [pure virtual, inherited]


Field Documentation

template<typename ScalarType , typename DataType , typename DataTraits >
TNodes lass::num::SplineCubic< ScalarType, DataType, DataTraits >::nodes_ [private]

template<typename ScalarType , typename DataType , typename DataTraits >
size_t lass::num::SplineCubic< ScalarType, DataType, DataTraits >::dataDimension_ [private]


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

Generated on Mon Nov 10 14:22:10 2008 for Library of Assembled Shared Sources by doxygen 1.5.7.1
SourceForge.net Logo