BornAgain  1.19.79
Open-source research software to simulate and fit neutron and x-ray reflectometry and grazing-incidence small-angle scattering
ROOT::Minuit2::ParametricFunction Class Referenceabstract

Description

Function which has parameters. For example, one could define a one-dimensional Gaussian, by considering x as an input coordinate for the evaluation of the function, and the mean and the square root of the variance as parameters.

AS OF NOW PARAMETRICFUNCTION INHERITS FROM FCNBASE INSTEAD OF GENERICFUNCTION. THIS IS ONLY BECAUSE NUMERICAL2PGRADIENTCALCULATOR NEEDS AN FCNBASE OBJECT AND WILL BE CHANGED!!!!!!!!!!!!!!!!

Todo:
ParametricFunction and all the classes that inherit from it are inheriting also FCNBase so that the Gradient calculation has the Up() member function. That is not really good...

Definition at line 45 of file ParametricFunction.h.

Inheritance diagram for ROOT::Minuit2::ParametricFunction:
[legend]
Collaboration diagram for ROOT::Minuit2::ParametricFunction:
[legend]

Public Member Functions

 ParametricFunction (const std::vector< double > &params)
 
 ParametricFunction (int nparams)
 
virtual ~ParametricFunction ()
 
virtual double ErrorDef () const
 
virtual std::vector< double > GetGradient (const std::vector< double > &x) const
 
virtual const std::vector< double > & GetParameters () const
 
virtual unsigned int NumberOfParameters () const
 
virtual double operator() (const std::vector< double > &x) const =0
 
virtual double operator() (const std::vector< double > &x, const std::vector< double > &params) const
 
virtual void SetErrorDef (double)
 
virtual void SetParameters (const std::vector< double > &params) const
 
virtual double Up () const =0
 

Protected Attributes

std::vector< double > par
 

Constructor & Destructor Documentation

◆ ParametricFunction() [1/2]

ROOT::Minuit2::ParametricFunction::ParametricFunction ( const std::vector< double > &  params)
inline

Constructor which initializes the ParametricFunction with the parameters given as input.

Parameters
paramsvector containing the initial Parameter values

Definition at line 59 of file ParametricFunction.h.

59 : par(params) {}

◆ ParametricFunction() [2/2]

ROOT::Minuit2::ParametricFunction::ParametricFunction ( int  nparams)
inline

Constructor which initializes the ParametricFunction by setting the number of parameters.

Parameters
nparamsnumber of parameters of the parametric function

Definition at line 72 of file ParametricFunction.h.

72 : par(nparams) {}

◆ ~ParametricFunction()

virtual ROOT::Minuit2::ParametricFunction::~ParametricFunction ( )
inlinevirtual

Definition at line 76 of file ParametricFunction.h.

76 {}

Member Function Documentation

◆ ErrorDef()

virtual double ROOT::Minuit2::FCNBase::ErrorDef ( ) const
inlinevirtualinherited

Error definition of the function. MINUIT defines Parameter errors as the change in Parameter Value required to change the function Value by up. Normally, for chisquared fits it is 1, and for negative log likelihood, its Value is 0.5. If the user wants instead the 2-sigma errors for chisquared fits, it becomes 4, as Chi2(x+n*sigma) = Chi2(x) + n*n.

Comment a little bit better with links!!!!!!!!!!!!!!!!!

Definition at line 93 of file FCNBase.h.

93 {return Up();}
virtual double Up() const =0

References ROOT::Minuit2::FCNBase::Up().

Here is the call graph for this function:

◆ GetGradient()

virtual std::vector<double> ROOT::Minuit2::ParametricFunction::GetGradient ( const std::vector< double > &  x) const
virtual

Member function returning the Gradient of the function with respect to its variables (but without including gradients with respect to its internal parameters).

Parameters
xvector containing the coordinates of the point where the Gradient is to be calculated.
Returns
the Gradient vector of the function at the given point.

◆ GetParameters()

virtual const std::vector<double>& ROOT::Minuit2::ParametricFunction::GetParameters ( ) const
inlinevirtual

Accessor for the state of the parameters.

Returns
vector containing the present Parameter settings

Definition at line 105 of file ParametricFunction.h.

105 { return par; }

References par.

◆ NumberOfParameters()

virtual unsigned int ROOT::Minuit2::ParametricFunction::NumberOfParameters ( ) const
inlinevirtual

Accessor for the number of parameters.

Returns
the number of function parameters

Definition at line 117 of file ParametricFunction.h.

117 { return par.size(); }

References par.

◆ operator()() [1/2]

virtual double ROOT::Minuit2::ParametricFunction::operator() ( const std::vector< double > &  x) const
pure virtual

Evaluates the function with the given coordinates.

Parameters
xvector containing the input coordinates
Returns
the result of the function evaluation with the given coordinates.

Implements ROOT::Minuit2::FCNBase.

Referenced by operator()().

◆ operator()() [2/2]

virtual double ROOT::Minuit2::ParametricFunction::operator() ( const std::vector< double > &  x,
const std::vector< double > &  params 
) const
inlinevirtual

Evaluates the function with the given coordinates and Parameter values. This member function is useful to implement when speed is an issue as it is faster to call only one function instead of two (SetParameters and operator()). The default implementation, provided for convenience, does the latter.

Parameters
xvector containing the input coordinates
paramsvector containing the Parameter values
Returns
the result of the function evaluation with the given coordinates and parameters

Definition at line 154 of file ParametricFunction.h.

154  {
155  SetParameters(params);
156  return operator()(x);
157 
158  }
virtual void SetParameters(const std::vector< double > &params) const
virtual double operator()(const std::vector< double > &x) const =0

References operator()(), and SetParameters().

Here is the call graph for this function:

◆ SetErrorDef()

virtual void ROOT::Minuit2::FCNBase::SetErrorDef ( double  )
inlinevirtualinherited

add interface to set dynamically a new error definition Re-implement this function if needed.

Reimplemented in ROOT::Minuit2::FumiliFCNAdapter< Function >, and ROOT::Minuit2::FCNAdapter< Function >.

Definition at line 114 of file FCNBase.h.

114 {};

◆ SetParameters()

virtual void ROOT::Minuit2::ParametricFunction::SetParameters ( const std::vector< double > &  params) const
inlinevirtual

Sets the parameters of the ParametricFunction.

Parameters
paramsvector containing the Parameter values

Definition at line 88 of file ParametricFunction.h.

88  {
89 
90  assert(params.size() == par.size());
91  par = params;
92 
93  }

References par.

Referenced by operator()().

◆ Up()

virtual double ROOT::Minuit2::FCNBase::Up ( ) const
pure virtualinherited

Error definition of the function. MINUIT defines Parameter errors as the change in Parameter Value required to change the function Value by up. Normally, for chisquared fits it is 1, and for negative log likelihood, its Value is 0.5. If the user wants instead the 2-sigma errors for chisquared fits, it becomes 4, as Chi2(x+n*sigma) = Chi2(x) + n*n.

Todo:
Comment a little bit better with links!!!!!!!!!!!!!!!!! Idem for ErrorDef()

Implemented in ROOT::Minuit2::FumiliMaximumLikelihoodFCN, ROOT::Minuit2::FumiliFCNAdapter< Function >, ROOT::Minuit2::FumiliChi2FCN, ROOT::Minuit2::FCNGradAdapter< Function >, and ROOT::Minuit2::FCNAdapter< Function >.

Referenced by ROOT::Minuit2::FCNBase::ErrorDef().

Member Data Documentation

◆ par

std::vector<double> ROOT::Minuit2::ParametricFunction::par
mutableprotected

The vector containing the parameters of the function It is mutable for "historical reasons" as in the hierarchy methods and classes are const and all the implications of changing them back to non-const are not clear.

Definition at line 191 of file ParametricFunction.h.

Referenced by GetParameters(), NumberOfParameters(), and SetParameters().


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