31 #ifndef ROOT_Math_GSLMonteFunctionWrapper
32 #define ROOT_Math_GSLMonteFunctionWrapper
34 #include "gsl/gsl_monte.h"
35 #include "gsl/gsl_multimin.h"
47 typedef double ( * GSLMonteFuncPointer ) (
double *, size_t,
void *);
57 class GSLMonteFunctionWrapper {
61 GSLMonteFunctionWrapper()
68 void SetFuncPointer( GSLMonteFuncPointer f) { fFunc.f = f; }
69 void SetDim (
unsigned int n ) { fFunc.dim = n; }
70 void SetParams (
void * p) { fFunc.params = p; }
73 template<
class FuncType>
74 void SetFunction(
const FuncType &f) {
77 SetFuncPointer(&GSLMonteFunctionAdapter<FuncType >::F);
79 SetParams(const_cast<void *>(p));
82 gsl_monte_function * GetFunc() {
return &fFunc; }
85 double operator() (
const double * x) {
return GSL_MONTE_FN_EVAL(&fFunc, const_cast<double *>(x) ); }
89 gsl_monte_function fFunc;