30 y[i] = f1->Eval(x[i]);
34 new TCanvas(
"c1",
"Sin(x)", 600, 400);
35 TH2F*
hpx =
new TH2F(
"hpx",
"Sin(x)", NB,
XMIN,
XMAX, NB, -1,1);
39 TGraph* gf =
new TGraph(NB, x, y);
42 gf->SetTitle(
"Function: sin(x)");
45 TGraph *
axis =
new TGraph(NB, x, ceros);
46 axis->SetLineColor(1);
47 axis->SetLineWidth(1);
48 axis->SetLineStyle(2);
49 axis->SetTitle(
"Function: axis");
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 )
89 x = f1->GetX(0,
XMIN, 1);
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 )
105 x = f1->GetX(0, 6,
XMAX);
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 )
170 x = f1->Derivative(i);
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 )
199 x = f1->Integral(0, i);
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.};
228 f1->SetParameters(par);
230 cout <<
"Starting Tests..." << endl;
237 cout <<
"End of Tests..." << endl;
238 cout <<
"Total time for all tests: " <<
sumTime << endl;
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.
int TestDerivative(TF1 *f1)
void Stop()
Stop the stopwatch.
void DrawFunction(TF1 *f1)
static Vc_ALWAYS_INLINE Vector< T > abs(const Vector< T > &x)
int TestIntegral(TF1 *f1)
int PrintStatus(const char *begin, double result, double expected, double time)
double func(double *x, double *p)