Class min_cern (o2scl)

O2scl : Class List

template<class func_t = funct>
class min_cern : public o2scl::min_bkt_base<funct>

One-dimensional minimization (CERNLIB)

The golden section search is applied in the interval \( (a,b) \) using a fixed number \( n \) of function evaluations where

\[ n=\left[ 2.08 \ln(|a-b|/\mathrm{tol\_abs})+\frac{1}{2}\right]+1 \]

The accuracy depends on the function. A choice of \( \mathrm{tol\_abs}>10^{-8} \) usually results in a relative error of $x$ which is smaller than or of the order of \( \mathrm{tol\_abs} \) .

This routine strictly searches the interval \( (a,b) \) . If the function is nowhere flat in this interval, then min_bkt() will return either \( a \) or \( b \) and min_type is set to 1. 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.

Based on the CERNLIB routines RMINFC and DMINFC, which was based on [Fletcher87], and [Krabs83] and is documented at http://wwwasdoc.web.cern.ch/wwwasdoc/shortwrupsdir/d503/top.html

Note

The number of function evaluations can be quite large if mmin::tol_abs is sufficiently small. If mmin::tol_abs is exactly zero, then the error handler will be called.

Public Functions

inline min_cern()
inline virtual int min_bkt(double &x, double a, double b, double &y, func_t &func)

Calculate the minimum min of func between a and b.

The initial value of x is ignored.

If there is no minimum in the given interval, then on exit x will be equal to either a or b and min_type will be set to 1 instead of zero. The error handler is not called, as this need not be interpreted as an error.

inline int set_delta(double d)

Set the value of \( \delta \).

If this is not called before min_bkt() is used, then the suggested value \( \delta=10 \mathrm{tol_abs} \) is used.

inline virtual const char *type()

Return string denoting type (“min_cern”)

Public Members

int min_type

Type of minimum found.

Protected Functions

inline int nint(double x)

C analog of Fortran’s “Nearest integer” function.

Protected Attributes

double delta

The value of delta as specified by the user.

bool delta_set

True if the value of delta has been set.