From 27fc1ece94948be2ee7ffee9696b230ba104adf0 Mon Sep 17 00:00:00 2001 From: Nao Pross Date: Sun, 2 Jun 2024 15:55:47 +0200 Subject: Cleanup comments --- sumofsquares/canon.py | 12 ++++++++---- 1 file 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) -- cgit v1.2.1