One-dimensional minimization using Brent's method (GSL) More...
#include <min_brent_gsl.h>
The minimization in the function min_bkt() is complete when the bracketed interval is smaller than
, where
.
Note that this algorithm requires that the initial guess already brackets the minimum, i.e.
,
and
. This is different from min_cern, where the initial value of the first parameter to min_cern::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 min_base::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 root_brent_gsl for a similar algorithm applied as a solver rather than a minimizer.
Definition at line 95 of file min_brent_gsl.h.
Protected Attributes | |
| func_t * | uf |
| The function. | |
Temporary storage | |
| double | d |
| double | e |
| double | v |
| double | w |
| double | f_v |
| double | f_w |
| 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. | |
| 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. | |
| min_brent_gsl () | |
| virtual | ~min_brent_gsl () |
| 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. More... | |
| 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. More... | |
| virtual const char * | type () |
| Return string denoting type ("min_brent_gsl") | |
Additional Inherited Members | |
Public Member Functions inherited from o2scl::min_bkt_base< funct > | |
| virtual int | min (double &x, double &fmin, funct &func) |
Calculate the minimum min of func w.r.t 'x'. More... | |
| virtual int | min_bkt (double &x2, double x1, double x3, double &fmin, funct &func)=0 |
Calculate the minimum min of func with x2 bracketed between x1 and x3. More... | |
| virtual int | min_de (double &x, double &fmin, funct &func, funct &df) |
Calculate the minimum min of func with derivative dfunc w.r.t 'x'. More... | |
Public Member Functions inherited from o2scl::min_base< funct, funct > | |
| virtual int | print_iter (double x, double y, int iter, double value=0.0, double limit=0.0, std::string comment="") |
| Print out iteration information. More... | |
| virtual int | bracket (double &ax, double &bx, double &cx, double &fa, double &fb, double &fc, funct &func) |
Given interval (ax,bx), attempt to bracket a minimum for function func. More... | |
Public Attributes inherited from o2scl::min_bkt_base< funct > | |
| int | bracket_iter |
| The number of iterations for automatically bracketing a minimum (default 20) | |
Public Attributes inherited from o2scl::min_base< funct, funct > | |
| int | verbose |
| Output control. | |
| int | ntrial |
| Maximum number of iterations. | |
| double | tol_rel |
| The tolerance for the minimum function value. | |
| double | tol_abs |
| The tolerance for the location of the minimum. | |
| int | last_ntrial |
| The number of iterations used in the most recent minimization. | |
| int | bracket_iter |
| The number of iterations for automatically bracketing a minimum (default 20) | |
| bool | err_nonconv |
| If true, call the error handler if the routine does not "converge". | |
|
inline |
Definition at line 206 of file min_brent_gsl.h.
|
inlinevirtual |
Note that this algorithm requires that the initial guess already brackets the minimum, i.e.
,
and
. This is different from min_cern, where the initial value of the first parameter to min_cern::min_bkt() is ignored.
Definition at line 342 of file min_brent_gsl.h.
Documentation generated with Doxygen. Provided under the
GNU Free Documentation License (see License Information).