/home/coin/SVN-release/CoinAll-1.1.0/cppad/cppad/local/sub_eq.hpp

Go to the documentation of this file.
00001 # ifndef CPPAD_SUB_EQ_INCLUDED
00002 # define CPPAD_SUB_EQ_INCLUDED
00003 
00004 /* --------------------------------------------------------------------------
00005 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-07 Bradley M. Bell
00006 
00007 CppAD is distributed under multiple licenses. This distribution is under
00008 the terms of the 
00009                     Common Public License Version 1.0.
00010 
00011 A copy of this license is included in the COPYING file of this distribution.
00012 Please visit http://www.coin-or.org/CppAD/ for information on other licenses.
00013 -------------------------------------------------------------------------- */
00014 
00015 //  BEGIN CppAD namespace
00016 namespace CppAD {
00017 
00018 template <class Base>
00019 AD<Base>& AD<Base>::operator -= (const AD<Base> &right)
00020 {       Base left;
00021 
00022         left   = value_;
00023         value_ -= right.value_;
00024 
00025         if( Parameter(*this) )
00026         {       if( Variable(right) )
00027                 {       right.tape_this()->RecordOp(SubpvOp, 
00028                                 *this, left, right.taddr_
00029                         );
00030                 }
00031         }
00032         else if( Parameter(right) )
00033         {       if( ! IdenticalZero(right) )
00034                 {       tape_this()->RecordOp(SubvpOp, 
00035                                 *this, taddr_, right.value_
00036                         );
00037                 }
00038         }
00039         else
00040         {       CPPAD_ASSERT_KNOWN(
00041                         id_ == right.id_,
00042                         "Subtracting AD objects that are"
00043                         " variables on different tapes."
00044                 );
00045                 tape_this()->RecordOp(SubvvOp, 
00046                         *this, taddr_, right.taddr_
00047                 );
00048         }
00049         return *this;
00050 }
00051 
00052 CPPAD_FOLD_ASSIGNMENT_OPERATOR(-=)
00053 
00054 } // END CppAD namespace
00055 
00056 # endif 

Generated on Sun Nov 14 14:06:33 2010 for Coin-All by  doxygen 1.4.7