Prev Next Index-> contents reference index search external Up-> pycppad ad_variable ad_numeric pycppad-> install get_started.py example ad_variable ad_function two_levels.py runge_kutta_4 whats_new license ad_variable-> ad value ad_unary ad_numeric assign_op compare_op std_math abs condexp ad_numeric-> ad_numeric.py future_div_op.py Headings-> Syntax Purpose op Types Arrays Example

Binary Numeric Operators With an AD Result

Syntax
z = x op y

Purpose
Sets z to the result of the binary operation defined by op and with x as the left operand and y as the right operand.

op
The possible values for op are
 op    Meaning + addition - subtraction * multiplication / division ** exponentiation

Types
The following table lists the possible types for x and y and the corresponding result type for z .                        y  x           float    a_float   a2float          -------------------------------  float   -   float    a_float   a2float a_float  -  a_float   a_float a2float  -  a2float             a2float  The type float does not need to be matched exactly but rather as an instance of float.

Arrays
Either x or y or both may be a numpy.array with elements that match one of possible type choices above. If both x and y are arrays, they must have the same shape. When either x or y is an array, the result z is an array with the same shape. The type of the elements of z correspond to the table above (when the result type is a float, this only refers to the element types matching as instances).

Example
The file ad_numeric.py contains an example and test of these operations. The file future_div_op.py contains an example and test of the future division operator
Input File: pycppad/pycppad.cpp