29 fLogScan(false), fNIter(0),
31 fXMin(0), fXMax(0), fRoot(0)
63{
return "BrentRootFinder"; }
71 MATH_ERROR_MSG(
"BrentRootFinder::Solve",
"Function has not been set");
76 MATH_ERROR_MSG(
"BrentRootFinder::Solve",
"xmin is <=0 and log scan is set - disable it");
90 int maxIter2 = maxIter;
96 if (niter1 > maxIter1){
97 MATH_ERROR_MSG(
"BrentRootFinder::Solve",
"Search didn't converge");
104 MATH_ERROR_MSG(
"BrentRootFinder",
"Interval does not contain a root");
107 x =
BrentMethods::MinimBrent(
fFunction, 4,
xmin,
xmax,
x,
fy, ok, niter2, absTol, relTol, maxIter2);
#define MATH_ERROR_MSG(loc, str)
bool SetFunction(const ROOT::Math::IGenFunction &f, double xlow, double xup) override
Sets the function for the rest of the algorithms.
bool Solve(int maxIter=100, double absTol=1E-8, double relTol=1E-10) override
Returns the X value corresponding to the function value fy for (xmin<x<xmax).
double fXMin
Lower bound of the search interval.
double fXMax
Upper bound of the search interval.
BrentRootFinder()
Default Constructor.
int fNpx
Number of points to bracket root with initial grid (def is 100)
int fStatus
Status of code of the last estimate.
int fNIter
Number of iterations needed for the last estimation.
bool fLogScan
flag to control usage of a log scan
const IGenFunction * fFunction
Pointer to the function.
double fRoot
Current estimation of the function root.
static void SetDefaultNpx(int npx)
set number of default Npx used at construction time (when SetNpx is not called) Default value is 100
const char * Name() const override
Return name of root finder algorithm ("BrentRootFinder").
static void SetDefaultNSearch(int n)
set number of times the bracketing search in combination with is done to find a good interval Default...
Interface (abstract class) for generic functions objects of one-dimension Provides a method to evalua...
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
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...