Changeset 3008 for trunk/test_more
 Timestamp:
 Nov 13, 2013 9:59:21 AM (6 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

trunk/test_more/optimize.cpp
r3002 r3008 17 17 18 18 namespace { 19 // note this enum type is not part of the API (but its values are) 20 CppAD::atomic_base<double>::option_enum atomic_sparsity_option; 21 // 19 22 //  20 23 // Test nested conditional expressions. … … 84 87 { ay[0] = CondExpGt(ax[0], ax[1], ax[2], ax[3]); } 85 88 86 bool cond_exp_sparsity(void)89 bool atomic_cond_exp_sparsity(void) 87 90 { bool ok = true; 88 91 using CppAD::AD; … … 108 111 // create function object f : ax > ay 109 112 CppAD::ADFun<double> f(ax, ay); 113 110 114 111 115 // now optimize the operation sequence 116 j_check.option( atomic_sparsity_option ); 112 117 f.optimize(); 113 118 … … 174 179 175 180 // before optimize 181 k_check.option( atomic_sparsity_option ); 182 h_check.option( atomic_sparsity_option ); 176 183 ok &= f.number_skip() == 0; 177 184 … … 237 244 238 245 // now optimize the operation sequence 246 g_check.option( atomic_sparsity_option ); 239 247 f.optimize(); 240 248 … … 280 288 281 289 // now optimize f so that the calculation of au[1] is removed 290 g_check.option( atomic_sparsity_option ); 282 291 f.optimize(); 283 292 … … 1426 1435 bool optimize(void) 1427 1436 { bool ok = true; 1437 atomic_sparsity_option = CppAD::atomic_base<double>::bool_sparsity_enum; 1438 for(size_t i = 0; i < 2; i++) 1439 { // check conditional expression sparsity pattern 1440 // (used to optimize calls to atomic functions). 1441 ok &= atomic_cond_exp_sparsity(); 1442 // check optimizing out entire atomic function 1443 ok &= atomic_cond_exp(); 1444 // check optimizing out atomic arguments 1445 ok &= atomic_no_used(); 1446 ok &= atomic_arguments(); 1447 atomic_sparsity_option = 1448 CppAD::atomic_base<double>::set_sparsity_enum; 1449 } 1428 1450 // check nested conditional expressions 1429 1451 ok &= nested_cond_exp(); 1430 // check conditional expression sparsity pattern1431 // (used to optimize calls to atomic functions).1432 ok &= cond_exp_sparsity();1433 // check optimizing out entire atomic function1434 ok &= atomic_cond_exp();1435 // check optimizing out atomic arguments1436 ok &= atomic_no_used();1437 ok &= atomic_arguments();1438 1452 // check reverse dependency analysis optimization 1439 1453 ok &= depend_one();
Note: See TracChangeset
for help on using the changeset viewer.