#20588: Add a method divides for MPolynomial_libsingular
-------------------------------------+-------------------------------------
Reporter: bruno | Owner:
Type: enhancement | Status: needs_review
Priority: major | Milestone: sage-7.3
Component: commutative | Resolution:
algebra | Merged in:
Keywords: | Reviewers: Travis Scrimshaw
Authors: Bruno Grenet | Work issues:
Report Upstream: N/A | Commit:
Branch: | 6043c551125ae2ce180dd01cf30e34d55e6a8c5e
u/bruno/faster_divisibility_test | Stopgaps:
Dependencies: |
-------------------------------------+-------------------------------------
Changes (by tscrim):
* reviewer: => Travis Scrimshaw
Comment:
A few minor things:
{{{#!diff
def divides(self, other):
"""
- Return `True` if this polynomial divides `other`.
+ Return ``True`` if this polynomial divides ``other``.
EXAMPLES::
sage: R.<x,y,z> = QQ[]
sage: p = 3*x*y + 2*y*z + x*z
sage: q = x + y + z + 1
sage: r = p * q
sage: p.divides(r)
True
sage: q.divides(p)
False
sage: r.divides(0)
True
sage: R.zero().divides(r)
False
sage: R.zero().divides(0)
True
"""
if self.is_zero():
return other.is_zero()
cdef ideal *_I
cdef MPolynomialRing_libsingular parent = self._parent
cdef ring *r = self._parent_ring
cdef poly *rem
- if r!=currRing: rChangeCurrRing(r)
+ if r != currRing:
+ rChangeCurrRing(r)
_I = idInit(1, 1)
if not (isinstance(other,MPolynomial_libsingular) \
and (<MPolynomial_libsingular>other)._parent is parent):
try:
other = parent._coerce_c(other)
except TypeError as msg:
id_Delete(&_I,r)
raise TypeError, msg
_I.m[0] = p_Copy(self._poly, r)
- if r!=currRing: rChangeCurrRing(r)
+ if r != currRing:
+ rChangeCurrRing(r)
sig_on()
rem = kNF(_I, NULL, (<MPolynomial_libsingular>other)._poly, 0, 1)
sig_off()
id_Delete(&_I, r)
res = new_MP(parent, rem).is_zero()
return res
}}}
Once you make those changes, you can set a positive review on my behalf.
--
Ticket URL: <http://trac.sagemath.org/ticket/20588#comment:4>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.