BornAgain
1.19.79
Open-source research software to simulate and fit neutron and x-ray reflectometry and grazing-incidence small-angle scattering
|
WrappedParamGenFunction class to wrap any multi-dimensional function implementing the operator()(const double * ) in an interface-like IParamFunction, by fixing some of the variables and define them as parameters. i.e. transform any multi-dim function in a parametric function
Definition at line 140 of file WrappedParamFunction.h.
Public Types | |
typedef T | BackendType |
typedef IBaseFunctionMultiDimTempl< double > | BaseFunc |
Public Member Functions | |
WrappedParamFunctionGen (const FuncPtr &func, unsigned int dim, unsigned int npar, const double *par, const unsigned int *idx) | |
WrappedParamFunctionGen (FuncPtr &func, unsigned int dim, unsigned int npar, const double *par, const unsigned int *idx) | |
IMultiGenFunction * | Clone () const |
clone the function More... | |
unsigned int | NDim () const |
unsigned int | NPar () const |
double | operator() (const double *x) const |
double | operator() (const double *x, const double *p) const |
T | operator() (const T *x) const |
virtual std::string | ParameterName (unsigned int i) const |
const double * | Parameters () const |
void | SetParameters (const double *p) |
Private Member Functions | |
WrappedParamFunctionGen (const WrappedParamFunctionGen &) | |
double | DoEval (const double *x) const |
evaluate the function (re-implement for being more efficient) More... | |
double | DoEvalPar (const double *x, const double *p) const |
void | DoInit () |
WrappedParamFunctionGen & | operator= (const WrappedParamFunctionGen &) |
void | SetParValues (unsigned int npar, const double *p) const |
Private Attributes | |
unsigned int | fDim |
FuncPtr | fFunc |
std::vector< double > | fParams |
std::vector< unsigned int > | fParIndices |
std::vector< unsigned int > | fVarIndices |
std::vector< double > | fX |
|
inherited |
Definition at line 66 of file IFunction.h.
|
inherited |
Definition at line 108 of file IParamFunction.h.
|
inline |
Constructor a wrapped function from a pointer to a generic callable object implemention operator()(const double *), the new function dimension, the number of parameters (number of fixed variables) and an array specifying the index of the fixed variables which becames parameters in the new API
Definition at line 149 of file WrappedParamFunction.h.
References ROOT::Math::WrappedParamFunctionGen< FuncPtr >::DoInit().
Referenced by ROOT::Math::WrappedParamFunctionGen< FuncPtr >::Clone().
|
inline |
Constructor as before but taking now a non - const pointer to a callable object. This constructor is needed in the case FuncPtr is a std::unique_ptr which has a copy ctor taking non const objects
Definition at line 163 of file WrappedParamFunction.h.
References ROOT::Math::WrappedParamFunctionGen< FuncPtr >::DoInit().
|
private |
|
inlinevirtual |
clone the function
Implements ROOT::Math::IBaseFunctionMultiDimTempl< T >.
Definition at line 174 of file WrappedParamFunction.h.
References ROOT::Math::WrappedParamFunctionGen< FuncPtr >::WrappedParamFunctionGen(), ROOT::Math::WrappedParamFunctionGen< FuncPtr >::fDim, ROOT::Math::WrappedParamFunctionGen< FuncPtr >::fFunc, ROOT::Math::WrappedParamFunctionGen< FuncPtr >::fParams, and ROOT::Math::WrappedParamFunctionGen< FuncPtr >::fParIndices.
|
inlineprivatevirtual |
evaluate the function (re-implement for being more efficient)
Reimplemented from ROOT::Math::IParametricFunctionMultiDimTempl< double >.
Definition at line 210 of file WrappedParamFunction.h.
References ROOT::Math::WrappedParamFunctionGen< FuncPtr >::fDim, ROOT::Math::WrappedParamFunctionGen< FuncPtr >::fFunc, ROOT::Math::WrappedParamFunctionGen< FuncPtr >::fVarIndices, ROOT::Math::WrappedParamFunctionGen< FuncPtr >::fX, and ROOT::Math::WrappedParamFunctionGen< FuncPtr >::NPar().
Referenced by ROOT::Math::WrappedParamFunctionGen< FuncPtr >::DoEvalPar().
|
inlineprivatevirtual |
implement the required IParamFunction interface
Implements ROOT::Math::IParametricFunctionMultiDimTempl< double >.
Definition at line 237 of file WrappedParamFunction.h.
References ROOT::Math::WrappedParamFunctionGen< FuncPtr >::DoEval(), ROOT::Math::WrappedParamFunctionGen< FuncPtr >::NPar(), and ROOT::Math::WrappedParamFunctionGen< FuncPtr >::SetParValues().
|
inlineprivate |
Definition at line 243 of file WrappedParamFunction.h.
References ROOT::Math::WrappedParamFunctionGen< FuncPtr >::fDim, ROOT::Math::WrappedParamFunctionGen< FuncPtr >::fParams, ROOT::Math::WrappedParamFunctionGen< FuncPtr >::fParIndices, ROOT::Math::WrappedParamFunctionGen< FuncPtr >::fVarIndices, ROOT::Math::WrappedParamFunctionGen< FuncPtr >::fX, ROOT::Math::WrappedParamFunctionGen< FuncPtr >::NPar(), and ROOT::Math::WrappedParamFunctionGen< FuncPtr >::SetParValues().
Referenced by ROOT::Math::WrappedParamFunctionGen< FuncPtr >::WrappedParamFunctionGen().
|
inlinevirtual |
Retrieve the dimension of the function
Implements ROOT::Math::IBaseFunctionMultiDimTempl< T >.
Definition at line 197 of file WrappedParamFunction.h.
References ROOT::Math::WrappedParamFunctionGen< FuncPtr >::fDim.
|
inlinevirtual |
Return the number of Parameters
Implements ROOT::Math::IBaseParam.
Definition at line 195 of file WrappedParamFunction.h.
References ROOT::Math::WrappedParamFunctionGen< FuncPtr >::fParams.
Referenced by ROOT::Math::WrappedParamFunctionGen< FuncPtr >::DoEval(), ROOT::Math::WrappedParamFunctionGen< FuncPtr >::DoEvalPar(), ROOT::Math::WrappedParamFunctionGen< FuncPtr >::DoInit(), and ROOT::Math::WrappedParamFunctionGen< FuncPtr >::SetParameters().
|
inlineinherited |
Definition at line 125 of file IParamFunction.h.
|
inlineinherited |
Evaluate function at a point x and for given parameters p. This method does not change the internal status of the function (internal parameter values). If for some reason one prefers caching the parameter values, SetParameters(p) and then operator()(x) should be called. Use the pure virtual function DoEvalPar to implement it
Definition at line 120 of file IParamFunction.h.
|
inlineinherited |
Evaluate the function at a point x[]. Use the pure virtual private method DoEval which must be implemented by the sub-classes
Definition at line 92 of file IFunction.h.
References ROOT::Math::IBaseFunctionMultiDimTempl< T >::DoEval().
Referenced by ROOT::Math::IGradientFunctionMultiDimTempl< T >::FdF().
|
private |
|
inlinevirtualinherited |
Return the name of the i-th parameter (starting from zero) Overwrite if want to avoid the default name ("Par_0, Par_1, ...")
Definition at line 83 of file IParamFunction.h.
References ROOT::Math::IBaseParam::NPar(), and ROOT::Math::Util::ToString().
Referenced by ROOT::Fit::FitConfig::CreateParamsSettings().
|
inlinevirtual |
Access the parameter values
Implements ROOT::Math::IBaseParam.
Definition at line 185 of file WrappedParamFunction.h.
References ROOT::Math::WrappedParamFunctionGen< FuncPtr >::fParams.
|
inlinevirtual |
Set the parameter values
p | vector of doubles containing the parameter values. |
to be defined: can user change number of params ? At the moment no.
Implements ROOT::Math::IBaseParam.
Definition at line 189 of file WrappedParamFunction.h.
References ROOT::Math::WrappedParamFunctionGen< FuncPtr >::fParams, ROOT::Math::WrappedParamFunctionGen< FuncPtr >::NPar(), and ROOT::Math::WrappedParamFunctionGen< FuncPtr >::SetParValues().
|
inlineprivate |
Definition at line 278 of file WrappedParamFunction.h.
References ROOT::Math::WrappedParamFunctionGen< FuncPtr >::fDim, ROOT::Math::WrappedParamFunctionGen< FuncPtr >::fParIndices, and ROOT::Math::WrappedParamFunctionGen< FuncPtr >::fX.
Referenced by ROOT::Math::WrappedParamFunctionGen< FuncPtr >::DoEvalPar(), ROOT::Math::WrappedParamFunctionGen< FuncPtr >::DoInit(), and ROOT::Math::WrappedParamFunctionGen< FuncPtr >::SetParameters().
|
private |
Definition at line 288 of file WrappedParamFunction.h.
Referenced by ROOT::Math::WrappedParamFunctionGen< FuncPtr >::Clone(), ROOT::Math::WrappedParamFunctionGen< FuncPtr >::DoEval(), ROOT::Math::WrappedParamFunctionGen< FuncPtr >::DoInit(), ROOT::Math::WrappedParamFunctionGen< FuncPtr >::NDim(), and ROOT::Math::WrappedParamFunctionGen< FuncPtr >::SetParValues().
|
mutableprivate |
Definition at line 287 of file WrappedParamFunction.h.
Referenced by ROOT::Math::WrappedParamFunctionGen< FuncPtr >::Clone(), and ROOT::Math::WrappedParamFunctionGen< FuncPtr >::DoEval().
|
private |
Definition at line 289 of file WrappedParamFunction.h.
Referenced by ROOT::Math::WrappedParamFunctionGen< FuncPtr >::Clone(), ROOT::Math::WrappedParamFunctionGen< FuncPtr >::DoInit(), ROOT::Math::WrappedParamFunctionGen< FuncPtr >::NPar(), ROOT::Math::WrappedParamFunctionGen< FuncPtr >::Parameters(), and ROOT::Math::WrappedParamFunctionGen< FuncPtr >::SetParameters().
|
private |
Definition at line 291 of file WrappedParamFunction.h.
Referenced by ROOT::Math::WrappedParamFunctionGen< FuncPtr >::Clone(), ROOT::Math::WrappedParamFunctionGen< FuncPtr >::DoInit(), and ROOT::Math::WrappedParamFunctionGen< FuncPtr >::SetParValues().
|
private |
Definition at line 290 of file WrappedParamFunction.h.
Referenced by ROOT::Math::WrappedParamFunctionGen< FuncPtr >::DoEval(), and ROOT::Math::WrappedParamFunctionGen< FuncPtr >::DoInit().
|
mutableprivate |
Definition at line 292 of file WrappedParamFunction.h.
Referenced by ROOT::Math::WrappedParamFunctionGen< FuncPtr >::DoEval(), ROOT::Math::WrappedParamFunctionGen< FuncPtr >::DoInit(), and ROOT::Math::WrappedParamFunctionGen< FuncPtr >::SetParValues().