40 return "ModABRootFinder";
46 return (
x > 0) - (
x < 0);
55 MATH_ERROR_MSG(
"ModABRootFinder::Solve",
"Function has not been set");
71 MATH_ERROR_MSG(
"ModABRootFinder::Solve",
"Function values at the interval endpoints have the same sign");
78 for (
int i = 1; i <=
maxIter; ++i) {
82 y3 = (*fFunction)(
x3);
83 double ym = (
y1 +
y2) / 2.0;
84 double r = 1 - std::fabs(
ym / (
y2 -
y1));
86 if (std::fabs(
ym -
y3) < k * (std::fabs(
y3) + std::fabs(
ym))) {
97 }
else if (
x3 >=
x2) {
101 y3 = (*fFunction)(
x3);
108 if (std::fabs(
y3) == 0.0 ||
x2 -
x1 <= eps) {
114 double m = 1 -
y3 /
y1;
126 double m = 1 -
y3 /
y2;
143 MATH_ERROR_MSG(
"ModABRootFinder::Solve",
"Search didn't converge");
#define MATH_ERROR_MSG(loc, str)
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
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 r
Option_t Option_t TPoint TPoint const char x2
Option_t Option_t TPoint TPoint const char x1
Option_t Option_t TPoint TPoint const char y2
Option_t Option_t TPoint TPoint const char y1
Interface (abstract class) for generic functions objects of one-dimension Provides a method to evalua...
const char * Name() const override
Return name of root finder algorithm ("ModABRootFinder").
const IGenFunction * fFunction
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).
bool SetFunction(const ROOT::Math::IGenFunction &f, double xlow, double xup) override
Sets the function for the rest of the algorithms.