Changeset 3060 for trunk/test_more


Ignore:
Timestamp:
Dec 27, 2013 3:38:57 PM (6 years ago)
Author:
bradbell
Message:
  1. Fix warning generated by bug/eigen_mul.sh.
  2. Item 1 required changing arbitrary conversion to AD<Base> to be explicit.
  3. Item 2 required some explicit type conversions.

base_require.hpp: remove trailing slash in documentaiton.
ad.hpp: comment about explicit and implicit constructors.

Location:
trunk/test_more
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/test_more/cppad_eigen.cpp

    r3022 r3060  
    2222        using CppAD::AD;
    2323        using Eigen::Dynamic;
     24        using Eigen::Matrix;
    2425
    2526        typedef Eigen::NumTraits<AD<double> >         traits;
     
    4849        ok  &= abs2(x)  == 4.0;
    4950
    50         // Outputing a matrix used to fail before paritali specialization of
     51        // Outputing a matrix used to fail before partial specialization of
    5152        // struct significant_decimals_default_impl in cppad_eigen.hpp.
    52         Eigen::Matrix< AD<double>, 1, 1> X;
     53        Matrix< AD<double>, 1, 1> X;
    5354        X(0, 0) = AD<double>(1);
    5455        std::stringstream stream_out;
    5556        stream_out << X;
    5657        ok &= "1" == stream_out.str();
     58
     59        // multiplying three matrices together used to cause warning
     60        // before making ctor from arbitrary type to AD<Base> explicit.
     61        typedef CppAD::AD<double> AScalar;
     62        Matrix<AScalar, Dynamic, Dynamic> A(1,1), B(1,1), C(1,1), D(1,1);
     63        A(0,0) = 1.0;
     64        B(0,0) = 2.0;
     65        C(0,0) = 3.0;
     66        D      = A * B * C;
     67        ok    &= D(0,0) == 6.0 ;
    5768       
    5869        return ok;
  • trunk/test_more/erf.cpp

    r2506 r3060  
    11/* $Id$ */
    22/* --------------------------------------------------------------------------
    3 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-12 Bradley M. Bell
     3CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-13 Bradley M. Bell
    44
    55CppAD is distributed under multiple licenses. This distribution is under
     
    5858
    5959                // test using erf with AD< AD<double> >
    60                 AD< AD<double> > X0 = x[0];
     60                AD< AD<double> > X0 = AD<double>( x[0] );
    6161                AD< AD<double> > Y0 = erf(X0);
    6262
  • trunk/test_more/romberg_one.cpp

    r2506 r3060  
    11/* $Id$ */
    22/* --------------------------------------------------------------------------
    3 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-12 Bradley M. Bell
     3CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-13 Bradley M. Bell
    44
    55CppAD is distributed under multiple licenses. This distribution is under
     
    4646                Float operator () (const Float &x)
    4747                {       size_t i;
    48                         Float   f = 1;
     48                        Float   f(1);
    4949                        for(i = 0; i < degree; i++)
    5050                                f *= x;
     
    6262
    6363                // arguments to RombergOne
    64                 Float a = 0.;
    65                 Float b = 1.;
     64                Float a(0);
     65                Float b(1);
    6666                Float r;
    6767                size_t n = 4;
     
    7171                // int_a^b F(x) dx =
    7272                //      [ b^(degree+1) - a^(degree+1) ] / (degree+1)
    73                 Float bpow = 1.;
    74                 Float apow = 1.;
     73                Float bpow(1);
     74                Float apow(1);
    7575                for(i = 0; i <= degree; i++)
    7676                {       bpow *= b;
     
    8484                step *= Float(2.);
    8585                // step size raised to a power
    86                 Float spow = Float(1.);
     86                Float spow = Float(1);
    8787
    8888                for(p = 0; p < n; p++)
  • trunk/test_more/std_math.cpp

    r2506 r3060  
    11/* $Id$ */
    22/* --------------------------------------------------------------------------
    3 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-07 Bradley M. Bell
     3CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-13 Bradley M. Bell
    44
    55CppAD is distributed under multiple licenses. This distribution is under
     
    2323{       using CppAD::NearEqual;
    2424        bool ok = true;
    25         ADDdouble half   = .5;
    26         ADDdouble one    = 1.;
    27         ADDdouble two    = 2.;
    28         ADDdouble ten    = 10.;
    29         ADDdouble small  = 1e-6;
    30         ADDdouble pi_4   = 3.141592653 / 4.;
    31         ADDdouble root_2 =  sqrt(two);
     25        ADDdouble half(.5);
     26        ADDdouble one(1.);
     27        ADDdouble two(2.);
     28        ADDdouble ten(10.);
     29        ADDdouble small(1e-6);
     30        ADDdouble pi_4(3.141592653 / 4.);
     31        ADDdouble root_2( sqrt(two) );
    3232
    33         ADDdouble y = acos(one / root_2);
     33        ADDdouble y( acos(one / root_2) );
    3434        ok &= NearEqual( pi_4, y, small, small );
    3535
Note: See TracChangeset for help on using the changeset viewer.