summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Schneeberger <michael.schneeberger@fhnw.ch>2022-12-06 13:15:35 +0100
committerMichael Schneeberger <michael.schneeberger@fhnw.ch>2022-12-06 13:15:35 +0100
commit084a12153364f69aa94700d7458c6c93665185d9 (patch)
tree8674a312d0e77332d2646db0f629440d0ce44e8b
parentbugfix: elementwise multiplication works with a scalar value on both sides (diff)
downloadpolymatrix-084a12153364f69aa94700d7458c6c93665185d9.tar.gz
polymatrix-084a12153364f69aa94700d7458c6c93665185d9.zip
allow predicator in filter expression to have empty entries
Diffstat (limited to '')
-rw-r--r--polymatrix/expression/mixins/filterexprmixin.py14
1 files changed, 12 insertions, 2 deletions
diff --git a/polymatrix/expression/mixins/filterexprmixin.py b/polymatrix/expression/mixins/filterexprmixin.py
index ff2d333..5083073 100644
--- a/polymatrix/expression/mixins/filterexprmixin.py
+++ b/polymatrix/expression/mixins/filterexprmixin.py
@@ -48,9 +48,19 @@ class FilterExprMixin(ExpressionBaseMixin):
if underlying_terms is None:
continue
- predicator_value = predicator.get_poly(row, 0)[tuple()]
+ predicator_poly = predicator.get_poly(row, 0)
- assert isinstance(predicator_value, int)
+ if predicator_poly is None:
+ predicator_value = 0
+
+ else:
+ key = tuple()
+
+ if key in predicator_poly:
+ predicator_value = round(predicator_poly[key])
+
+ else:
+ predicator_value = 0
if (predicator_value != 0) is not self.inverse:
terms[row_index, 0] = underlying_terms