26 #ifndef O2SCL_CERN_MINIMIZE_H 27 #define O2SCL_CERN_MINIMIZE_H 29 #include <o2scl/funct.h> 30 #include <o2scl/min.h> 32 #ifndef DOXYGEN_NO_O2NS 71 #ifdef DOXYGEN_NO_O2NS 72 template<
class func_t=funct11>
class min_cern :
75 template<class func_t=funct11> class
min_cern :
80 #ifndef DOXGYEN_INTERNAL 85 inline int nint(
double x) {
86 if (x<0.0)
return ((
int)(x-0.5));
87 else return ((
int)(x+0.5));
109 virtual int min_bkt(
double &x,
double a,
double b,
double &y,
113 static const double w5=2.23606797749979;
114 static const double hv=(3.0-w5)/2.0, hw=(w5-1.0)/2.0;
115 double c, d, v=0.0, fv=0.0, w=0.0, fw=0.0, h;
121 O2SCL_ERR(
"Tolerance zero in min_cern::min_bkt().",
124 if (a!=b) n=
nint(2.0*log(fabs((a-b)/this->
tol_abs)));
133 bool llt=
true, lge=
true;
176 O2SCL_ERR(
"Failed sanity check in min_cern::min_bkt().",
195 virtual const char *
type() {
return "min_cern"; }
202 #ifndef DOXYGEN_INTERNAL 214 #ifndef DOXYGEN_NO_O2NS One-dimensional bracketing minimization [abstract base].
int min_type
Type of minimum found.
bool delta_set
True if the value of delta has been set.
The main O<span style='position: relative; top: 0.3em; font-size: 0.8em'>2</span>scl O$_2$scl names...
int verbose
Output control.
sanity check failed - shouldn't happen
invalid argument supplied by user
double tol_abs
The tolerance for the location of the minimum.
int nint(double x)
C analog of Fortran's "Nearest integer" function.
virtual const char * type()
Return string denoting type ("min_cern")
int last_ntrial
The number of iterations used in the most recent minimization.
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.
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.
#define O2SCL_ERR(d, n)
Set an error with message d and code n.
One-dimensional minimization (CERNLIB)
double delta
The value of delta as specified by the user.
int set_delta(double d)
Set the value of .