summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNao Pross <np@0hm.ch>2024-06-08 13:49:04 +0200
committerNao Pross <np@0hm.ch>2024-06-08 13:49:04 +0200
commitbcbd5dbe5e02f86390714671504d8a7fa4c7489e (patch)
tree8bbb5e70800475d2267492c63ef1ae65901c4068
parentFix bugs in expression.from_ and expression.__init__ (diff)
downloadpolymatrix-bcbd5dbe5e02f86390714671504d8a7fa4c7489e.tar.gz
polymatrix-bcbd5dbe5e02f86390714671504d8a7fa4c7489e.zip
Add more __str__ methods
Diffstat (limited to '')
-rw-r--r--polymatrix/expression/impl.py17
1 files 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)