BornAgain  1.19.79
Open-source research software to simulate and fit neutron and x-ray reflectometry and grazing-incidence small-angle scattering
ROOT::Math::GSLMultiMinFunctionAdapter< UserFunc > Struct Template Reference

Description

template<class UserFunc>
struct ROOT::Math::GSLMultiMinFunctionAdapter< UserFunc >

Class for adapting any multi-dimension C++ functor class to C function pointers used by GSL MultiMin algorithms. The templated C++ function class must implement:

double operator( const double * x) and if the derivatives are required: void Gradient( const double * x, double * g)

This class defines static methods with will be used to fill the gsl_multimin_function and gsl_multimin_function_fdf structs used by GSL. See for examples the GSL online manual

Definition at line 66 of file GSLMultiMinFunctionAdapter.h.

Static Public Member Functions

static void Df (const gsl_vector *x, void *p, gsl_vector *g)
 
static double F (const gsl_vector *x, void *p)
 
static void Fdf (const gsl_vector *x, void *p, double *f, gsl_vector *g)
 

Member Function Documentation

◆ Df()

template<class UserFunc >
static void ROOT::Math::GSLMultiMinFunctionAdapter< UserFunc >::Df ( const gsl_vector *  x,
void *  p,
gsl_vector *  g 
)
inlinestatic

Definition at line 76 of file GSLMultiMinFunctionAdapter.h.

76  {
77 
78  UserFunc * function = reinterpret_cast< UserFunc *> (p);
79  (*function).Gradient( x->data, g->data );
80 
81  }

◆ F()

template<class UserFunc >
static double ROOT::Math::GSLMultiMinFunctionAdapter< UserFunc >::F ( const gsl_vector *  x,
void *  p 
)
inlinestatic

Definition at line 68 of file GSLMultiMinFunctionAdapter.h.

68  {
69 
70  UserFunc * function = reinterpret_cast< UserFunc *> (p);
71  // get pointer to data from gsl_vector
72  return (*function)( x->data );
73  }

◆ Fdf()

template<class UserFunc >
static void ROOT::Math::GSLMultiMinFunctionAdapter< UserFunc >::Fdf ( const gsl_vector *  x,
void *  p,
double *  f,
gsl_vector *  g 
)
inlinestatic

Definition at line 83 of file GSLMultiMinFunctionAdapter.h.

83  {
84 
85  UserFunc * function = reinterpret_cast< UserFunc *> (p);
86 // *f = (*function) ( x );
87 // *df = (*function).Gradient( x );
88 
89  (*function).FdF( x->data, *f, g->data);
90  }

The documentation for this struct was generated from the following file: