1 # ifndef CPPAD_CORE_COND_EXP_HPP
2 # define CPPAD_CORE_COND_EXP_HPP
174 template <
class Base>
192 returnValue = if_true;
193 else returnValue = if_false;
198 returnValue = if_true;
199 else returnValue = if_false;
204 returnValue = if_true;
205 else returnValue = if_false;
210 returnValue = if_true;
211 else returnValue = if_false;
216 returnValue = if_true;
217 else returnValue = if_false;
222 returnValue = if_true;
242 if( tape != CPPAD_NULL )
244 returnValue, left, right, if_true, if_false);
253 template <
class Base>
261 {
addr_t ind0, ind1, ind2, ind3, ind4, ind5;
266 returnValue_taddr = Rec_.PutOp(
CExpOp);
278 else returnValue.
taddr_ = returnValue_taddr;
282 ind2 = Rec_.PutPar(left.
value_);
290 ind3 = Rec_.PutPar(right.
value_);
298 ind4 = Rec_.PutPar(if_true.
value_);
306 ind5 = Rec_.PutPar(if_false.
value_);
314 Rec_.PutArg(ind0, ind1, ind2, ind3, ind4, ind5);
322 # define CPPAD_COND_EXP(Name) \
323 template <class Base> \
324 CPPAD_INLINE_FRIEND_TEMPLATE_FUNCTION \
325 AD<Base> CondExp##Name( \
326 const AD<Base> &left , \
327 const AD<Base> &right , \
328 const AD<Base> &if_true , \
329 const AD<Base> &if_false ) \
331 return CondExpOp(Compare##Name, \
332 left, right, if_true, if_false); \
341 template <class Base>
344 const
AD<Base> &flag ,
345 const
AD<Base> &if_true ,
346 const
AD<Base> &if_false )
351 # undef CPPAD_COND_EXP
CPPAD_TAPE_ADDR_TYPE addr_t
size_t NumArg(OpCode op)
Number of arguments for a specified operator.
size_t NumRes(OpCode op)
Number of variables resulting from the specified operation.
bool IdenticalPar(const std::complex< double > &x)
#define CPPAD_INLINE_FRIEND_TEMPLATE_FUNCTION
A version of the inline command that works with MC compiler.
CPPAD_INLINE_FRIEND_TEMPLATE_FUNCTION AD< Base > CondExp(const AD< Base > &flag, const AD< Base > &if_true, const AD< Base > &if_false)
CPPAD_INLINE_FRIEND_TEMPLATE_FUNCTION bool Variable(const AD< Base > &x)
void RecordCondExp(enum CompareOp cop, AD< Base > &returnValue, const AD< Base > &left, const AD< Base > &right, const AD< Base > &trueCase, const AD< Base > &falseCase)
All these operations are done in Rec_, so we should move this routine to recorder<Base>.
#define CPPAD_ASSERT_UNKNOWN(exp)
Check that exp is true, if not terminate execution.
Class used to hold tape that records AD<Base> operations.
CPPAD_INLINE_FRIEND_TEMPLATE_FUNCTION bool Parameter(const AD< Base > &x)
void make_variable(tape_id_t id, addr_t taddr)
#define CPPAD_COND_EXP(Name)
std::complex< double > CondExpOp(enum CppAD::CompareOp cop, const std::complex< double > &left, const std::complex< double > &right, const std::complex< double > &trueCase, const std::complex< double > &falseCase)
local::ADTape< Base > * tape_this(void) const
Get a pointer to tape that records AD<Base> operations for the current thread.