diff options
-rw-r--r-- | polymatrix/expression/mixins/combinationsexprmixin.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/polymatrix/expression/mixins/combinationsexprmixin.py b/polymatrix/expression/mixins/combinationsexprmixin.py index ff2d201..483da96 100644 --- a/polymatrix/expression/mixins/combinationsexprmixin.py +++ b/polymatrix/expression/mixins/combinationsexprmixin.py @@ -1,5 +1,6 @@ import abc import itertools +import math from typing import Iterable from polymatrix.polymatrix.utils import multiply_polynomial @@ -71,7 +72,12 @@ class CombinationsExprMixin(ExpressionBaseMixin): elif isinstance(self.degrees, tuple): degrees = self.degrees - # TODO: check that degrees are all integers + # check that degrees are all integers + for deg in degrees: + if not math.isclose(int(deg), deg): + raise ValueError(f"Non-integer degrees ({deg}) are not supported.") + + degrees = tuple(int(d) for d in degrees) # FIXME: improve error message assert expr_pm.shape[1] == 1 |