46 fLogScan(false), fNIter(0),
48 fXMin(0), fXMax(0), fXMinimum(0)
96 MATH_ERROR_MSG(
"BrentMinimizer1D::Minimize",
"Function has not been set");
101 MATH_ERROR_MSG(
"BrentMinimizer1D::Minimize",
"xmin is < 0 and log scan is set - disable it");
112 int maxIter2 = maxIter;
118 if (niter1 > maxIter1){
119 MATH_ERROR_MSG(
"BrentMinimizer1D::Minimize",
"Search didn't converge");
124 x =
BrentMethods::MinimBrent(
fFunction, 0,
xmin,
xmax,
x, 0, ok, niter2, absTol, relTol, maxIter2 );
136{
return "BrentMinimizer1D"; }
#define MATH_ERROR_MSG(loc, str)
const IGenFunction * fFunction
Pointer to the function.
static void SetDefaultNSearch(int n)
set number of times the bracketing search in combination with is done to find a good interval Default...
double FValLower() const override
Return function value at current lower bound of the minimization interval.
double fXMax
Upper bound of the search interval.
double FValUpper() const override
Return function value at current upper bound of the minimization interval.
int fNpx
Number of points to bracket minimum with grid (def is 100)
double fXMin
Lower bound of the search interval.
void SetFunction(const ROOT::Math::IGenFunction &f, double xlow, double xup)
Sets function to be minimized.
int fNIter
Number of iterations needed for the last estimation.
bool Minimize(int maxIter, double absTol=1.E-8, double relTol=1.E-10) override
Find minimum position iterating until convergence specified by the absolute and relative tolerance or...
static void SetDefaultNpx(int npx)
set number of default Npx used at construction time (when SetNpx is not called) Default value is 100
bool fLogScan
flag to control usage of a log scan
int fStatus
Status of code of the last estimate.
double fXMinimum
Position of the estimated minimum.
BrentMinimizer1D()
Default Constructor.
const char * Name() const override
Return name of minimization algorithm ("BrentMinimizer1D")
double FValMinimum() const override
Return function value at current estimate of the minimum.
Interface (abstract class) for generic functions objects of one-dimension Provides a method to evalua...
Interface class for numerical methods for one-dimensional minimization.
Namespace for new Math classes and functions.
double MinimStep(const IGenFunction *f, int type, double &xmin, double &xmax, double fy, int npx=100, bool useLog=false)
Grid search implementation, used to bracket the minimum and later use Brent's method with the bracket...
double MinimBrent(const IGenFunction *f, int type, double &xmin, double &xmax, double xmiddle, double fy, bool &ok, int &niter, double epsabs=1.E-8, double epsrel=1.E-10, int maxiter=100)
Finds a minimum of a function, if the function is unimodal between xmin and xmax This method uses a c...
static int gDefaultNSearch
This file contains a specialised ROOT message handler to test for diagnostic in unit tests.