30 y[i] = f1->
Eval(x[i]);
34 new TCanvas(
"c1",
"Sin(x)", 600, 400);
56 double difference = std::abs(result-expected);
57 string passed =
"FALSE";
59 if ( difference < 1
E-7 )
62 cout << begin <<
" Obtained: ";
64 cout << result <<
" Expected: ";
66 cout << expected <<
" Difference: ";
68 cout << difference <<
" Time: ";
70 cout << time <<
" (micros/call) .............." << passed
73 return passed !=
"OK";
84 <<
"---------------------------------------------------------" 88 for (
int j = 0; j <
REP; ++j )
96 for (
int j = 0; j <
REP; ++j )
97 x = f1->
GetX(0, 2.5, 3.5);
104 for (
int j = 0; j <
REP; ++j )
111 cout <<
"Total Time: " << totalTime << endl;
120 double x = 0., maxmin;
123 double totalTime = 0;
125 cout <<
"MAXMIN TEST\n" 126 <<
"---------------------------------------------------------" 130 for (
int j = 0; j <
REP; ++j ) {
137 std::cout <<
"ncall = " <<
ncall << std::endl;
141 for (
int j = 0; j <
REP; ++j )
148 cout <<
"Total Time: " << totalTime << endl;
157 double x = 0., derivative;
160 double totalTime = 0;
162 cout <<
"Derivative TEST\n" 163 <<
"---------------------------------------------------------" 166 for (
double i =
XMIN; i <
XMAX; i += 1.5 )
169 for (
int j = 0; j <
REP; ++j )
177 cout <<
"Total Time: " << totalTime << endl;
186 double x = 0., integral;
189 double totalTime = 0;
191 cout <<
"Integral TEST\n" 192 <<
"---------------------------------------------------------" 195 for (
double i =
XMIN; i <
XMAX; i += 1.5 )
198 for (
int j = 0; j <
REP/10; ++j )
206 cout <<
"Total Time: " << totalTime << endl;
213 double func(
double *
x,
double * p) {
217 return p[0]*
sin(xx) + p[1];
227 double par[2] = {1.,0.};
230 cout <<
"Starting Tests..." << endl;
237 cout <<
"End of Tests..." << endl;
238 cout <<
"Total time for all tests: " <<
sumTime << endl;
virtual void SetLineWidth(Width_t lwidth)
Set the line width.
virtual void SetParameters(const Double_t *params)
Double_t RealTime()
Stop the stopwatch (if it is running) and return the realtime (in seconds) passed between the start a...
void Start(Bool_t reset=kTRUE)
Start the stopwatch.
virtual Double_t GetMinimumX(Double_t xmin=0, Double_t xmax=0, Double_t epsilon=1.E-10, Int_t maxiter=100, Bool_t logx=false) const
Returns the X value corresponding to the minimum value of the function on the (xmin, xmax) interval.
int TestDerivative(TF1 *f1)
virtual Double_t GetMaximumX(Double_t xmin=0, Double_t xmax=0, Double_t epsilon=1.E-10, Int_t maxiter=100, Bool_t logx=false) const
Returns the X value corresponding to the maximum value of the function.
virtual void SetTitle(const char *title="")
Set graph title.
virtual Double_t Integral(Double_t a, Double_t b, Double_t epsrel=1.e-12)
IntegralOneDim or analytical integral.
virtual void Draw(Option_t *chopt="")
Draw this graph with its current attributes.
virtual Double_t Derivative(Double_t x, Double_t *params=0, Double_t epsilon=0.001) const
Returns the first derivative of the function at point x, computed by Richardson's extrapolation metho...
void Stop()
Stop the stopwatch.
void DrawFunction(TF1 *f1)
int TestIntegral(TF1 *f1)
int PrintStatus(const char *begin, double result, double expected, double time)
virtual void SetLineColor(Color_t lcolor)
Set the line color.
virtual void Draw(Option_t *option="")
Draw this histogram with options.
tomato 2-D histogram with a float per channel (see TH1 documentation)}
virtual Double_t Eval(Double_t x, Double_t y=0, Double_t z=0, Double_t t=0) const
Evaluate this function.
double func(double *x, double *p)
virtual Double_t GetX(Double_t y, Double_t xmin=0, Double_t xmax=0, Double_t epsilon=1.E-10, Int_t maxiter=100, Bool_t logx=false) const
Returns the X value corresponding to the function value fy for (xmin<x<xmax).
virtual void SetLineStyle(Style_t lstyle)
Set the line style.
A Graph is a graphics object made of two arrays X and Y with npoints each.
THist< 2, float, THistStatContent, THistStatUncertainty > TH2F
virtual void SetStats(Bool_t stats=kTRUE)
Set statistics option on/off.