#13964: Missing conversion from PolynomialBooleanRing to (univariate)
PolynomialRing over GF(2) via NTL
---------------------------------------+------------------------------------
       Reporter:  Bouillaguet          |         Owner:  malb        
           Type:  defect               |        Status:  needs_review
       Priority:  major                |     Milestone:  sage-5.7    
      Component:  commutative algebra  |    Resolution:              
       Keywords:  conversion           |   Work issues:              
Report Upstream:  N/A                  |     Reviewers:              
        Authors:  Charles Bouillaguet  |     Merged in:              
   Dependencies:                       |      Stopgaps:              
---------------------------------------+------------------------------------

Comment (by AlexanderDreyer):

 The patch does what expected, but I would use a different test for
 performance reasons, see here:

 {{{#!diff
 diff --git a/sage/libs/polybori/decl.pxd b/sage/libs/polybori/decl.pxd
 --- a/sage/libs/polybori/decl.pxd
 +++ b/sage/libs/polybori/decl.pxd
 @@ -163,6 +163,9 @@
          double (* sizeDouble)()
          PBSetIter (* begin)()
          PBSetIter (* end)()
 +        bint (* isZero)()
 +        bint (* isOne)()
 +

      PBSet pb_include_divisors "include_divisors" (PBSet p)
      PBSet pb_minimal_elements "minimal_elements" (PBSet p)
 diff --git a/sage/rings/polynomial/pbori.pyx
 b/sage/rings/polynomial/pbori.pyx
 --- a/sage/rings/polynomial/pbori.pyx
 +++ b/sage/rings/polynomial/pbori.pyx
 @@ -3236,7 +3236,7 @@
          """
          return self._pbpoly.deg()

 -    def degree(self):
 +    def degree(self,x=None):
          r"""
          Return the total degree of ``self``.

 @@ -3256,6 +3256,12 @@
              sage: (x*y + x + y + 1).degree()
              2
          """
 +        if x != None:
 +          if
 
self._pbpoly.set().multiplesOf((<BooleanPolynomial>x)._pbpoly.firstTerm()).isZero():
 +              return 0
 +          else:
 +              return 1
 +
          return self._pbpoly.deg()

      def lm(BooleanPolynomial self):
 @@ -5357,7 +5363,7 @@
              sage: BS.empty()
              True
          """
 -        return self._pbset.size() == 0
 +        return self._pbset.isZero()

      def navigation(self):
          """
 }}}

 (The improved `empty()` should also be added.

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/13964#comment:2>
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 post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sage-trac?hl=en.

Reply via email to