"Object oriented" description of functions

Fabrice Rossi rossi@ufrmd.dauphine.fr
Wed Dec 8 07:02:00 GMT 1999


In several places, we have "normal" functions (for instance gsl_function), as
well as differentiable function (gsl_function_fdf). Unfortunately, it's not
currently possible to simply view a differentiable function as a normal
function. This can be done for instance by replacing the current definition of
gsl_function_fdf_struct by:
struct gsl_function_fdf_struct 
{
  gsl_function *f;
  double (* df) (double x, void * params);
  void (* fdf) (double x, void * params, double * f, double * df);
  void * params;
};

Evaluation macros need to be rewritten and we can add:
#define GSL_FUNCTION(FDF) ((FDF)->f)
to allow "casting".

I know this introduces an additionnal pointer, but I think it might be a good
idea.

Fabrice Rossi


More information about the Gsl-discuss mailing list