Changeset 3680 for trunk/test_more


Ignore:
Timestamp:
May 7, 2015 3:17:37 PM (5 years ago)
Author:
bradbell
Message:

merge to branch: trunk
from repository: https://github.com/coin-or/CppAD
start hash code: 071875a4beba3363e5fa9752426aec4762cd1caa
end hash code: 0bef506513a519e1073c6279d5c4cba9e5c3b180

commit 0bef506513a519e1073c6279d5c4cba9e5c3b180
Author: Brad Bell <bradbell@…>
Date: Thu May 7 12:14:32 2015 -0700

Add the acosh function (as an atomic operation when defined by compiler).

commit b3264fa17b2f65b65800423a0e243c9c3ccfe06a
Author: Brad Bell <bradbell@…>
Date: Wed May 6 20:25:38 2015 -0700

CMakeLists.txt: Change so test only check for compliation.

commit dcbac4d4f20cc383f2bd9edb02036659df40b791
Author: Brad Bell <bradbell@…>
Date: Wed May 6 15:06:28 2015 -0700

asinh.cpp: check higher orders, relax accuracy on test.

commit 5f8881993fedd18cccc3c74831133a8f8a9d17b0
Author: Brad Bell <bradbell@…>
Date: Wed May 6 14:36:18 2015 -0700

Change Acos to acos.
acos.cpp: remove trailing white space.

commit e828fa1f7c4c3848c727f14b1b7a8030071ee705
Author: Brad Bell <bradbell@…>
Date: Wed May 6 12:07:35 2015 -0700

Change Acos to acos.
acos.cpp: remove redundant index commands, remove trailing with space.

commit 3d16e5b9fe1bdafa4ad01d1d466bb72b792650fa
Author: Brad Bell <bradbell@…>
Date: Wed May 6 11:30:49 2015 -0700

op_code.hpp: Minor edits to AcosOp? commnets.

commit 58beaaad149b4ac29fae44589d7f8900bf8f4c40
Author: Brad Bell <bradbell@…>
Date: Wed May 6 10:51:43 2015 -0700

for_jac_sweep.hpp: Add missing AsinhOp? case.

commit 623c134870c522ae5e80bcf0f89d230902594c80
Author: Brad Bell <bradbell@…>
Date: Wed May 6 10:27:39 2015 -0700

Fix comment about AsinhOp? operator.

commit 226b14f6f4810f5abf1ca247aae541963efaf4d6
Author: Brad Bell <bradbell@…>
Date: Wed May 6 10:14:08 2015 -0700

Add derivative of F to make order zero case clearer.
acos_reverse.omh: Fix some sign errors.
asin_reverse.omh: Fix typo.
acos_forward.omh: Simplify by distributing minus sign.

commit 4682f4ee73e33b600b180086576e986f636a24dc
Author: Brad Bell <bradbell@…>
Date: Wed May 6 08:15:50 2015 -0700

acos_forward.omh: fix sign that depends on acos versus acosh.

commit 906ae10adf019ddda7f57dd165aab08fc55289c4
Author: Brad Bell <bradbell@…>
Date: Wed May 6 07:09:47 2015 -0700

  1. Fix inclusion of some temporary files in package (e.g., git_commit.sh).
  2. Simplify and improve using git ls-files and ls bin/check_*.
  3. Remove trailing white space.

commit 5096f4706a547bd76caa3766aa2c62802ef7f0bf
Author: Brad Bell <bradbell@…>
Date: Wed May 6 06:41:20 2015 -0700

Combine base type documentation for erf, asinh
(will add more functions to this list list).

commit b3535db5ad95bee90672abcaa686032d23bce2fc
Author: Brad Bell <bradbell@…>
Date: Tue May 5 18:01:11 2015 -0700

  1. Change Arc Cosine/Sine? to Inverse Cosine/Sine?.
  2. Change arcsin-> asin and arccos->acos.
  3. Remove index commands that are duplicates of words in titles.


acos_reverse.omh: Add acosh case to this page.

Location:
trunk/test_more
Files:
1 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/test_more/CMakeLists.txt

    r3675 r3680  
    6767        abs.cpp
    6868        acos.cpp
     69        acosh.cpp
    6970        adfun_copy.cpp
    7071        asin.cpp
  • trunk/test_more/acos.cpp

    r2506 r3680  
    11/* $Id$ */
    22/* --------------------------------------------------------------------------
    3 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-12 Bradley M. Bell
     3CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 Bradley M. Bell
    44
    55CppAD is distributed under multiple licenses. This distribution is under
    6 the terms of the 
     6the terms of the
    77                    Eclipse Public License Version 1.0.
    88
     
    1212
    1313/*
    14 Old Acos examples now used just for valiadation testing
     14Old acos examples now used just for valiadation testing
    1515*/
    1616# include <cppad/cppad.hpp>
    1717
    18 bool Acos(void)
     18bool acos(void)
    1919{       bool ok = true;
    2020
     
    2828
    2929        // a temporary values
    30         AD<double> x = cos(U[0]); 
     30        AD<double> x = cos(U[0]);
    3131
    32         // dependent variable vector 
     32        // dependent variable vector
    3333        CPPAD_TESTVECTOR(AD<double>) Z(1);
    3434        Z[0] = acos(x); // acos( cos(u) )
    3535
    3636        // create f: U -> Z and vectors used for derivative calculations
    37         ADFun<double> f(U, Z); 
     37        ADFun<double> f(U, Z);
    3838        CPPAD_TESTVECTOR(double) v(1);
    3939        CPPAD_TESTVECTOR(double) w(1);
    4040
    41         // check value 
     41        // check value
    4242        ok &= NearEqual(U[0] , Z[0],  1e-10 , 1e-10);
    4343
     
    5050        for(j = 1; j < p; j++)
    5151        {       jfac *= j;
    52                 w     = f.Forward(j, v);       
     52                w     = f.Forward(j, v);
    5353                ok &= NearEqual(jfac*w[0], value, 1e-10 , 1e-10); // d^jz/du^j
    5454                v[0]  = 0.;
     
    5757
    5858        // reverse computation of partials of Taylor coefficients
    59         CPPAD_TESTVECTOR(double) r(p); 
     59        CPPAD_TESTVECTOR(double) r(p);
    6060        w[0]  = 1.;
    6161        r     = f.Reverse(p, w);
  • trunk/test_more/asinh.cpp

    r3675 r3680  
    2525        size_t n  = 1;
    2626        double x0 = 0.5;
    27         CPPAD_TESTVECTOR(AD<double>) x(n);
    28         x[0]      = x0;
     27        CPPAD_TESTVECTOR(AD<double>) ax(n);
     28        ax[0]     = x0;
    2929
    3030        // declare independent variables and start tape recording
    31         CppAD::Independent(x);
     31        CppAD::Independent(ax);
    3232
    3333        // a temporary value
    34         AD<double> sinh_of_x0 = CppAD::sinh(x[0]);
     34        AD<double> sinh_of_x0 = CppAD::sinh(ax[0]);
    3535
    3636        // range space vector
    3737        size_t m = 1;
    38         CPPAD_TESTVECTOR(AD<double>) y(m);
    39         y[0] = CppAD::asinh(sinh_of_x0);
     38        CPPAD_TESTVECTOR(AD<double>) ay(m);
     39        ay[0] = CppAD::asinh(sinh_of_x0);
    4040
    4141        // create f: x -> y and stop tape recording
    42         CppAD::ADFun<double> f(x, y);
     42        CppAD::ADFun<double> f(ax, ay);
    4343
    4444        // check value
    45         ok &= NearEqual(y[0] , x0,  eps, eps);
     45        ok &= NearEqual(ay[0] , x0,  eps, eps);
    4646
    4747        // forward computation of first partial w.r.t. x[0]
     
    5252        ok   &= NearEqual(dy[0], 1., eps, eps);
    5353
    54         // forward computation of second partial w.r.t. x[0]
    55         CPPAD_TESTVECTOR(double) ddx(n);
    56         CPPAD_TESTVECTOR(double) ddy(m);
    57         ddx[0] = 0.;
    58         ddy   = f.Forward(2, ddx);
    59         ok   &= NearEqual(ddy[0], 0., eps, eps);
    60 
     54        // forward computation of higher order partials w.r.t. x[0]
     55        size_t n_order = 5;
     56        for(size_t order = 2; order < n_order; order++)
     57        {       dx[0] = 0.;
     58                dy    = f.Forward(order, dx);
     59                ok   &= NearEqual(dy[0], 0., eps, eps);
     60        }
    6161        // reverse computation of derivatives
    6262        CPPAD_TESTVECTOR(double)  w(m);
    63         CPPAD_TESTVECTOR(double) dw(3 * n);
     63        CPPAD_TESTVECTOR(double) dw(n_order * n);
    6464        w[0]  = 1.;
    65         dw    = f.Reverse(3, w);
     65        dw    = f.Reverse(n_order, w);
    6666        ok   &= NearEqual(dw[0], 1., eps, eps);
    67         ok   &= NearEqual(dw[1], 0., eps, eps);
    68         ok   &= NearEqual(dw[2], 0., eps, eps);
     67        for(size_t order = 1; order < n_order; order++)
     68                ok   &= NearEqual(dw[order * n + 0], 0., eps, eps);
    6969
    7070        return ok;
  • trunk/test_more/makefile.am

    r3679 r3680  
    9292        abs.cpp \
    9393        acos.cpp \
     94        acosh.cpp \
    9495        adfun_copy.cpp \
    9596        asin.cpp \
  • trunk/test_more/test_more.cpp

    r3675 r3680  
    1919// prototype external compiled tests (this line expected by bin/new_test.sh)
    2020extern bool abs(void);
    21 extern bool Acos(void);
     21extern bool acos(void);
     22extern bool acosh(void);
    2223extern bool adfun_copy(void);
    2324extern bool Add(void);
     
    135136        // run external compiled tests (this line expected by bin/new_test.sh)
    136137        ok &= Run( abs,             "abs"            );
    137         ok &= Run( Acos,            "Acos"           );
     138        ok &= Run( acos,            "acos"           );
     139        ok &= Run( acosh,           "acosh"          );
    138140        ok &= Run( adfun_copy,      "adfun_copy"     );
    139141        ok &= Run( Add,             "Add"            );
Note: See TracChangeset for help on using the changeset viewer.