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(nullptr), fFunction(nullptr)
58 const gsl_min_fminimizer_type* T = nullptr ;
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)
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t type
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 FValMinimum() const override
Return function value at current estimate of the minimum.
GSLMinimizer1D & operator=(const GSLMinimizer1D &)
const char * Name() const override
Return name of minimization algorithm.
int Iterate()
Perform a minimizer iteration and if an unexpected problem occurs then an error code will be returned...
GSL1DMinimizerWrapper * fMinimizer
double XLower() const override
Return current lower bound of the minimization interval.
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 XUpper() const override
Return current upper bound of the minimization interval.
double FValUpper() const override
Return function value at current upper bound of the minimization interval.
~GSLMinimizer1D() override
Destructor: free allocated resources.
double FValLower() const override
Return function value at current lower bound of the minimization interval.
GSLFunctionWrapper * fFunction
double XMinimum() const override
Return current estimate of the position of the minimum.
bool Minimize(int maxIter, double absTol, double relTol) override
Find minimum position iterating until convergence specified by the absolute and relative tolerance or...
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.
This file contains a specialised ROOT message handler to test for diagnostic in unit tests.