13 #ifndef ROOT_Math_WrappedParamFunction 14 #define ROOT_Math_WrappedParamFunction 16 #ifndef ROOT_Math_IParamFunction 42 template<
typename FuncPtr = FreeParamMultiFunctionPtr >
76 template<
class Iterator>
141 template<
typename FuncPtr = FreeMultiFunctionPtr >
155 fParIndices(
std::vector<unsigned int>(idx, idx + npar) ),
156 fX(
std::vector<double>(npar+dim) )
169 fParIndices(
std::vector<unsigned int>(idx, idx + npar) ),
170 fX(
std::vector<double>(npar+dim) )
192 unsigned int npar =
NPar();
193 std::copy(p, p+ npar,
fParams.begin() );
194 SetParValues(npar, p);
222 for (
unsigned int i = 0; i <
fDim; ++i) {
223 unsigned int j = fVarIndices[i];
224 assert ( j <
NPar() + fDim);
232 return (*
fFunc)( &fX.front() );
239 double DoEvalPar(
const double *
x,
const double * p )
const {
240 SetParValues(
NPar(), p);
247 fVarIndices.reserve(
fDim);
248 unsigned int npar =
NPar();
249 for (
unsigned int i = 0; i < npar +
fDim; ++i) {
251 for (
unsigned int j = 0; j < npar; ++j) {
252 if (fParIndices[j] == i) {
257 if (isVar) fVarIndices.push_back(i);
259 assert ( fVarIndices.size() ==
fDim);
269 SetParValues(npar, &
fParams.front() );
270 for (
unsigned int i = 0; i < npar; ++i) {
271 unsigned int j = fParIndices[i];
272 assert ( j < npar + fDim);
281 for (
unsigned int i = 0; i < npar; ++i) {
282 unsigned int j = fParIndices[i];
283 assert ( j < npar +
fDim);
294 mutable std::vector<double>
fX;
void SetParValues(unsigned int npar, const double *p) const
double DoEvalPar(const double *x, const double *p) const
implement the required IParamFunction interface
This namespace contains pre-defined functions to be used in conjuction with TExecutor::Map and TExecu...
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 ...
unsigned int NDim() const
Retrieve the dimension of the function.
double DoEval(const double *x) const
evaluate the function (re-implement for being more efficient)
std::vector< double > fParams
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...
const double * Parameters() const
Access the parameter values.
WrappedParamGenFunction class to wrap any multi-dimensional function implementing the operator()(cons...
virtual double DoEval(const double *x) const
Implement the ROOT::Math::IBaseFunctionMultiDim interface DoEval(x) using the cached parameter values...
std::vector< unsigned int > fVarIndices
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
const double * Parameters() const
Access the parameter values.
void SetParameters(const double *p)
Set the parameter values.
IParamFunction interface (abstract class) describing multi-dimensional parameteric functions It is a ...
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(* FreeParamMultiFunctionPtr)(const double *, const double *)
double func(double *x, double *p)
std::vector< unsigned int > fParIndices
Namespace for new Math classes and functions.
IMultiGenFunction * Clone() const
Constructor a wrapped function from a non - const pointer to a callable object, the function dimensio...
double DoEvalPar(const double *x, const double *p) const
evaluate the function given values and parameters (requested interface)
unsigned int NPar() const
Return the number of Parameters.
IMultiGenFunction * Clone() const
clone the function
void SetParameters(const double *p)
Set the parameter values.
unsigned int NPar() const
Return the number of Parameters.
unsigned int NDim() const
Retrieve the dimension of the function.
double(* FreeMultiFunctionPtr)(const double *)
Documentation for the abstract class IBaseFunctionMultiDim.
WrappedParamFunction class to wrap any multi-dimensional function pbject implementing the operator()(...