summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNao Pross <np@0hm.ch>2024-06-02 15:55:47 +0200
committerNao Pross <np@0hm.ch>2024-06-02 15:55:47 +0200
commit27fc1ece94948be2ee7ffee9696b230ba104adf0 (patch)
tree1ac7a21a5120a38c9a4e8d6ca86a4aa9c6087354
parentAllow passing state object to sos.solve_problem (diff)
downloadsumofsquares-27fc1ece94948be2ee7ffee9696b230ba104adf0.tar.gz
sumofsquares-27fc1ece94948be2ee7ffee9696b230ba104adf0.zip
Cleanup comments
Diffstat (limited to '')
-rw-r--r--sumofsquares/canon.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/sumofsquares/canon.py b/sumofsquares/canon.py
index 109a763..295a892 100644
--- a/sumofsquares/canon.py
+++ b/sumofsquares/canon.py
@@ -133,16 +133,20 @@ class PutinarPSatz(Canonicalization):
# Degree of multiplier needs to be an integer
d = constr_deg - domain_deg
- if d % 2 != 0:
- d += 1
-
- x = poly.v_stack((1,) + prob.polynomial_variables)
# FIXME: proper error here
assert d.read(state).scalar().constant() >= 0, \
"Degree of domain polynomial is higher than constraint polynomial!"
+ # Degree of multiplier must be even
+ if d % 2 != 0:
+ d += 1
+
+ x = poly.v_stack((1,) + prob.polynomial_variables)
+
# FIXME: need to check that there is not a \gamma_{i} already!
+ # TODO: deterministically generate unique names
+
monomials = x.combinations(poly.arange(d + 1))
c = opt_variable_from_name(rf"\gamma_{i}", shape=monomials.shape)