Next: , Previous: Minimization Caveats, Up: One dimensional Minimization   [Index]


34.3 Initializing the Minimizer

Function: gsl_min_fminimizer * gsl_min_fminimizer_alloc (const gsl_min_fminimizer_type * T)

This function returns a pointer to a newly allocated instance of a minimizer of type T. For example, the following code creates an instance of a golden section minimizer,

const gsl_min_fminimizer_type * T 
  = gsl_min_fminimizer_goldensection;
gsl_min_fminimizer * s 
  = gsl_min_fminimizer_alloc (T);

If there is insufficient memory to create the minimizer then the function returns a null pointer and the error handler is invoked with an error code of GSL_ENOMEM.

Function: int gsl_min_fminimizer_set (gsl_min_fminimizer * s, gsl_function * f, double x_minimum, double x_lower, double x_upper)

This function sets, or resets, an existing minimizer s to use the function f and the initial search interval [x_lower, x_upper], with a guess for the location of the minimum x_minimum.

If the interval given does not contain a minimum, then the function returns an error code of GSL_EINVAL.

Function: int gsl_min_fminimizer_set_with_values (gsl_min_fminimizer * s, gsl_function * f, double x_minimum, double f_minimum, double x_lower, double f_lower, double x_upper, double f_upper)

This function is equivalent to gsl_min_fminimizer_set but uses the values f_minimum, f_lower and f_upper instead of computing f(x_minimum), f(x_lower) and f(x_upper).

Function: void gsl_min_fminimizer_free (gsl_min_fminimizer * s)

This function frees all the memory associated with the minimizer s.

Function: const char * gsl_min_fminimizer_name (const gsl_min_fminimizer * s)

This function returns a pointer to the name of the minimizer. For example,

printf ("s is a '%s' minimizer\n",
        gsl_min_fminimizer_name (s));

would print something like s is a 'brent' minimizer.