summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--polymatrix/expression/impl.py7
-rw-r--r--polymatrix/polymatrix/mixins.py5
2 files changed, 8 insertions, 4 deletions
diff --git a/polymatrix/expression/impl.py b/polymatrix/expression/impl.py
index bbd932a..ac15aef 100644
--- a/polymatrix/expression/impl.py
+++ b/polymatrix/expression/impl.py
@@ -145,7 +145,7 @@ class DerivativeExprImpl(DerivativeExprMixin):
return f"{self.__class__.__name__}(variables={self.variables}, underlying={repr(self.underlying)})"
def __str__(self):
- return f"∂_{self.variables} {self.underlying}"
+ return f"(∂_{self.variables} {self.underlying})"
@dataclassabc.dataclassabc(frozen=True)
@@ -463,6 +463,9 @@ class SubtractMonomialsExprImpl(SubtractMonomialsExprMixin):
class SumExprImpl(SumExprMixin):
underlying: ExpressionBaseMixin
+ def __str__(self):
+ return f"(Σ {self.underlying})"
+
@dataclassabc.dataclassabc(frozen=True)
class SymmetricExprImpl(SymmetricExprMixin):
@@ -489,7 +492,7 @@ class TransposeExprImpl(TransposeExprMixin):
underlying: ExpressionBaseMixin
def __str__(self):
- return f"({self.underlying}).T"
+ return f"{self.underlying}.T"
@dataclassabc.dataclassabc(frozen=True)
diff --git a/polymatrix/polymatrix/mixins.py b/polymatrix/polymatrix/mixins.py
index f5cdb48..c12f4cc 100644
--- a/polymatrix/polymatrix/mixins.py
+++ b/polymatrix/polymatrix/mixins.py
@@ -460,7 +460,8 @@ class PolyMatrixAsAffineExpressionMixin(PolyMatrixMixin, ABC):
else:
# TODO: document behaviour on why it is allowed to pass varirables
- # it has to do with sumofsquares/solver/cvxopt.py
+ # it has to do with the function
+ # sumofsquares.problems.InternalSOSProblem.to_conic_problem
variables = tuple(sorted(variables))
for degree in range(self.degree +1):
@@ -504,7 +505,7 @@ class PolyMatrixAsAffineExpressionMixin(PolyMatrixMixin, ABC):
# efficiency gain is useless if most of the computed terms are not
# used.
# TODO: tune heuristic
- if len(self.slices) > (n / 2):
+ if len(self.slices) > n:
# Compute all powers of x up to degree d
all_monomials = self.monomials_eval_all(x)
monomials = {