Permalink
Browse files

added comparison operators <,<=,>,>=

  • Loading branch information...
1 parent fd4d7e1 commit 03749d56b44d92b7fe41a2b8cf7b0851f4a24bf8 @b45ch1 committed Jun 18, 2009
Showing with 33 additions and 1 deletion.
  1. +12 −0 py_adolc.hpp
  2. +1 −1 tests/.gitignore
  3. BIN tests/3D_plot.png
  4. BIN tests/mayavi_3D_plot.png
  5. +20 −0 tests/unit_test.py
View
@@ -301,6 +301,18 @@ BOOST_PYTHON_MODULE(_adolc)
.def(self *= self )
.def(self /= self )
+
+ .def(self < double() )
+ .def(self <= double() )
+ .def(self > double() )
+ .def(self >= double() )
+
+ .def(self < self )
+ .def(self <= self )
+ .def(self > self )
+ .def(self >= self )
+
+
// .def(-self) using this unary operator somehow screws up LATER computations, i.e. the operator works correctly, but subsequent calculations screw up!!
// .def(+self)
View
@@ -1,2 +1,2 @@
jac_pat.mtx
-3D_plot.png
+!*.png
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
@@ -26,6 +26,26 @@ def test_unary_operators():
print type(b)
print type(a)
+
+def test_conditional_operators():
+ ax = adouble(2.)
+ ay = adouble(1.)
+
+ assert ax <= 2
+ assert ax <= 2.
+ assert not ax < 2
+ assert not ax < 2.
+
+
+ assert ax >= 2
+ assert ax >= 2.
+ assert not ax > 2
+ assert not ax > 2.
+
+ assert ax > ay
+ assert ax >= ay
+ assert not ax < ay
+ assert not ax <= ay
def test_radd():

0 comments on commit 03749d5

Please sign in to comment.