Prev Next Index-> contents reference index search external Up-> CppAD AD base_require base_std_math CppAD-> Install Introduction AD ADFun preprocessor multi_thread utility ipopt_solve Example speed Appendix AD-> ad_ctor ad_assign Convert ADValued BoolValued VecAD base_require base_require-> base_member base_cond_exp base_identical base_ordered base_std_math base_limits base_to_string base_hash base_example base_std_math Headings-> Purpose Unary Standard Math CPPAD_STANDARD_MATH_UNARY erf, asinh, acosh, atanh, expm1, log1p sign pow isnan

$\newcommand{\W}[1]{ \; #1 \; } \newcommand{\R}[1]{ {\rm #1} } \newcommand{\B}[1]{ {\bf #1} } \newcommand{\D}[2]{ \frac{\partial #1}{\partial #2} } \newcommand{\DD}[3]{ \frac{\partial^2 #1}{\partial #2 \partial #3} } \newcommand{\Dpow}[2]{ \frac{\partial^{#1}}{\partial {#2}^{#1}} } \newcommand{\dpow}[2]{ \frac{ {\rm d}^{#1}}{{\rm d}\, {#2}^{#1}} }$
Base Type Requirements for Standard Math Functions

Purpose
These definitions are required for the user's code to use the type AD<Base> :

Unary Standard Math
The type Base must support the following functions unary standard math functions (in the CppAD namespace):
 Syntax Result y = abs(x) absolute value y = acos(x) inverse cosine y = asin(x) inverse sine y = atan(x) inverse tangent y = cos(x) cosine y = cosh(x) hyperbolic cosine y = exp(x) exponential y = fabs(x) absolute value y = log(x) natural logarithm y = sin(x) sine y = sinh(x) hyperbolic sine y = sqrt(x) square root y = tan(x) tangent
where the arguments and return value have the prototypes       const Base& x      Base        y  For example, base_alloc ,

CPPAD_STANDARD_MATH_UNARY
The macro invocation, within the CppAD namespace,       CPPAD_STANDARD_MATH_UNARY(Base, Fun)  defines the syntax       y = CppAD::Fun(x)  This macro uses the functions std::Fun which must be defined and have the same prototype as CppAD::Fun . For example, float .

erf, asinh, acosh, atanh, expm1, log1p
If this preprocessor symbol CPPAD_USE_CPLUSPLUS_2011 is true (1), when compiling for c++11, the type double is supported for the functions listed below. In this case, the type Base must also support these functions:
 Syntax Result y = erf(x) error function y = asinh(x) inverse hyperbolic sin y = acosh(x) inverse hyperbolic cosine y = atanh(x) inverse hyperbolic tangent y = expm1(x) exponential of x minus one y = log1p(x) logarithm of one plus x
where the arguments and return value have the prototypes       const Base& x      Base        y 
sign
The type Base must support the syntax       y = CppAD::sign(x)  which computes $$y = \left\{ \begin{array}{ll} +1 & {\rm if} \; x > 0 \\ 0 & {\rm if} \; x = 0 \\ -1 & {\rm if} \; x < 0 \end{array} \right.$$ where x and y have the same prototype as above. For example, see base_alloc . Note that, if ordered comparisons are not defined for the type Base , the code sign function should generate an assert if it is used; see complex invalid unary math .

pow
The type Base must support the syntax       z = CppAD::pow(x, y)  which computes $z = x^y$. The arguments x and y have prototypes       const Base& x      const Base& y  and the return value z has prototype       Base z  For example, see base_alloc .

isnan
If Base defines the isnan function, you may also have to provide a definition in the CppAD namespace (to avoid a function ambiguity). For example, see base_complex .
Input File: cppad/core/base_std_math.hpp