40 #include "gsl/gsl_min.h" 41 #include "gsl/gsl_errno.h" 52 fXmin(0), fXlow(0), fXup(0), fMin(0), fLow(0), fUp(0),
53 fIter(0), fStatus(-1), fIsSet(false),
54 fMinimizer(0), fFunction(0)
58 const gsl_min_fminimizer_type*
T = 0 ;
62 T = gsl_min_fminimizer_goldensection;
65 T = gsl_min_fminimizer_brent;
69 T = gsl_min_fminimizer_brent;
94 if (
this == &rhs)
return *
this;
109 std::cout <<
" [ "<< xlow <<
" , " << xup <<
" ]" << std::endl;
114 std::cerr <<
"GSLMinimizer1D: Error: Interval [ "<< xlow <<
" , " << xup <<
" ] does not contain a minimum" << std::endl;
125 std::cerr <<
"GSLMinimizer1D- Error: Function has not been set in Minimizer" << std::endl;
186 MATH_ERROR_MSG(
"GSLMinimizer1D::Minimize",
"error returned when performing an iteration");
192 std::cout <<
"Min1D - iteration " << iter <<
" interval : [ " <<
fXlow <<
" , " <<
fXup <<
" ] min = " <<
fXmin 193 <<
" fmin " <<
fMin <<
" f(a) " <<
fLow <<
" f(b) " <<
fUp << std::endl;
204 while (status == GSL_CONTINUE && iter < maxIter);
205 if (status == GSL_CONTINUE) {
207 MATH_INFO_MSGVAL(
"GSLMinimizer1D::Minimize",
"exceeded max iterations, reached tolerance is not sufficient",tol);
216 return gsl_min_test_interval(xlow, xup, epsAbs, epsRel);
GSLMinimizer1D & operator=(const GSLMinimizer1D &)
GSLMinimizer1D(Minim1D::Type type=Minim1D::kBRENT)
Construct the minimizer passing the minimizer type using the Minim1D::Algorithm enumeration.
Namespace for new ROOT classes and functions.
bool Minimize(int maxIter, double absTol, double relTol)
Find minimum position iterating until convergence specified by the absolute and relative tolerance or...
GSL1DMinimizerWrapper * fMinimizer
virtual ~GSLMinimizer1D()
Destructor: free allocated resources.
#define MATH_ERROR_MSG(loc, str)
double(* GSLFuncPointer)(double, void *)
Function pointer corresponding to gsl_function signature.
double XLower() const
Return current lower bound of the minimization interval.
double XUpper() const
Return current upper bound of the minimization interval.
static int TestInterval(double xlow, double xup, double epsAbs, double epsRel)
Test convergence of the interval.
int Iterate()
Perform a minimizer iteration and if an unexepcted problem occurr then an error code will be returned...
Minimizer for arbitrary one dimensional functions.
double FValLower() const
Return function value at current lower bound of the minimization interval.
const char * Name() const
Return name of minimization algorithm.
void SetFuncPointer(GSLFuncPointer f)
set in the GSL C struct the pointer to the function evaluation
gsl_min_fminimizer * Get() const
Interface class for numerical methods for one-dimensional minimization.
Namespace for new Math classes and functions.
Wrapper class to the gsl_function C structure.
double FValMinimum() const
Return function value at current estimate of the minimum.
double FValUpper() const
Return function value at current upper bound of the minimization interval.
Type
Enumeration with One Dimensional Minimizer Algorithms.
GSLFunctionWrapper * fFunction
void SetParams(void *p)
set in the GSL C struct the extra-object pointer
wrapper class for gsl_min_fminimizer structure
void SetFunction(const UserFunc &f, double xmin, double xlow, double xup)
Set, or reset, minimizer to use the function f and the initial search interval [xlow, xup], with a guess for the location of the minimum xmin.
#define MATH_INFO_MSGVAL(loc, str, x)
double XMinimum() const
Return current estimate of the position of the minimum.