Integration of a multidimensional parametric functions


For my study I need to integrate a 4-dimensional parametric function. I read the documentation concerning the numerical integration here It is designed to work with Functor and Functor1D. I tried to supply IntegatorMultiDim with the ParamFunctor and is not accepting it. Is there any way to integrate a multidimensional parametric function?



you can use RootMpi to paralelize your algorithm. RootMpi is a library for parallel computing in ROOT. The project has a one-dimensional integrator in the tutorials. You can see the source code and give us some feedback.

The project page: … /Main_Page


a ROOT::Math::ParamFunctor object defines an operator() ( double *x, double *p).

If you are integrating the function in x, you can use the template class
ROOT::Math::WrappedParamFunctionROOT::Math::ParamFunctor and do:

ROOT::Math::ParamFunctor *   func = ...
ROOT::Math::WrappedParamFunction<ROOT::Math::ParamFunctor *> wf( func, ndim_in_x, number_of_parameters);

and then pass wf to the integrator class.

Best Regards


Hi Lorenzo,

Thank you for your answer.
Could you please explain one thing in your example.

[quote=“moneta”] ROOT::Math::ParamFunctor * func = ...
How should I finish this line. Suppose that I have previously define

double f2param(const double *x, const *par){ return par[0]*x[0]+par[1]*x[1]; }

Thank you in advance,


In your case you cannot it is better you wrap directly the free function in the WrappedParamFunction class.
Below is an example, note that you don’t need to supply the template parameter, since the free function type is the class default one:

double f (const double *x , const double *p) { ...}
WrappedParamFunction<> wf( &f, ndim_in_x, number_of_parameters);


Thank you very much Lorenzo.
It works now.

Serhiy Senyukov.