From bcbd5dbe5e02f86390714671504d8a7fa4c7489e Mon Sep 17 00:00:00 2001 From: Nao Pross Date: Sat, 8 Jun 2024 13:49:04 +0200 Subject: Add more __str__ methods --- polymatrix/expression/impl.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/polymatrix/expression/impl.py b/polymatrix/expression/impl.py index 0a60fb8..a185802 100644 --- a/polymatrix/expression/impl.py +++ b/polymatrix/expression/impl.py @@ -249,6 +249,10 @@ class HalfNewtonPolytopeExprImpl(HalfNewtonPolytopeExprMixin): variables: ExpressionBaseMixin filter: ExpressionBaseMixin | None + def __str__(self): + # FIXME: what does filter do? + return f"halfnewton({self.monomials}, {self.variables})" + @dataclassabc.dataclassabc(frozen=True) class IntegrateExprImpl(IntegrateExprMixin): @@ -270,6 +274,9 @@ class LinearInExprImpl(LinearInExprMixin): variables: ExpressionBaseMixin ignore_unmatched: bool + def __str__(self): + return f"linear_in({self.underlying}, {self.monomials})" + @dataclassabc.dataclassabc(frozen=True) class LinearMatrixInExprImpl(LinearMatrixInExprMixin): @@ -282,6 +289,9 @@ class LinearMonomialsExprImpl(LinearMonomialsExprMixin): underlying: ExpressionBaseMixin variables: tuple + def __str__(self): + return f"linear_monomials({self.underlying})" + @dataclassabc.dataclassabc(frozen=True) class LowerTriangularExprImpl(LowerTriangularExprMixin): @@ -334,6 +344,9 @@ class DegreeExprImpl(DegreeExprMixin): class MaxExprImpl(MaxExprMixin): underlying: ExpressionBaseMixin + def __str__(self): + return f"max({self.underlying})" + @dataclassabc.dataclassabc(frozen=True) class NamedExprImpl(NamedExprMixin): @@ -405,7 +418,7 @@ class QuadraticInExprImpl(QuadraticInExprMixin): def __str__(self): - return f"QuadraticIn({str(self.underlying)}, {str(self.variables)})" + return f"quadratic_in({str(self.underlying)}, {str(self.variables)})" @dataclassabc.dataclassabc(frozen=True) @@ -414,7 +427,7 @@ class QuadraticMonomialsExprImpl(QuadraticMonomialsExprMixin): variables: tuple def __str__(self): - return f"QuadraticMonomials({str(self.underlying)}, {str(self.variables)})" + return f"quadratic_monomials({str(self.underlying)})" @dataclassabc.dataclassabc(frozen=True) -- cgit v1.2.1