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::GSLFunctionAdapter< UserFunc > Class Template Reference

Description

template<class UserFunc>
class ROOT::Math::GSLFunctionAdapter< UserFunc >

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

double operator( double x) and if the derivatives are required: double Gradient( double x)

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

Definition at line 63 of file GSLFunctionAdapter.h.

Public Member Functions

 GSLFunctionAdapter ()
 
virtual ~GSLFunctionAdapter ()
 

Static Public Member Functions

static double Df (double x, void *p)
 
static double F (double x, void *p)
 
static void Fdf (double x, void *p, double *f, double *df)
 

Constructor & Destructor Documentation

◆ GSLFunctionAdapter()

template<class UserFunc >
ROOT::Math::GSLFunctionAdapter< UserFunc >::GSLFunctionAdapter ( )
inline

Definition at line 67 of file GSLFunctionAdapter.h.

67 {}

◆ ~GSLFunctionAdapter()

template<class UserFunc >
virtual ROOT::Math::GSLFunctionAdapter< UserFunc >::~GSLFunctionAdapter ( )
inlinevirtual

Definition at line 68 of file GSLFunctionAdapter.h.

68 {}

Member Function Documentation

◆ Df()

template<class UserFunc >
static double ROOT::Math::GSLFunctionAdapter< UserFunc >::Df ( double  x,
void *  p 
)
inlinestatic

Definition at line 77 of file GSLFunctionAdapter.h.

77  {
78 
79  UserFunc * function = reinterpret_cast< UserFunc *> (p);
80  return (*function).Derivative( x );
81  }

◆ F()

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

Definition at line 70 of file GSLFunctionAdapter.h.

70  {
71 
72  UserFunc * function = reinterpret_cast< UserFunc *> (p);
73  return (*function)( x );
74  }

◆ Fdf()

template<class UserFunc >
static void ROOT::Math::GSLFunctionAdapter< UserFunc >::Fdf ( double  x,
void *  p,
double *  f,
double *  df 
)
inlinestatic

Definition at line 83 of file GSLFunctionAdapter.h.

83  {
84 
85  UserFunc * function = reinterpret_cast< UserFunc *> (p);
86  *f = (*function) ( x );
87  *df = (*function).Derivative( x );
88  }

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