13#ifndef ROOT_Math_WrappedParamFunction
14#define ROOT_Math_WrappedParamFunction
40template<
typename FuncPtr = FreeParamMultiFunctionPtr >
54 if (par) std::copy(par, par+npar,
fParams.begin());
74 template<
class Iterator>
107 unsigned int NDim()
const override {
return fDim; }
113 double DoEvalPar(
const double *
x,
const double *
p)
const override {
139template<
typename FuncPtr = FreeMultiFunctionPtr >
149 WrappedParamFunctionGen (
const FuncPtr & func,
unsigned int dim,
unsigned int npar,
const double * par,
const unsigned int * idx) :
190 unsigned int npar =
NPar();
197 unsigned int NDim()
const override {
return fDim; }
210 double DoEval(
const double *
x)
const override {
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 override {
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;
winID h TVirtualViewer3D TVirtualGLPainter p
Documentation for the abstract class IBaseFunctionMultiDim.
WrappedParamGenFunction class to wrap any multi-dimensional function implementing the operator()(cons...
double DoEval(const double *x) const override
evaluate the function (re-implement for being more efficient)
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 implementation operator()(...
unsigned int NDim() const override
Retrieve the dimension of the function.
void SetParValues(unsigned int npar, const double *p) const
void SetParameters(const double *p) override
Set the parameter values.
WrappedParamFunctionGen(const WrappedParamFunctionGen &)
unsigned int NPar() const override
Return the number of Parameters.
std::vector< unsigned int > fParIndices
double DoEvalPar(const double *x, const double *p) const override
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.
IMultiGenFunction * Clone() const override
clone the function
std::vector< double > fParams
std::vector< unsigned int > fVarIndices
const double * Parameters() const override
Access the parameter values.
WrappedParamFunction class to wrap any multi-dimensional function object implementing the operator()(...
unsigned int NDim() const override
Retrieve the dimension of the function.
const double * Parameters() const override
Access the parameter values.
void SetParameters(const double *p) override
Set the parameter values.
std::vector< double > fParams
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...
IMultiGenFunction * Clone() const override
clone the function
double DoEvalPar(const double *x, const double *p) const override
evaluate the function given values and parameters (requested interface)
unsigned int NPar() const override
Return the number of Parameters.
WrappedParamFunction(FuncPtr func, unsigned int dim=1, unsigned int npar=0, double *par=nullptr)
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 *)
This file contains a specialised ROOT message handler to test for diagnostic in unit tests.