13#ifndef ROOT_Math_WrappedParamFunction
14#define ROOT_Math_WrappedParamFunction
40template<
typename FuncPtr = FreeParamMultiFunctionPtr >
52 fParams(std::vector<double>(npar) )
54 if (par != 0) std::copy(par,par+npar,
fParams.begin() );
74 template<
class Iterator>
78 fParams(std::vector<double>(begin,end) )
139template<
typename FuncPtr = FreeMultiFunctionPtr >
149 WrappedParamFunctionGen (
const FuncPtr & func,
unsigned int dim,
unsigned int npar,
const double * par,
const unsigned int * idx) :
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) {
230 return (*
fFunc)(
fX.empty() ? nullptr : &
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;
Documentation for the abstract class IBaseFunctionMultiDim.
WrappedParamGenFunction class to wrap any multi-dimensional function implementing the operator()(cons...
const double * Parameters() const
Access the parameter values.
WrappedParamFunctionGen & operator=(const WrappedParamFunctionGen &)
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...
double DoEval(const double *x) const
evaluate the function (re-implement for being more efficient)
void SetParValues(unsigned int npar, const double *p) const
IMultiGenFunction * Clone() const
clone the function
void SetParameters(const double *p)
Set the parameter values.
WrappedParamFunctionGen(const WrappedParamFunctionGen &)
std::vector< unsigned int > fParIndices
unsigned int NDim() const
Retrieve the dimension of the function.
double DoEvalPar(const double *x, const double *p) const
implement the required IParamFunction interface
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.
unsigned int NPar() const
Return the number of Parameters.
std::vector< double > fParams
std::vector< unsigned int > fVarIndices
WrappedParamFunction class to wrap any multi-dimensional function pbject implementing the operator()(...
IMultiGenFunction * Clone() const
clone the function
double DoEvalPar(const double *x, const double *p) const
evaluate the function given values and parameters (requested interface)
std::vector< double > fParams
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 pointer to a callable object, the function dimension and an ite...
unsigned int NPar() const
Return the number of Parameters.
const double * Parameters() const
Access the parameter values.
void SetParameters(const double *p)
Set the parameter values.
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...
Namespace for new Math classes and functions.
double(* FreeParamMultiFunctionPtr)(const double *, const double *)
double(* FreeMultiFunctionPtr)(const double *)