ModelFunction Class Reference
[Classes of the ODIN data processing framework (odindata library)]

#include <fitting.h>

Inheritance diagram for ModelFunction:

Inheritance graph
[legend]
Collaboration diagram for ModelFunction:

Collaboration graph
[legend]
List of all members.

Public Member Functions

virtual float evaluate_f (float x) const=0
virtual fvector evaluate_df (float x) const=0
virtual unsigned int numof_fitpars () const=0
virtual fitparget_fitpar (unsigned int i)=0
bool fit (const Array< float, 1 > &yvals, const Array< float, 1 > &ysigma=defaultArray, const Array< float, 1 > &xvals=defaultArray, unsigned int max_iterations=500, double tolerance=1.0e-4)
Array< float, 1 > get_function (const Array< float, 1 > &xvals) const

Static Public Attributes

static const Array< float, 1 > defaultArray

Protected Member Functions

 ModelFunction ()
virtual ~ModelFunction ()

Protected Attributes

fitpar dummy_fitpar

Detailed Description

Base class of all multi-dimensional function classes which are used for fitting. The function has an independent variable 'x' (the argument to evaluate_f), a dependent variable 'y' (the result of evaluate_f) and a number of function parameters. To use this class, derive from it and overload the virtual functions 'evaluate_f' (function value), 'evaluate_df' (first derivative), 'numof_fitpars', and 'get_fitpar'. Parameters which are modified during the fit should be members of type fitpar.

Definition at line 64 of file fitting.h.


Member Function Documentation

virtual float ModelFunction::evaluate_f ( float  x  )  const [pure virtual]

Returns the function value at position 'x'.

Implemented in ExponentialFunction, ExponentialFunctionWithOffset, GaussianFunction, and SinusFunction.

virtual fvector ModelFunction::evaluate_df ( float  x  )  const [pure virtual]

Returns the first derivatives at position 'x'.

Implemented in ExponentialFunction, ExponentialFunctionWithOffset, GaussianFunction, and SinusFunction.

virtual unsigned int ModelFunction::numof_fitpars (  )  const [pure virtual]

Returns the number of independent fitting parameters.

Implemented in ExponentialFunction, ExponentialFunctionWithOffset, GaussianFunction, and SinusFunction.

virtual fitpar& ModelFunction::get_fitpar ( unsigned int  i  )  [pure virtual]

Returns reference to the i'th fitting parameter.

Implemented in ExponentialFunction, ExponentialFunctionWithOffset, GaussianFunction, and SinusFunction.

bool ModelFunction::fit ( const Array< float, 1 > &  yvals,
const Array< float, 1 > &  ysigma = defaultArray,
const Array< float, 1 > &  xvals = defaultArray,
unsigned int  max_iterations = 500,
double  tolerance = 1.0e-4 
)

Fit the function to the given dataset. The current parameters are taken as starting values. Fits the function to the y-values 'yvals', and optionally to the corresponding y-error bars 'ysigma' and x-vals 'xvals'. If no error-bars are given, they are all set to 0.1 and if no x-vals are given equidistant points with an increment of one are chosen, i.e. xvals(i)=i; A maximum of 'max_iterations' iterations and the given 'tolerance' is used for the fit. Returns true on success.

Array<float,1> ModelFunction::get_function ( const Array< float, 1 > &  xvals  )  const

Returns the function values for x-values 'xvals'.


The documentation for this class was generated from the following file:
Generated on Sat Jun 14 12:31:46 2008 by  doxygen 1.5.1