26 #include <DRIVERS/drivers.h> 38 double testFAD(
Timer& timer,
const int n,
const int nloop,
double & yp,
double& errg);
46 const int nloop = 10000;
49 double errg1 = 0., errg2 = 0.;
50 double yp1 = 0.0, yp2 = 0.;
51 double time1 = 0., time2 = 0.;
54 Timer timer(123123000.12);
56 for (
int n=1; n<100; ++n) {
59 testFAD(timer, n, nloop, yp1, errg1);
63 for (
int j=0; j<nbench; ++j)
67 time1 +=
testFAD(timer, n, nloop, yp1, errg1);
68 time2 +=
testADOLC(timer, n, nloop, yp2, errg2);
72 cout.setf(ios::fixed,ios::floatfield);
73 cout << setw(4) << n << setw(12) << time1/(double)nbench << setw(12) << time2/(double)nbench << endl;
86 double *xp =
new double[n];
87 adouble *x =
new adouble[n];
89 double* g =
new double[n];
92 xp[i] = (i+1.0)/(2.0+i);
97 for (k=0; k<
nloop; ++k) {
131 double *xp =
new double[n];
136 xp[i] = (i+1.0)/(2.0+i);
141 for (k=0; k<
nloop; ++k) {
147 y = y+tmp+tmp+tmp+
tmp;
AutoPointerMutexArrayInit tmp
clarg::argInt nloop("-l", "Number of loop iterations of the Subst_Backward/Subst_Forward", 1)
double testADOLC(Timer &timer, const int n, const int nloop, double &yp, double &errg)
double testFAD(Timer &timer, const int n, const int nloop, double &yp, double &errg)