[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

35.3 Providing the Function to be Minimized

You must provide n functions of p variables for the minimization algorithms to operate on. In order to allow for general parameters the functions are defined by the following data types:

Data Type: gsl_multifit_function
This data type defines a general system of functions with parameters.

int (* f) (const gsl_vector * x, void * params, gsl_vector * f)
this function should store the vector result f(x,params) in f for argument x and parameters params, returning an appropriate error code if the function cannot be computed.

size_t n
the number of functions, i.e. the number of components of the vector f

size_t p
the number of independent variables, i.e. the number of components of the vectors x

void * params
a pointer to the parameters of the function

Data Type: gsl_multifit_function_fdf
This data type defines a general system of functions with parameters and the corresponding Jacobian matrix of derivatives,

int (* f) (const gsl_vector * x, void * params, gsl_vector * f)
this function should store the vector result f(x,params) in f for argument x and parameters params, returning an appropriate error code if the function cannot be computed.

int (* df) (const gsl_vector * x, void * params, gsl_matrix * J)
this function should store the n-by-p matrix result J_ij = d f_i(x,params) / d x_j in J for argument x and parameters params, returning an appropriate error code if the function cannot be computed.

int (* fdf) (const gsl_vector * x, void * params, gsl_vector * f, gsl_matrix * J)
This function should set the values of the f and J as above, for arguments x and parameters params. This function provides an optimization of the separate functions for f(x) and J(x) -- it is always faster to compute the function and its derivative at the same time.

size_t n
the number of functions, i.e. the number of components of the vector f

size_t p
the number of independent variables, i.e. the number of components of the vectors x

void * params
a pointer to the parameters of the function


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

This document was generated by Michael Stenner on February, 14 2002 using texi2html