59 cout <<
"Clean Cache" << endl;
62 cout <<
"_Size_____TFad______TinyFad_______Hand_______Member___\n" ;
169 cout.setf(ios::fixed,ios::floatfield);
174 float time1 = 0., time2 = 0., time3 = 0., time4 = 0.;
177 for (j=0; j<ntest; j++){
184 for (i=0; i<
nloop; ++i)
196 for (i=0; i<
nloop; ++i)
204 float z1=2., z2=3., z4;
205 float tz1[Num], tz2[Num], tz4[Num];
209 for (i=0; i<
nloop; ++i) {
211 for (k=0; k<Num; ++k)
212 tz4[k] = tz1[k]+tz2[k];
221 for (i=0; i<
nloop; ++i) {
222 y4.
val() = y1.val() + y2.val();
223 for (k=0; k<Num; ++k)
224 y4.
dx(k) = y1.dx(k) + y2.dx(k);
235 cout << (time4 / time3);
237 cout << (time1 / time3) ;
239 cout << (time2 / time3) <<
"\n";
248 cout.setf(ios::fixed,ios::floatfield);
253 float time1 = 0., time2 = 0., time3 = 0., time4 = 0.;
258 for (j=0; j<ntest; j++){
263 for (i=0; i<
nloop; ++i)
271 TinyFad< Num > y1(2.,0), y2((
float)3.), y3((
float)5.), y4, y5((
float)3.);
275 for (i=0; i<
nloop; ++i)
283 float z1=2., z2=3., z3=5., z4, z5=3.;
284 float tz1[Num], tz2[Num], tz3[Num], tz4[Num], tz5[Num];
288 for (i=0; i<
nloop; ++i) {
290 for (k=0; k<Num; ++k)
291 tz4[k] = tz1[k]+tz2[k]+tz3[k];
300 for (i=0; i<
nloop; ++i) {
301 y4.
val() = y1.val()+y2.val()+y3.val();
302 for (k=0; k<Num; ++k)
303 y4.
dx(k) = y1.dx(k)+y2.dx(k)+y3.dx(k);
314 cout << (time4 / time3);
316 cout << (time1 / time3) ;
318 cout << (time2 / time3) <<
"\n";
327 cout.setf(ios::fixed,ios::floatfield);
332 float time1 = 0., time2 = 0., time3 = 0., time4 = 0.;
335 TFad<Num > x1(2.,0), x2(3.), x3(5.), x4, x5(3.);
337 for (j=0; j<ntest; j++){
342 for (i=0; i<
nloop; ++i)
350 TinyFad< Num > y1(2.,0), y2((
float)3.), y3((
float)5.), y4, y5((
float)3.);
354 for (i=0; i<
nloop; ++i)
362 float z1=2., z2=3., z3=5., z4, z5=3.;
363 float tz1[Num], tz2[Num], tz3[Num], tz4[Num], tz5[Num];
367 for (i=0; i<
nloop; ++i) {
369 for (k=0; k<Num; ++k)
370 tz4[k] = tz1[k]+tz2[k]+tz3[k]+tz3[k];
379 for (i=0; i<
nloop; ++i) {
380 y4.
val() = y1.val()+y2.val()+y3.val()+y3.val();
381 for (k=0; k<Num; ++k)
382 y4.
dx(k) = y1.dx(k)+y2.dx(k)+y3.dx(k)+y3.dx(k);
393 cout << (time4 / time3);
395 cout << (time1 / time3) ;
397 cout << (time2 / time3) <<
"\n";
406 cout.setf(ios::fixed,ios::floatfield);
411 float time1 = 0., time2 = 0., time3 = 0., time4 = 0.;
416 for (j=0; j<ntest; j++){
421 for (i=0; i<
nloop; ++i)
432 for (i=0; i<
nloop; ++i)
440 float z1=2., z2=3., z3=5., z4, z5=3.;
441 float tz1[Num], tz2[Num], tz3[Num], tz4[Num], tz5[Num];
444 for (i=0; i<
nloop; ++i) {
446 for (k=0; k<Num; ++k)
447 tz4[k] = tz1[k]+tz2[k]+tz3[k]+tz3[k]+tz5[k];
457 for (i=0; i<
nloop; ++i) {
458 y4.
val() = y1.val()+y2.val()+y3.val()+y3.val()+y5.
val();
459 for (k=0; k<Num; ++k)
460 y4.
dx(k) = y1.dx(k)+y2.dx(k)+y3.dx(k)+y3.dx(k)+y5.
dx(k);
470 cout << setw(12) << time1 << setw(12) << time2 << setw(12) << time3 << setw(12) << time4 << endl;
479 cout.setf(ios::fixed,ios::floatfield);
484 float time1 = 0., time2 = 0., time3 = 0., time4 = 0.;
489 for (j=0; j<ntest; j++){
494 for (i=0; i<
nloop; ++i)
495 x4 = x1+x2+x3+x3+x5+x1+x2+x3+x3+x5;
502 TinyFad< Num > y1(2.,0), y2((
float)3.), y3((
float)5.), y4, y5((
float)3.);
506 for (i=0; i<
nloop; ++i)
507 y4 = y1+y2+y3+y3+y5+y1+y2+y3+y3+y5;
514 float z1=2., z2=3., z3=5., z4, z5=3.;
515 float tz1[Num], tz2[Num], tz3[Num], tz4[Num], tz5[Num];
519 for (i=0; i<
nloop; ++i) {
520 z4 = z1+z2+z3+z3+z5+z1+z2+z3+z3+z5;
521 for (k=0; k<Num; ++k)
522 tz4[k] = tz1[k]+tz2[k]+tz3[k]+tz3[k]+tz5[k]+tz1[k]+tz2[k]+tz3[k]+tz3[k]+tz5[k];
531 for (i=0; i<
nloop; ++i) {
532 y4.
val() = y1.val()+y2.val()+y3.val()+y3.val()+y5.
val()+y1.val()+y2.val()+y3.val()+y3.val()+y5.
val();
533 for (k=0; k<Num; ++k)
534 y4.
dx(k) = y1.dx(k)+y2.dx(k)+y3.dx(k)+y3.dx(k)+y5.
dx(k)+y1.dx(k)+y2.dx(k)+y3.dx(k)+y3.dx(k)+y5.
dx(k);
544 cout << setw(12) << time1 << setw(12) << time2 << setw(12) << time3 << setw(12) << time4 << endl;
552 cout.setf(ios::fixed,ios::floatfield);
557 float time1 = 0., time2 = 0., time3 = 0., time4 = 0.;
562 for (j=0; j<ntest; j++){
567 for (i=0; i<
nloop; ++i)
568 x4 = x1+x2+x3+x3+x5+x1+x2+x3+x3+x5+x1+x2+x3+x3+x5+x1+x2+x3+x3+x5;
575 TinyFad< Num > y1(2.,0), y2((
float)3.), y3((
float)5.), y4, y5((
float)3.);
579 for (i=0; i<
nloop; ++i)
580 y4 = y1+y2+y3+y3+y5+y1+y2+y3+y3+y5+y1+y2+y3+y3+y5+y1+y2+y3+y3+y5;
587 float z1=2., z2=3., z3=5., z4, z5=3.;
588 float tz1[Num], tz2[Num], tz3[Num], tz4[Num], tz5[Num];
592 for (i=0; i<
nloop; ++i) {
593 z4 = z1+z2+z3+z3+z5+z1+z2+z3+z3+z5+z1+z2+z3+z3+z5+z1+z2+z3+z3+z5;
594 for (k=0; k<Num; ++k)
595 tz4[k] = tz1[k]+tz2[k]+tz3[k]+tz3[k]+tz5[k]+tz1[k]+tz2[k]+tz3[k]+tz3[k]+tz5[k]+tz1[k]+tz2[k]+tz3[k]+tz3[k]+tz5[k]+tz1[k]+tz2[k]+tz3[k]+tz3[k]+tz5[k];
604 for (i=0; i<
nloop; ++i) {
605 y4.
val() = y1.val()+y2.val()+y3.val()+y3.val()+y5.
val()+y1.val()+y2.val()+y3.val()+y3.val()+y5.
val()+y1.val()+y2.val()+y3.val()+y3.val()+y5.
val()+y1.val()+y2.val()+y3.val()+y3.val()+y5.
val();
606 for (k=0; k<Num; ++k)
607 y4.
dx(k) = y1.dx(k)+y2.dx(k)+y3.dx(k)+y3.dx(k)+y5.
dx(k)+y1.dx(k)+y2.dx(k)+y3.dx(k)+y3.dx(k)+y5.
dx(k)+y1.dx(k)+y2.dx(k)+y3.dx(k)+y3.dx(k)+y5.
dx(k)+y1.dx(k)+y2.dx(k)+y3.dx(k)+y3.dx(k)+y5.
dx(k);
617 cout << setw(12) << time1 << setw(12) << time2 << setw(12) << time3 << setw(12) << time4 << endl;
void Bench_10_Op(const TinyFad< Num > &x, const int nloop)
void Bench_1_Op(const TinyFad< Num > &x, const int nloop)
const T & dx(int i) const
void Bench_20_Op(const TinyFad< Num > &x, const int nloop)
clarg::argInt nloop("-l", "Number of loop iterations of the Subst_Backward/Subst_Forward", 1)
void Bench_2_Op(const TinyFad< Num > &x, const int nloop)
void Bench_3_Op(const TinyFad< Num > &x, const int nloop)
void Bench_4_Op(const TinyFad< Num > &x, const int nloop)