Changeset 3638 for trunk/test_more


Ignore:
Timestamp:
Feb 10, 2015 10:04:04 AM (5 years ago)
Author:
bradbell
Message:

merge to branch: trunk
from repository: https://github.com/coin-or/CppAD
start hash code: 3249a4c6f8216de001805d3e22bcdec63fed2d25
end hash code: 22c1453e46e3eb16e9a96d679a0a1fd459c849c0

commit 22c1453e46e3eb16e9a96d679a0a1fd459c849c0
Author: Brad Bell <bradbell@…>
Date: Tue Feb 10 07:19:54 2015 -0700

Fix bug in optimization and sparsity calculations that include the C++11 erf function.

commit df8602cb2129722c0b373fa467a76289769c026e
Author: Brad Bell <bradbell@…>
Date: Mon Feb 9 20:25:19 2015 -0700

erf.sh: Bug report by Micheal Braun.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test_more/optimize.cpp

    r3637 r3638  
    543543                return ok;
    544544        }
     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        }
    545573        // ===================================================================
    546574        // Test duplicate operation analysis
     
    16491677        ok     &= depend_two();
    16501678        ok     &= depend_three();
     1679        ok     &= depend_four();
    16511680        // check removal of duplicate expressions
    16521681        ok     &= duplicate_one();
Note: See TracChangeset for help on using the changeset viewer.