Changeset 2993 for trunk/test_more
 Timestamp:
 Oct 23, 2013 8:21:30 AM (6 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

trunk/test_more/optimize.cpp
r2991 r2993 72 72 x[1] = 3.; 73 73 y = f.Forward(0, x); 74 ok 74 ok &= y[0] == x[0]  x[1]; 75 75 76 76 // after optimize can skip either call to g or call to h … … 104 104 105 105 // Create a checkpoint version of the function g 106 vector< AD<double> > ax(2), ay( 1), az(1);106 vector< AD<double> > ax(2), ay(2), az(1); 107 107 ax[0] = 0.; 108 108 ax[1] = 1.; … … 119 119 120 120 // create function object f : ax > az 121 CppAD::ADFun<double> f; 122 f.Dependent(ax, az); 121 CppAD::ADFun<double> f(ax, az); 123 122 124 123 // number of variables before optimization 124 // (include ay[0] and ay[1]) 125 125 size_t n_before = f.size_var(); 126 126 … … 128 128 f.optimize(); 129 129 130 // number of variables before optimization 130 // number of variables after optimization 131 // (does not include ay[0] and ay[1]) 131 132 size_t n_after = f.size_var(); 132 ok &= n_after + 1== n_before;133 ok &= n_after + 2 == n_before; 133 134 134 135 // check optimization works ok … … 137 138 x[1] = 3.; 138 139 z = f.Forward(0, x); 139 ok 140 ok &= z[0] == x[0]  x[1]; 140 141 141 142 return ok; … … 1321 1322 ok &= atomic_cond_exp(); 1322 1323 // check optimizing out atomic arguments 1324 ok &= atomic_no_used(); 1323 1325 ok &= atomic_arguments(); 1324 1326 // check reverse dependency analysis optimization … … 1345 1347 // case where results are not identically equal 1346 1348 ok &= not_identically_equal(); 1347 1349 // 1348 1350 CppAD::user_atomic<double>::clear(); 1349 1351 return ok;
Note: See TracChangeset
for help on using the changeset viewer.