This is the mail archive of the
gsl-discuss@sourceware.cygnus.com
mailing list for the GSL project.
"Object oriented" description of functions
- To: GSL discussion list <gsl-discuss at sourceware dot cygnus dot com>
- Subject: "Object oriented" description of functions
- From: Fabrice Rossi <rossi at ufrmd dot dauphine dot fr>
- Date: Wed, 08 Dec 1999 16:02:17 +0100
- Organization: Dauphine University
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