Skip to content

Commit 36741a5

Browse files
author
Release Manager
committed
gh-40858: Fix const polynomial conversion to Singular interface See the newly added test. Previously, it fails. This only affects the (slow) singular interface, not the libsingular interface. ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> - [ ] The title is concise and informative. - [ ] The description explains in detail what this PR is about. - [ ] I have linked a relevant issue or discussion. - [ ] I have created tests covering the changes. - [ ] I have updated the documentation and checked the documentation preview. ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on. For example, --> <!-- - #12345: short description why this is a dependency --> <!-- - #34567: ... --> URL: #40858 Reported by: user202729 Reviewer(s): Frédéric Chapoton
2 parents 42c4f72 + 703f18c commit 36741a5

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

src/sage/rings/polynomial/multi_polynomial_libsingular.pyx

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5298,6 +5298,25 @@ cdef class MPolynomial_libsingular(MPolynomial_libsingular_base):
52985298
self._parent._singular_().set_ring()
52995299
return self._repr_short_()
53005300

5301+
def _singular_(self, singular=None):
5302+
"""
5303+
Override :meth:`sage.structure.sage_object.SageObject._singular_`
5304+
to declare the type of ``self`` to be ``'poly'``.
5305+
Needed because even with ``setring``, constant polynomials are not considered
5306+
polynomials of the current ring.
5307+
5308+
TESTS::
5309+
5310+
sage: R.<x,y> = Zmod(5)[]
5311+
sage: a = singular(R(2)) + singular(R(2)) + singular(R(1)); a
5312+
0
5313+
sage: a == singular(R(0))
5314+
True
5315+
"""
5316+
if singular is None:
5317+
from sage.interfaces.singular import singular
5318+
return singular(self._singular_init_(singular), type='poly')
5319+
53015320
def sub_m_mul_q(self, MPolynomial_libsingular m, MPolynomial_libsingular q):
53025321
"""
53035322
Return ``self - m*q``, where ``m`` must be a monomial and

0 commit comments

Comments
 (0)