diff options
Diffstat (limited to 'sumofsquares/canon.py')
-rw-r--r-- | sumofsquares/canon.py | 12 |
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) |