The Fib multimedia system
Fib is a system for storing multimedia data (like images or films).
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
fib::algorithms::nD1::cSpline< tX, tY > Class Template Reference

#include <cSpline.h>

Inheritance diagram for fib::algorithms::nD1::cSpline< tX, tY >:
Collaboration diagram for fib::algorithms::nD1::cSpline< tX, tY >:

List of all members.

Public Member Functions

 cSpline ()
virtual tY evalue (const tX &x) const
virtual void print (ostream &outputStream) const
virtual pair< unsigned long, tY > evalueError (const vector< cDataPoint< tX, tY > > &vecInputData) const
virtual tY evalueErrorMax (const vector< cDataPoint< tX, tY > > &vecData, const tY maxYError) const
virtual pair< unsigned long, tY > evalueError (const vector< cDataPointRange< tX, tY > > &vecInputData) const
virtual tY evalueErrorMax (const vector< cDataPointRange< tX, tY > > &vecData, const tY maxYError) const
virtual cUnderFunctiontoFibUnderFunction (cFibVariable *pVariable) const
virtual bool evalue (const vector< cDataPoint< tX, tY > > &vecData)
virtual unsigned long evalueSpline (const vector< cDataPointRange< tX, tY > > &vecInputData, unsigned int uiMaxNumberOfParameters=4, const unsigned int uiMinBitsToStoreMantissa=1, const tY maxValue=1E+36, const tY maxError=0, const unsigned long ulMaxMemoryCost=0)
virtual bool operator== (const cSpline< tX, tY > &spline) const
virtual bool operator!= (const cSpline< tX, tY > &spline) const
const vector< cPolynom< tX, tY > > * getPolynoms () const
const vector< tY > * getBorders () const

Protected Member Functions

cUnderFunctiongenerateSubfunctionTree (const vector< const cPolynom< tX, tY > * > &vecInPolynoms, const vector< tY > &vecInBorders, cFibVariable *pVariable) const

Protected Attributes

vector< cPolynom< tX, tY > > vecPolynoms
vector< tY > vecBorders

Detailed Description

template<class tX, class tY>
class fib::algorithms::nD1::cSpline< tX, tY >

Definition at line 67 of file cSpline.h.


Constructor & Destructor Documentation

template<class tX, class tY>
fib::algorithms::nD1::cSpline< tX, tY >::cSpline ( )

Standartconstructor


Member Function Documentation

template<class tX, class tY>
virtual tY fib::algorithms::nD1::cSpline< tX, tY >::evalue ( const tX &  x) const
virtual

This method evalues the value of this spline. For this the polynom in which borders the value is will be evalued.

See also:
vecPolynoms
vecBorders
cPolynom::evalue()
Parameters:
xthe input value for the spline
Returns:
the evalued value f( x )

Implements fib::algorithms::nD1::cOneAryFunction< tX, tY >.

template<class tX, class tY>
virtual bool fib::algorithms::nD1::cSpline< tX, tY >::evalue ( const vector< cDataPoint< tX, tY > > &  vecData)
virtual

This function evalues the function for the given data. The evalued function will have the order n of the number of given datapoints. It will call

See also:
cPolynom::evalue( vecData ) and add the created polynom.
Parameters:
vecDatathe data for which to evalue the function
Returns:
if the function for the datapoints could be evalued: the elements of the evalued function in this function and true, else false and the elements of this function not changed

Implements fib::algorithms::nD1::cOneAryFunction< tX, tY >.

template<class tX, class tY>
virtual pair<unsigned long, tY> fib::algorithms::nD1::cSpline< tX, tY >::evalueError ( const vector< cDataPoint< tX, tY > > &  vecInputData) const
virtual

This method evalues the error of the given datapoints to the values this spline evalues to.

The evaluation of the spline will be done by evalue(). The error will just be counted, if it is greater than the SAVE_BOUNDERY.

See also:
evalue()
Parameters:
vecInputDatathe data for wich the error is to evalue
Returns:
a pair with two values:
  • the first value is the number of datapoints evalued wrong
  • the second value is the sum of the error of all datapoints

Implements fib::algorithms::nD1::cOneAryFunction< tX, tY >.

template<class tX, class tY>
virtual pair<unsigned long, tY> fib::algorithms::nD1::cSpline< tX, tY >::evalueError ( const vector< cDataPointRange< tX, tY > > &  vecInputData) const
virtual

This method evalues the error of the given range datapoints to the values this spline evalues to.

The evaluation of the spline will be done by evalue(). A datapoint has an error, if it lay outside the datpoint range. The error is it's distance to the neares datapoint boundery. The error will just be counted, if it is greater than the SAVE_BOUNDERY.

See also:
evalue()
Parameters:
vecInputDatathe data for wich the error is to evalue
Returns:
a pair with two values:
  • the first value is the number of datapoints evalued wrong
  • the second value is the sum of the error of all datapoints

Implements fib::algorithms::nD1::cOneAryFunction< tX, tY >.

template<class tX, class tY>
virtual tY fib::algorithms::nD1::cSpline< tX, tY >::evalueErrorMax ( const vector< cDataPoint< tX, tY > > &  vecData,
const tY  maxYError 
) const
virtual

This method evalues the error of the given datapoints to the values this spline evalues to. This function will stop the evaluation, if the maximum error maxYError was reached.

The evaluation of the spline will be done by evalue(). The error will just be counted, if it is greater than the SAVE_BOUNDERY.

See also:
evalue()
Parameters:
vecInputDatathe data for wich the error is to evalue
maxYErrorthe maximum error, at which the evaluation should stop; if maxYError is 0 the maximum error is unlimeted
Returns:
the sum of the error of all datapoints, but maximal maxYError

Implements fib::algorithms::nD1::cOneAryFunction< tX, tY >.

template<class tX, class tY>
virtual tY fib::algorithms::nD1::cSpline< tX, tY >::evalueErrorMax ( const vector< cDataPointRange< tX, tY > > &  vecData,
const tY  maxYError 
) const
virtual

This method evalues the error of the given datapoints to the values this spline evalues to. This function will stop the evaluation, if the maximum error maxYError was reached.

The evaluation of the spline will be done by evalue(). A datapoint has an error, if it lay outside the datpoint range. The error is it's distance to the neares datapoint boundery. The error will just be counted, if it is greater than the SAVE_BOUNDERY.

See also:
evalue()
Parameters:
vecInputDatathe data for wich the error is to evalue
maxYErrorthe maximum error, at which the evaluation should stop; if maxYError is 0 the maximum error is unlimeted
Returns:
the sum of the error of all datapoints, but maximal maxYError

Implements fib::algorithms::nD1::cOneAryFunction< tX, tY >.

template<class tX, class tY>
virtual unsigned long fib::algorithms::nD1::cSpline< tX, tY >::evalueSpline ( const vector< cDataPointRange< tX, tY > > &  vecInputData,
unsigned int  uiMaxNumberOfParameters = 4,
const unsigned int  uiMinBitsToStoreMantissa = 1,
const tY  maxValue = 1E+36,
const tY  maxError = 0,
const unsigned long  ulMaxMemoryCost = 0 
)
virtual

This functions evalues a spline, which matches all points of the given range data vecData (if possible). The y value, to wich the spline evalues the x value, will be in the bound of the range data point, so that: vecData[i].minY <= spline( vecData[i].x ) + error_i <= vecData[i].maxY, with maxError <= sum error_i for i = 0 till vecData.size()

The evalued spline (this spline) consists of a number of polynoms seperated by border points. The evalued polynoms (

See also:
cPolynom) will have the form: y = vecFactors[ 0 ] + vecFactors[ 1 ] * x + vecFactors[ 2 ] * x^2 + ... + vecFactors[ uiNumberOfParameters - 1 ] * x^(uiNumberOfParameters - 1) The upper border point of a polynom is the first point at wich the polynom dosn't match the given data vecData anymore.

The method will iterativ increase the number of parameters for the polynoms (from 1 to uiMaxNumberOfParameters) and will try to not use all of the given range points to find the polynoms.

See also:
evalue()
cPolynom::evalueSplineIterativFast()
Parameters:
vecInputDatathe data which the returend spline should match
uiMaxNumberOfParametersthe number of parameters for the spline; Don't choose this number to big, because the evaluation time will grow exponentialy with this number. Even splines with 8 parameters will take some time.
uiMinBitsToStoreMantissathe minimal number of bits to store the mantissa of the parameters, when the parameter is in the form: mantissa * 2^exponent ; the method will try to reduce the bits, to store a parameter of the returned vector, to the uiMinBitsToStoreMantissa value; if uiMinBitsToStoreMantissa is 0, no optimization for the mantissa bits will be done
maxValuethe maximum possible value in all parameters the evalued spline will allways have parameters vecFactors[i] with -1 * maxValue <= vecFactors[i] <= maxValue for 0 <= i < vecFactors.size()
maxErrorthe maximal error for the spline to find; the error on the interpolated spline for vecData will be equal or less than maxError
ulMaxMemoryCosta number for the maximum memory cost this method is allowed to use; if 0 the maximum memory cost is unbounded
Returns:
the number n of data points vecData, which the spline matches; the data points vecData[0] to vecData[ return - 1 ] will be matched by the spline
template<class tX, class tY>
cUnderFunction* fib::algorithms::nD1::cSpline< tX, tY >::generateSubfunctionTree ( const vector< const cPolynom< tX, tY > * > &  vecInPolynoms,
const vector< tY > &  vecInBorders,
cFibVariable pVariable 
) const
protected

This function generates an subfunction for the given part spline as an balanced tree of if subfunctions.

Parameters:
vecInPolynomsthe vector with the polynoms for the splines
See also:
vecPolynoms
Parameters:
vecInBordersthe vector with the borders for the splines
See also:
vecBorders
Parameters:
pVariablethe variable (x) for the spline
Returns:
the subfunction for the given spline
template<class tX, class tY>
const vector< tY >* fib::algorithms::nD1::cSpline< tX, tY >::getBorders ( ) const
Returns:
the a const pointer to the vector with the borders of this spline (
See also:
vecBorders)
template<class tX, class tY>
const vector< cPolynom< tX, tY> >* fib::algorithms::nD1::cSpline< tX, tY >::getPolynoms ( ) const
Returns:
the a const pointer to the vector with the polynoms of this spline (
See also:
vecPolynoms)
template<class tX, class tY>
virtual bool fib::algorithms::nD1::cSpline< tX, tY >::operator!= ( const cSpline< tX, tY > &  spline) const
virtual
Parameters:
dataPointthe spline to compare this spline with
Returns:
true if the given spline is not equal to this, else false (
See also:
x,
y)
template<class tX, class tY>
virtual bool fib::algorithms::nD1::cSpline< tX, tY >::operator== ( const cSpline< tX, tY > &  spline) const
virtual
Parameters:
dataPointthe spline to compare this spline with
Returns:
true if the given spline is equal to this, else false (
See also:
x,
y)
template<class tX, class tY>
virtual void fib::algorithms::nD1::cSpline< tX, tY >::print ( ostream &  outputStream) const
virtual

This method prints this spline to the given stream.

Parameters:
outputStreamthe stream wher to print this spline to

Implements fib::algorithms::nD1::cOneAryFunction< tX, tY >.

template<class tX, class tY>
virtual cUnderFunction* fib::algorithms::nD1::cSpline< tX, tY >::toFibUnderFunction ( cFibVariable pVariable) const
virtual

This method converts this spline, into an fib-underfunction. Beware: You have to delete the returned fib-underfunction.

Parameters:
pVariablethe variable (x) for the spline
Returns:
a pointer to the fib-underfunction, wich represents the same spline as this spline

Implements fib::algorithms::nD1::cOneAryFunction< tX, tY >.


Member Data Documentation

template<class tX, class tY>
vector< tY > fib::algorithms::nD1::cSpline< tX, tY >::vecBorders
protected

The the borders for the polynoms of the spline. The interpolate the function betwean ther borders. The i'th polynom vecPolynoms[ i ] interpolats the function betwaen the border i - 1 vecBorders[ i-1 ] (inclusive it) to border i vecBorders[ i ] (exclusive it). The first and last polynom are unbound. So ther have to be one border less as ther are splines. All borders have to be sorted in increasing order. vecBorders[ i ] < vecBorders[ i + 1 ]

See also:
vecPolynoms
evalue()

Definition at line 101 of file cSpline.h.

template<class tX, class tY>
vector< cPolynom< tX, tY> > fib::algorithms::nD1::cSpline< tX, tY >::vecPolynoms
protected

The the polynomes of the spline. The interpolate the function betwean ther borders. The i'th polynom vecPolynoms[ i ] interpolats the function betwaen the border i - 1 vecBorders[ i-1 ] (inclusive it) to border i vecBorders[ i ] (exclusive it). The first and last polynom are unbound. So ther have to be one border less as ther are splines.

See also:
cPolynom
vecBorders
evalue()

Definition at line 86 of file cSpline.h.


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