diff options
-rw-r--r-- | polymatrix/expression/expression.py | 2 | ||||
-rw-r--r-- | polymatrix/expression/impl.py | 12 | ||||
-rw-r--r-- | polymatrix/expression/mixins/quadraticmonomialsexprmixin.py | 1 |
3 files changed, 11 insertions, 4 deletions
diff --git a/polymatrix/expression/expression.py b/polymatrix/expression/expression.py index fbe7ac3..a0cf093 100644 --- a/polymatrix/expression/expression.py +++ b/polymatrix/expression/expression.py @@ -135,7 +135,7 @@ class Expression(ExpressionBaseMixin, ABC): if left is None: return NotImplemented - return right.copy( underlying=op(left, right.underlying, stack)) + return right.copy(underlying=op(left, right.underlying, stack)) def cache(self) -> "Expression": return self.copy( diff --git a/polymatrix/expression/impl.py b/polymatrix/expression/impl.py index 03b4c2c..01f1e25 100644 --- a/polymatrix/expression/impl.py +++ b/polymatrix/expression/impl.py @@ -81,7 +81,7 @@ class AdditionExprImpl(AdditionExprMixin): # implement custom __repr__ method that returns a representation without the stack def __repr__(self): - return f"{self.__class__.__name__}(left={self.left}, right={self.right})" + return f"{self.__class__.__name__}(left={repr(self.left)}, right={repr(self.right)})" def __str__(self): return f"({self.left} + {self.right})" @@ -112,7 +112,7 @@ class DerivativeExprImpl(DerivativeExprMixin): # implement custom __repr__ method that returns a representation without the stack def __repr__(self): - return f"{self.__class__.__name__}(variables={self.variables}, underlying={self.underlying})" + return f"{self.__class__.__name__}(variables={self.variables}, underlying={repr(self.underlying)})" @dataclassabc.dataclassabc(frozen=True) @@ -313,14 +313,20 @@ class QuadraticInExprImpl(QuadraticInExprMixin): # implement custom __repr__ method that returns a representation without the stack def __repr__(self): - return f"{self.__class__.__name__}(variables={self.variables}, monomials={self.monomials}, underlying={self.underlying})" + return f"{self.__class__.__name__}(variables={self.variables}, monomials={self.monomials}, underlying={repr(self.underlying)})" + + def __str__(self): + return f"QuadraticIn({str(self.underlying)}, {str(self.variables)})" @dataclassabc.dataclassabc(frozen=True) class QuadraticMonomialsExprImpl(QuadraticMonomialsExprMixin): underlying: ExpressionBaseMixin variables: tuple + def __str__(self): + return f"QuadraticMonomials({str(self.underlying)}, {str(self.variables)})" + @dataclassabc.dataclassabc(frozen=True) class RepMatExprImpl(RepMatExprMixin): diff --git a/polymatrix/expression/mixins/quadraticmonomialsexprmixin.py b/polymatrix/expression/mixins/quadraticmonomialsexprmixin.py index 1066861..b6e671f 100644 --- a/polymatrix/expression/mixins/quadraticmonomialsexprmixin.py +++ b/polymatrix/expression/mixins/quadraticmonomialsexprmixin.py @@ -17,6 +17,7 @@ from polymatrix.polymatrix.utils.splitmonomialindices import split_monomial_indi class QuadraticMonomialsExprMixin(ExpressionBaseMixin): + # FIXME: docstring, what does this thing even do """ Maps a polynomial matrix |