\(\newcommand{\B}[1]{ {\bf #1} }\) \(\newcommand{\R}[1]{ {\rm #1} }\)
a_double_assign_xam.py#
View page sourcePython: a_double Assignment Operators: Example and Test#
def a_double_assign_xam() :
#
import numpy
import cppad_py
#
# initialize return variable
ok = True
# ---------------------------------------------------------------------
#
ax = cppad_py.a_double(3.0);
ok = ok and ax == 3.0
#
ax += cppad_py.a_double(2.0);
ok = ok and ax == 5.0
#
ax -= 1.0;
ok = ok and ax == cppad_py.a_double(4.0)
#
ax *= cppad_py.a_double(3.0);
ok = ok and ax == 12.0
#
ax /= 4.0;
ok = ok and ax == cppad_py.a_double(3.0)
#
return( ok )
#