Library of Assembled Shared Sources
lass::num::SplineLinear< ScalarType, DataType, DataTraits > Class Template Reference

connects the data nodes with linear segments. More...

#include <spline_linear.h>

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

Public Member Functions

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

Detailed Description

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

connects the data nodes with linear segments.

Author
Bram de Greve [BdG]

Definition at line 67 of file spline_linear.h.

Constructor & Destructor Documentation

◆ SplineLinear() [1/2]

template<typename S, typename D, typename T>
template<typename PairInputIterator>
lass::num::SplineLinear< S, D, T >::SplineLinear ( PairInputIterator iFirst,
PairInputIterator iLast )

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 86 of file spline_linear.inl.

◆ SplineLinear() [2/2]

template<typename S, typename D, typename T>
template<typename ScalarInputIterator, typename DataInputIterator>
lass::num::SplineLinear< S, D, T >::SplineLinear ( ScalarInputIterator iFirstControl,
ScalarInputIterator iLastControl,
DataInputIterator iFirstData )

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 121 of file spline_linear.inl.

Member Function Documentation

◆ operator()()

template<typename S, typename D, typename T>
const SplineLinear< S, D, T >::TData lass::num::SplineLinear< S, D, T >::operator() ( TScalar iX) const
overridevirtual

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

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

Definition at line 149 of file spline_linear.inl.

References isEmpty().

◆ derivative()

template<typename S, typename D, typename T>
const SplineLinear< S, D, T >::TData lass::num::SplineLinear< S, D, T >::derivative ( TScalar iX) const
overridevirtual

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

As long as iX is exact on a node, it equals to lim_{dx->0} (*this(iX + dx) - *this(iX)) / dx. With linear splines, in theory the first derivative does not exist on the nodes. This function however will return the first derivative on the right of the node. *

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

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

Definition at line 179 of file spline_linear.inl.

References isEmpty().

◆ integral()

template<typename S, typename D, typename T>
const SplineLinear< S, D, T >::TData lass::num::SplineLinear< S, D, T >::integral ( TScalar iBegin,
TScalar iEnd ) const
overridevirtual

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

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

Definition at line 227 of file spline_linear.inl.

References isEmpty(), and lass::num::sqr().

◆ isEmpty()

template<typename S, typename D, typename T>
bool lass::num::SplineLinear< S, D, T >::isEmpty ( ) const
overridevirtual

return true if the spline contains any nodes at all.

complexity:
O(1)

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

Definition at line 283 of file spline_linear.inl.

Referenced by derivative(), integral(), and operator()().

◆ controlRange()

template<typename S, typename D, typename T>
const SplineLinear< S, D, T >::TControlRange lass::num::SplineLinear< S, D, T >::controlRange ( ) const
overridevirtual

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

complexity:
O(1)

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

Definition at line 296 of file spline_linear.inl.


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