/usr/include/cppad/local/mul_eq.hpp is in cppad 2016.00.00.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 | // $Id: mul_eq.hpp 3757 2015-11-30 12:03:07Z bradbell $
# ifndef CPPAD_MUL_EQ_HPP
# define CPPAD_MUL_EQ_HPP
/* --------------------------------------------------------------------------
CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 Bradley M. Bell
CppAD is distributed under multiple licenses. This distribution is under
the terms of the
GNU General Public License Version 3.
A copy of this license is included in the COPYING file of this distribution.
Please visit http://www.coin-or.org/CppAD/ for information on other licenses.
-------------------------------------------------------------------------- */
// BEGIN CppAD namespace
namespace CppAD {
template <class Base>
AD<Base>& AD<Base>::operator *= (const AD<Base> &right)
{
// compute the Base part
Base left;
left = value_;
value_ *= right.value_;
// check if there is a recording in progress
ADTape<Base>* tape = AD<Base>::tape_ptr();
if( tape == CPPAD_NULL )
return *this;
tape_id_t tape_id = tape->id_;
// tape_id cannot match the default value for tape_id_; i.e., 0
CPPAD_ASSERT_UNKNOWN( tape_id > 0 );
bool var_left = tape_id_ == tape_id;
bool var_right = right.tape_id_ == tape_id;
if( var_left )
{ if( var_right )
{ // this = variable * variable
CPPAD_ASSERT_UNKNOWN( NumRes(MulvvOp) == 1 );
CPPAD_ASSERT_UNKNOWN( NumArg(MulvvOp) == 2 );
// put operand addresses in tape
tape->Rec_.PutArg(taddr_, right.taddr_);
// put operator in the tape
taddr_ = tape->Rec_.PutOp(MulvvOp);
// make this a variable
CPPAD_ASSERT_UNKNOWN( tape_id_ == tape_id );
}
else if( IdenticalOne( right.value_ ) )
{ // this = variable * 1
}
else if( IdenticalZero( right.value_ ) )
{ // this = variable * 0
make_parameter();
}
else
{ // this = variable * parameter
// = parameter * variable
CPPAD_ASSERT_UNKNOWN( NumRes(MulpvOp) == 1 );
CPPAD_ASSERT_UNKNOWN( NumArg(MulpvOp) == 2 );
// put operand addresses in tape
addr_t p = tape->Rec_.PutPar(right.value_);
tape->Rec_.PutArg(p, taddr_);
// put operator in the tape
taddr_ = tape->Rec_.PutOp(MulpvOp);
// make this a variable
CPPAD_ASSERT_UNKNOWN( tape_id_ == tape_id );
}
}
else if( var_right )
{ if( IdenticalZero(left) )
{ // this = 0 * right
}
else if( IdenticalOne(left) )
{ // this = 1 * right
make_variable(right.tape_id_, right.taddr_);
}
else
{ // this = parameter * variable
CPPAD_ASSERT_UNKNOWN( NumRes(MulpvOp) == 1 );
CPPAD_ASSERT_UNKNOWN( NumArg(MulpvOp) == 2 );
// put operand addresses in tape
addr_t p = tape->Rec_.PutPar(left);
tape->Rec_.PutArg(p, right.taddr_);
// put operator in the tape
taddr_ = tape->Rec_.PutOp(MulpvOp);
// make this a variable
tape_id_ = tape_id;
}
}
return *this;
}
CPPAD_FOLD_ASSIGNMENT_OPERATOR(*=)
} // END CppAD namespace
# endif
|