CppAD: A C++ Algorithmic Differentiation Package  20171217
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
#define CPPAD_STANDARD_MATH_UNARY_AD (   Name,
  Op 
)
Value:
template <class Base> \
inline AD<Base> Name(const AD<Base> &x) \
{ return x.Name##_me(); } \
template <class Base> \
inline AD<Base> AD<Base>::Name##_me (void) const \
{ \
AD<Base> result; \
result.value_ = CppAD::Name(value_); \
\
if( Variable(*this) ) \
{ CPPAD_ASSERT_UNKNOWN( NumArg(Op) == 1 ); \
local::ADTape<Base> *tape = tape_this(); \
tape->Rec_.PutArg(taddr_); \
result.taddr_ = tape->Rec_.PutOp(Op); \
result.tape_id_ = tape->id_; \
} \
return result; \
} \
template <class Base> \
inline AD<Base> Name(const VecAD_reference<Base> &x) \
{ return x.ADBase().Name##_me(); }
size_t NumArg(OpCode op)
Number of arguments for a specified operator.
Definition: op_code.hpp:175
CPPAD_INLINE_FRIEND_TEMPLATE_FUNCTION bool Variable(const AD< Base > &x)
Definition: par_var.hpp:99
#define CPPAD_ASSERT_UNKNOWN(exp)
Check that exp is true, if not terminate execution.
CPPAD_INLINE_FRIEND_TEMPLATE_FUNCTION bool Parameter(const AD< Base > &x)
Definition: par_var.hpp:80

Defines function Name with argument type AD<Base> and tape operation Op.

The macro defines the function x.Name() where x has type AD<Base>. It then uses this funciton to define Name(x) where x has type AD<Base> or VecAD_reference<Base>.

If x is a variable, the tape unary operator Op is used to record the operation and the result is identified as correspoding to this operation; i.e., Name(x).taddr_ idendifies the operation and Name(x).tape_id_ identifies the tape.

This macro is used to define AD<Base> versions of acos, asin, atan, cos, cosh, exp, fabs, log, sin, sinh, sqrt, tan, tanh.

Definition at line 492 of file std_math_98.hpp.