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);
#define MATH_INFO_MSGVAL(loc, txt, x)
#define MATH_ERROR_MSG(loc, str)
wrapper class for gsl_min_fminimizer structure
gsl_min_fminimizer * Get() const
Wrapper class to the gsl_function C structure.
void SetFuncPointer(GSLFuncPointer f)
set in the GSL C struct the pointer to the function evaluation
void SetParams(void *p)
set in the GSL C struct the extra-object pointer
Minimizer for arbitrary one dimensional functions.
double XLower() const
Return current lower bound of the minimization interval.
double XUpper() const
Return current upper bound of the minimization interval.
GSLMinimizer1D & operator=(const GSLMinimizer1D &)
const char * Name() const
Return name of minimization algorithm.
double XMinimum() const
Return current estimate of the position of the minimum.
bool Minimize(int maxIter, double absTol, double relTol)
Find minimum position iterating until convergence specified by the absolute and relative tolerance or...
int Iterate()
Perform a minimizer iteration and if an unexepcted problem occurr then an error code will be returned...
GSL1DMinimizerWrapper * fMinimizer
static int TestInterval(double xlow, double xup, double epsAbs, double epsRel)
Test convergence of the interval.
GSLMinimizer1D(Minim1D::Type type=Minim1D::kBRENT)
Construct the minimizer passing the minimizer type using the Minim1D::Algorithm enumeration.
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,...
double FValMinimum() const
Return function value at current estimate of the minimum.
virtual ~GSLMinimizer1D()
Destructor: free allocated resources.
double FValLower() const
Return function value at current lower bound of the minimization interval.
GSLFunctionWrapper * fFunction
double FValUpper() const
Return function value at current upper bound of the minimization interval.
Interface class for numerical methods for one-dimensional minimization.
Type
Enumeration with One Dimensional Minimizer Algorithms.
Namespace for new Math classes and functions.
double(* GSLFuncPointer)(double, void *)
Function pointer corresponding to gsl_function signature.