13 #ifndef ROOT_Math_WrappedParamFunction
14 #define ROOT_Math_WrappedParamFunction
40 template<
typename FuncPtr = FreeParamMultiFunctionPtr >
52 fParams(std::vector<double>(npar) )
74 template<
class Iterator>
78 fParams(std::vector<double>(begin,end) )
139 template<
typename FuncPtr = FreeMultiFunctionPtr >
152 fParams(std::vector<double>(par,par+npar) ),
153 fParIndices(std::vector<unsigned int>(idx, idx + npar) ),
154 fX(std::vector<double>(npar+dim) )
166 fParams(std::vector<double>(par,par+npar) ),
167 fParIndices(std::vector<unsigned int>(idx, idx + npar) ),
168 fX(std::vector<double>(npar+dim) )
190 unsigned int npar =
NPar();
191 std::copy(p, p+ npar,
fParams.begin() );
220 for (
unsigned int i = 0; i <
fDim; ++i) {
222 assert ( j <
NPar() + fDim);
230 return (*
fFunc)( &
fX.front() );
237 double DoEvalPar(
const double *
x,
const double * p )
const {
246 unsigned int npar =
NPar();
247 for (
unsigned int i = 0; i < npar +
fDim; ++i) {
249 for (
unsigned int j = 0; j < npar; ++j) {
268 for (
unsigned int i = 0; i < npar; ++i) {
270 assert ( j < npar + fDim);
279 for (
unsigned int i = 0; i < npar; ++i) {
281 assert ( j < npar +
fDim);
292 mutable std::vector<double>
fX;
unsigned int NDim() const
Retrieve the dimension of the function.
WrappedParamFunction(FuncPtr func, unsigned int dim, Iterator begin, Iterator end)
Constructor a wrapped function from a non-const pointer to a callable object, the function dimension ...
double DoEval(const double *x) const
evaluate the function (re-implement for being more efficient)
double DoEvalPar(const double *x, const double *p) const
implement the required IParamFunction interface
unsigned int NDim() const
Retrieve the dimension of the function.
void SetParValues(unsigned int npar, const double *p) const
std::vector< double > fParams
unsigned int NPar() const
Return the number of Parameters.
WrappedParamFunction(FuncPtr func, unsigned int dim=1, unsigned int npar=0, double *par=0)
Constructor a wrapped function from a pointer to a callable object, the function dimension and number...
WrappedParamGenFunction class to wrap any multi-dimensional function implementing the operator()(cons...
std::vector< unsigned int > fVarIndices
IMultiGenFunction * Clone() const
clone the function
WrappedParamFunctionGen(FuncPtr &func, unsigned int dim, unsigned int npar, const double *par, const unsigned int *idx)
Constructor as before but taking now a non - const pointer to a callable object.
std::vector< double > fParams
double(* FreeParamMultiFunctionPtr)(const double *, const double *)
const double * Parameters() const
Access the parameter values.
void SetParameters(const double *p)
Set the parameter values.
WrappedParamFunctionGen & operator=(const WrappedParamFunctionGen &)
Documentation for the abstract class IBaseFunctionMultiDim.
WrappedParamFunctionGen(const FuncPtr &func, unsigned int dim, unsigned int npar, const double *par, const unsigned int *idx)
Constructor a wrapped function from a pointer to a generic callable object implemention operator()(co...
IMultiGenFunction * Clone() const
Constructor a wrapped function from a non - const pointer to a callable object, the function dimensio...
double func(double *x, double *p)
std::vector< unsigned int > fParIndices
const double * Parameters() const
Access the parameter values.
double DoEvalPar(const double *x, const double *p) const
evaluate the function given values and parameters (requested interface)
void SetParameters(const double *p)
Set the parameter values.
double(* FreeMultiFunctionPtr)(const double *)
unsigned int NPar() const
Return the number of Parameters.
WrappedParamFunction class to wrap any multi-dimensional function pbject implementing the operator()(...