Object-oriented Scientific Computing Library: Version 0.910
Public Member Functions | Data Fields | Protected Member Functions | Protected Attributes
gsl_min_brent< func_t > Class Template Reference

One-dimensional minimization using Brent's method (GSL) More...

#include <gsl_min_brent.h>

Inheritance diagram for gsl_min_brent< func_t >:
minimize_bkt< func_t > minimize< func_t, func_t >

Detailed Description

template<class func_t = funct>
class gsl_min_brent< func_t >

The minimization in the function min_bkt() is complete when the bracketed interval is smaller than $ \mathrm{tol} = \mathrm{tol\_abs} + \mathrm{tol\_rel} \cdot \mathrm{min} $, where $ \mathrm{min} = \mathrm{min}(|\mathrm{lower}|,|\mathrm{upper}|) $.

Note that this algorithm requires that the initial guess already brackets the minimum, i.e. $ x_1 < x_2 < x_3 $, $ f(x_1) > f(x_2) $ and $ f(x_3) > f(x_2) $. This is different from cern_minimize, where the initial value of the first parameter to cern_minimize::min_bkt() is ignored.

The set functions throw an error if the initial bracket is not correctly specified. The function iterate() never calls the error handler. The function min_bkt() calls the error handler if the tolerances are negative or if the number of iterations is insufficient to give the specified tolerance.

Setting minimize::err_nonconv to false will force min_bkt() not to call the error handler when the number of iterations is insufficient.

Note that if there are more than 1 local minima in the specified interval, there is no guarantee that this method will find the global minimum.

See also gsl_root_brent for a similar algorithm applied as a solver rather than a minimizer.

Note:
There was a bug in this minimizer which was fixed for GSL-1.11 which has also been fixed here.

Definition at line 87 of file gsl_min_brent.h.

Public Member Functions

int set (func_t &func, double xmin, double lower, double upper)
 Set the function and the initial bracketing interval.
int set_with_values (func_t &func, double xmin, double fmin, double lower, double fl, double upper, double fu)
 Set the function, the initial bracketing interval, and the corresponding function values.
int iterate ()
 Perform an iteration.
virtual int min_bkt (double &x2, double x1, double x3, double &fmin, func_t &func)
 Calculate the minimum fmin of func with x2 bracketed between x1 and x3.
virtual const char * type ()
 Return string denoting type ("gsl_min_brent")

Data Fields

double x_minimum
 Location of minimum.
double x_lower
 Lower bound.
double x_upper
 Upper bound.
double f_minimum
 Minimum value.
double f_lower
 Value at lower bound.
double f_upper
 Value at upper bound.

Protected Member Functions

int compute_f_values (func_t &func, double xminimum, double *fminimum, double xlower, double *flower, double xupper, double *fupper)
 Compute the function values at the various points.

Protected Attributes

func_t * uf
 The function.
Temporary storage
double d
double e
double v
double w
double f_v
double f_w

Member Function Documentation

template<class func_t = funct>
int gsl_min_brent< func_t >::iterate ( ) [inline]
Idea for Future:
It looks like x_left and x_right can be removed. Also, it would be great to replace the one-letter variable names with something more meaningful.

Definition at line 198 of file gsl_min_brent.h.

template<class func_t = funct>
virtual int gsl_min_brent< func_t >::min_bkt ( double &  x2,
double  x1,
double  x3,
double &  fmin,
func_t &  func 
) [inline, virtual]

Note that this algorithm requires that the initial guess already brackets the minimum, i.e. $ x_1 < x_2 < x_3 $, $ f(x_1) > f(x_2) $ and $ f(x_3) > f(x_2) $. This is different from cern_minimize, where the initial value of the first parameter to cern_minimize::min_bkt() is ignored.

Implements minimize_bkt< func_t >.

Definition at line 332 of file gsl_min_brent.h.


The documentation for this class was generated from the following file:
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Documentation generated with Doxygen. Provided under the GNU Free Documentation License (see License Information).

Get Object-oriented Scientific Computing
Lib at SourceForge.net. Fast, secure and Free Open Source software
downloads.