Changeset 3638 for trunk/test_more
 Timestamp:
 Feb 10, 2015 10:04:04 AM (5 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

trunk/test_more/optimize.cpp
r3637 r3638 543 543 return ok; 544 544 } 545 bool depend_four(void) 546 { // erf function is a special case for optimize 547 bool ok = true; 548 # if CPPAD_COMPILER_HAS_ERF 549 using CppAD::AD; 550 using CppAD::vector; 551 552 size_t n = 1; 553 size_t m = 1; 554 vector< AD<double> > X(n), Y(m); 555 vector<double> x(n); 556 X[0] = x[0] = double(0.5); 557 558 CppAD::Independent(X); 559 560 Y[0] = erf(X[0]) + erf(X[0]); 561 562 CppAD::ADFun<double> F(X, Y); 563 564 vector<double> y_original = F.Forward(0, x); 565 size_t size_original = F.size_var(); 566 F.optimize(); 567 ok &= F.size_var() + 5 == size_original; 568 vector<double> y = F.Forward(0, x); 569 ok &= NearEqual(y[0], y_original[0], eps, eps); 570 # endif 571 return ok; 572 } 545 573 // =================================================================== 546 574 // Test duplicate operation analysis … … 1649 1677 ok &= depend_two(); 1650 1678 ok &= depend_three(); 1679 ok &= depend_four(); 1651 1680 // check removal of duplicate expressions 1652 1681 ok &= duplicate_one();
Note: See TracChangeset
for help on using the changeset viewer.