26namespace BrentMethods {
65 for (
int i=1; i<=
npx-1; i++) {
74 y = (*function)(
x)-
fy;
91 if (std::copysign(1.,
y)*std::copysign(1.,
yymin) < 0 ) {
116 MATH_INFO_MSG(
"BrentMethods::MinimStep",
"Grid search failed to find a root in the interval ");
117 std::string
msg =
"xmin = ";
119 msg += std::string(
" xmax = ");
121 msg += std::string(
" npts = ");
130 double MinimBrent(
const IGenFunction*
function,
int type,
double &
xmin,
double &
xmax,
double xmiddle,
double fy,
bool &ok,
int &
niter,
double epsabs,
double epsrel,
int itermax)
146 const double c = 3.81966011250105097e-01;
147 double u,
v,
w,
x,
fv,
fu,
fw,
fx,
e,
p,
q,
r,
t2,
d=0,
m,
tol;
156 fv =
fw =
fx = -(*function)(
x);
165 if (std::fabs(
x-
m) <= (
t2-0.5*(
b-
a))) {
177 if (std::fabs(
e)>
tol){
191 if (std::fabs(
p) >= std::fabs(0.5*
q*
r) ||
p <=
q*(
a-
x) ||
p >=
q*(
b-
x)) {
201 d=(
m-
x >= 0) ? std::fabs(
tol) : -std::fabs(
tol);
207 u = (std::fabs(
d)>=
tol ?
x+
d :
x+ ((
d >= 0) ? std::fabs(
tol) : -std::fabs(
tol)) );
211 fu = -(*function)(
u);
#define MATH_INFO_MSG(loc, str)
Pre-processor macro to report messages which can be configured to use ROOT error or simply an std::io...
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
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 r
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
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...
std::string ToString(const T &val)
Utility function for conversion to strings.
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...