Changeset 3720


Ignore:
Timestamp:
Sep 3, 2015 10:49:42 AM (4 years ago)
Author:
bradbell
Message:

merge to branch: trunk
from repository: https://github.com/coin-or/CppAD
start hash code: a110d7f6ee5cb9393a4c96e7a94de14ced36aeb1
end hash code: a2ae3a72194537866d9c632b4fecd8623246c7cc

commit a2ae3a72194537866d9c632b4fecd8623246c7cc
Author: Brad Bell <bradbell@…>
Date: Thu Sep 3 07:48:10 2015 -0700

Test for and fix bug in vectorBool assignment to a vector of size zero.
whats_new_15.omh: edit discussion of dependency change.

commit 136696a1db13a3c1faeb6990186dea3854b112f9
Author: Brad Bell <bradbell@…>
Date: Wed Sep 2 11:43:45 2015 -0700

advec_depend.sh: This bug has been fixed.

Location:
trunk
Files:
1 deleted
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/cppad/vector.hpp

    r3708 r3720  
    435435        )
    436436        {       size_t i;
    437                 // If original lenght is zero, then resize
    438                 // otherwise a length mismatch is an error.
     437                // If original lenght is zero, then resize it.
     438                // Otherwise a length mismatch is an error.
    439439                if( length_ == 0 )
    440440                        resize( x.length_ );
     
    751751        )
    752752        {       size_t i;
     753                // If original lenght is zero, then resize it.
     754                // Otherwise a length mismatch is an error.
     755                if( length_ == 0 )
     756                        resize( v.length_ );
    753757                CPPAD_ASSERT_KNOWN(
    754758                        length_ == v.length_ ,
     
    768772                vectorBool&& x
    769773        )
    770         {       if( this != &x )
     774        {       CPPAD_ASSERT_KNOWN(
     775                        length_ == x.length_ || (length_ == 0),
     776                        "vectorBool: size miss match in assignment operation"
     777                );
     778                if( this != &x )
    771779                {       clear();
    772780                        //
  • trunk/example/vector_bool.cpp

    r2506 r3720  
    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
     
    4343        using CppAD::vectorBool;
    4444
    45         vectorBool x;          // default constructor 
     45        vectorBool x;          // default constructor
    4646        ok &= (x.size() == 0);
    4747
     
    6161        ok &= (x[0] == true);
    6262
    63         x = y = z;              // vector assignment
     63        // resize x to zero and check that vector assignment works for both
     64        // size zero and mathching sizes
     65        x.resize(0);
     66        ok &= (x.size() == 0);
     67        ok &= (y.size() == z.size());
     68        //
     69        x = y = z;
    6470        ok &= ( (x[0] == false) && (x[1] == true) );
    6571        ok &= ( (y[0] == false) && (y[1] == true) );
  • trunk/omh/whats_new/whats_new_15.omh

    r3719 r3720  
    6464assist you in learning about changes between various versions of CppAD.
    6565
     66$head 09-03$$
     67There was a bug in the $cref/vectorBool/CppAD_vector/vectorBool/$$
     68$cref/assignment/CppAD_vector/Assignment/$$.
     69To be specific,
     70it not allow a size zero vector to be assigned using a vector any other size.
     71This has been fixed.
     72
    6673$head 09-02$$
    6774The $cref/dependency pattern/dependency.cpp/Dependency Pattern/$$
     
    6976$cref sign$$, $cref Discrete$$, and $cref VecAD$$ operations.
    7077This has been fixed.
    71 (It could have caused problems using $cref optimize$$ with an $cref ADFun$$
    72 that used any of these operations.)
     78This could have caused problems using
     79$cref checkpoint$$ functions that used any of these operations.
    7380
    7481$head 08-31$$
Note: See TracChangeset for help on using the changeset viewer.