sagemath / sage

Main repository of SageMath. Now open for Issues and Pull Requests.
https://www.sagemath.org
Other
1.08k stars 394 forks source link

Work around inconsistent iteration in `multi_polynomial_sequence.py` #37853

Closed S17A05 closed 1 week ago

S17A05 commented 3 weeks ago

When iterating over a pbori.BooleanPolynomial, the iterator generates just the monomials, whereas iterating over a MPolynomial_libsingular defined over GF(2) yields a tuple of the monomial together with its coefficient $1$. This causes issues in the method .coefficients_monomials() of PolynomialSequence_gf2; we fix said issue by checking whether the iteration yields tuples, in which case we simply replace the tuple by its second element (the actual monomial) in each iteration. which type of polynomial ring we are working in before iterating.

Fixes #37837 (but there might be a more elegant solution).

github-actions[bot] commented 3 weeks ago

Documentation preview for this PR (built with commit ded51e1852e3ec9dd2ef2df67b2b8357d7854c09; changes) is ready! :tada: This preview will update shortly after each push to this PR.

mantepse commented 2 weeks ago

In case you are interested in the boolean polynomial ring, maybe you want to resurrect #26929.