From d4c0c47efe30416c6775da0f99e41f916f3e8b4f Mon Sep 17 00:00:00 2001 From: Stephan Seitz <stephan.seitz@fau.de> Date: Mon, 5 Aug 2019 10:33:19 +0200 Subject: [PATCH] Implement TypedSymbol.is_nonnegative --- pystencils/data_types.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pystencils/data_types.py b/pystencils/data_types.py index ed95e80fa..6bae2da8d 100644 --- a/pystencils/data_types.py +++ b/pystencils/data_types.py @@ -143,6 +143,13 @@ class TypedSymbol(sp.Symbol): return super().is_positive + @property + def is_nonnegative(self): + if self.is_negative is False: + return True + else: + return super().is_nonnegative + @property def is_real(self): if hasattr(self.dtype, 'numpy_dtype'): -- GitLab