Skip to content

Commit 703f18c

Browse files
committed
Fix const polynomial conversion to Singular interface
1 parent 28b7af0 commit 703f18c

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)