00001 # ifndef CPPAD_MUL_EQ_INCLUDED
00002 # define CPPAD_MUL_EQ_INCLUDED
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
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 { if( ! IdenticalZero(left) )
00028 { if( IdenticalOne(left) )
00029 {
00030 make_variable(right.id_, right.taddr_);
00031 }
00032 else right.tape_this()->RecordOp(
00033 MulpvOp,
00034 *this,
00035 left,
00036 right.taddr_
00037 );
00038 }
00039 }
00040 }
00041 else if( Parameter(right) )
00042 { if( ! IdenticalOne(right.value_) )
00043 { if( IdenticalZero(right.value_) )
00044 make_parameter();
00045 else tape_this()->RecordOp(MulvpOp,
00046 *this, taddr_, right.value_
00047 );
00048 }
00049 }
00050 else
00051 { CPPAD_ASSERT_KNOWN(
00052 id_ == right.id_,
00053 "Multiplying AD objects that are"
00054 " variables on different tapes."
00055 );
00056 tape_this()->RecordOp(MulvvOp,
00057 *this, taddr_, right.taddr_
00058 );
00059 }
00060 return *this;
00061 }
00062
00063 CPPAD_FOLD_ASSIGNMENT_OPERATOR(*=)
00064
00065 }
00066
00067 # endif