16#ifndef ROOT_Math_WrappedParamFunction
17#define ROOT_Math_WrappedParamFunction
43template<
typename FuncPtr = FreeParamMultiFunctionPtr >
57 if (par) std::copy(par, par+npar,
fParams.begin());
77 template<
class Iterator>
110 unsigned int NDim()
const override {
return fDim; }
116 double DoEvalPar(
const double *
x,
const double *
p)
const override {
142template<
typename FuncPtr = FreeMultiFunctionPtr >
152 WrappedParamFunctionGen (
const FuncPtr & func,
unsigned int dim,
unsigned int npar,
const double * par,
const unsigned int * idx) :
193 unsigned int npar =
NPar();
200 unsigned int NDim()
const override {
return fDim; }
213 double DoEval(
const double *
x)
const override {
223 for (
unsigned int i = 0; i <
fDim; ++i) {
233 return (*
fFunc)(
fX.empty() ? nullptr : &
fX.front() );
240 double DoEvalPar(
const double *
x,
const double *
p )
const override {
249 unsigned int npar =
NPar();
250 for (
unsigned int i = 0; i < npar +
fDim; ++i) {
252 for (
unsigned int j = 0; j < npar; ++j) {
271 for (
unsigned int i = 0; i < npar; ++i) {
273 assert ( j < npar +
fDim);
282 for (
unsigned int i = 0; i < npar; ++i) {
284 assert ( j < npar +
fDim);
295 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.