34 #ifndef ROOT_Math_GSLMultiMinFunctionAdapter
35 #define ROOT_Math_GSLMultiMinFunctionAdapter
37 #include "gsl/gsl_vector.h"
65 template<
class UserFunc>
66 struct GSLMultiMinFunctionAdapter {
68 static double F(
const gsl_vector * x,
void * p) {
70 UserFunc *
function =
reinterpret_cast< UserFunc *
> (p);
72 return (*
function)( x->data );
76 static void Df(
const gsl_vector * x,
void * p, gsl_vector * g) {
78 UserFunc *
function =
reinterpret_cast< UserFunc *
> (p);
79 (*function).Gradient( x->data, g->data );
83 static void Fdf(
const gsl_vector * x,
void * p,
double *f, gsl_vector * g ) {
85 UserFunc *
function =
reinterpret_cast< UserFunc *
> (p);
89 (*function).FdF( x->data, *f, g->data);