Opened 10 years ago

Closed 10 years ago

# Missing conversion from PolynomialBooleanRing to (univariate) PolynomialRing over GF(2) via NTL

Reported by: Owned by: Bouillaguet malb major sage-5.7 commutative algebra malb, AlexanderDreyer, PolyBoRi sage-5.7.beta0 Charles Bouillaguet Alexander Dreyer None of the above - read trac for reasoning.

### Description

```sage: R_multi.<x,y,z> = BooleanPolynomialRing()
sage: R_uni = GF(2)[x]
sage: R_uni( x )
Traceback (most recent call last):
....
TypeError: degree() takes no arguments (1 given)
```

### comment:1 Changed 10 years ago by Bouillaguet

• Authors set to Charles Bouillaguet
• Status changed from new to needs_review

Turns out that the problem is that in BooleanPolynomialRing, the degree() method did not have the same specification as that in "normal" MPolynomial rings...

### comment:2 Changed 10 years ago by AlexanderDreyer

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

• ## sage/libs/polybori/decl.pxd

`diff --git a/sage/libs/polybori/decl.pxd b/sage/libs/polybori/decl.pxd    `
 a 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)
• ## sage/rings/polynomial/pbori.pyx

`diff --git a/sage/rings/polynomial/pbori.pyx b/sage/rings/polynomial/pbori.pyx`
 a """ return self._pbpoly.deg() def degree(self): def degree(self,x=None): r""" Return the total degree of ``self``. sage: (x*y + x + y + 1).degree() 2 """ if x != None: if self._pbpoly.set().multiplesOf((x)._pbpoly.firstTerm()).isZero(): return 0 else: return 1 return self._pbpoly.deg() def lm(BooleanPolynomial self): sage: BS.empty() True """ return self._pbset.size() == 0 return self._pbset.isZero() def navigation(self): """

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

### comment:3 Changed 10 years ago by Bouillaguet

• Keywords conversion removed

This new patch should make you happy :)

### comment:4 Changed 10 years ago by AlexanderDreyer

• Report Upstream changed from N/A to None of the above - read trac for reasoning.
• Reviewers set to Alexander Dreyer
• Status changed from needs_review to positive_review

Indeed, so positive review!

### comment:5 Changed 10 years ago by jdemeyer

• Merged in set to sage-5.7.beta0
• Resolution set to fixed
• Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.