#6177: [with patch, needs review] Update PolyBoRi to newest upstream release
-------------------------+--------------------------------------------------
 Reporter:  malb         |       Owner:  malb          
     Type:  enhancement  |      Status:  new           
 Priority:  major        |   Milestone:  sage-4.1.2    
Component:  packages     |    Keywords:  M4RI, PolyBoRi
 Reviewer:               |      Author:                
   Merged:               |  
-------------------------+--------------------------------------------------

Comment(by PolyBoRi):

 I have found another subtle bug.
 This is due to, that we are in the quite slow progress to make PolyBoRi
 more Pythonic:
 Since Python is dynamically typed,
 len should be the same on polynomials and monomials, so it's the constant
 1-function for us now.

 {{{
 #!python
 P=BooleanPolynomialRing(3,"x")
 sage: m=P.gen(1)*P.gen(2)
 sage: m.lead()
 x1*x2
 sage: len(m.lead())
 2
 sage:
 Exiting SAGE (CPU time 0m0.13s, Wall time 0m20.23s).
 }}}
 {{{
 #!python
 ginkgo:downloads michael$ ipbori

 In [1]: p=x(1)*x(2)

 In [2]: p.__class__
 Out[2]: <class 'polybori.dynamic.PyPolyBoRi.Monomial'>

 In [3]: len(p)
 Out[3]: 1
 }}}

 Fixing that will break the anf2cnf converter here:
 {{{
 #!python
  isinstance(m, BooleanPolynomial):
             if len(m) == 1:
                 m = m.lm()
             else:
                 raise TypeError, "Input must be monomial."

         if m == 1:
             monomial = self._cnf_literal()
             return (monomial,), ((monomial,),) # adding the clause that 1
                                             # has to be True
 }}}

 Just use .deg instead of len there

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/6177#comment:36>
Sage <http://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