Prev | Next | compare_op.py | Headings |
from pycppad import *
# Example using a_float ------------------------------------------------------
def pycppad_test_compare_op():
x = ad(2.)
y = ad(3.)
z = ad(2.)
# assert comparisons that should be true
assert x == x
assert x == z
assert x != y
assert x <= x
assert x <= z
assert x <= y
assert x < y
# assert comparisons that should be false
assert not x == y
assert not x != z
assert not x != x
assert not x >= y
assert not x > y
# Example using a2float ------------------------------------------------------
def pycppad_test_compare_op_a2():
x = ad(ad(2.))
y = ad(ad(3.))
z = ad(ad(2.))
# assert comparisons that should be true
assert x == x
assert x == z
assert x != y
assert x <= x
assert x <= z
assert x <= y
assert x < y
# assert comparisons that should be false
assert not x == y
assert not x != z
assert not x != x
assert not x >= y
assert not x > y