#6177: [with patch, needs work] Update PolyBoRi to newest upstream release
-------------------------+--------------------------------------------------
Reporter: malb | Owner: malb
Type: enhancement | Status: new
Priority: major | Milestone: sage-4.0.2
Component: packages | Keywords: M4RI, PolyBoRi
-------------------------+--------------------------------------------------
Comment(by malb):
More notes by Michael:
{{{
Can you please link: http://polybori.sourceforge.net/zdd.html
A picture says more, than 1000 words.
2. How is the pickling of Boolean polynomials done?
Have a look at parallel.py:
def to_fast_pickable(l):
"""
to_fast_pickable(l) converts a list of polynomials into a builtin
Python value, which is fast pickable and compact.
INPUT:
- a list of Boolean polynomials
OUTPUT:
It is converted to a tuple consisting of
- codes referring to the polynomials
- list of conversions of nodes.
The nodes are sorted, that
n occurs before n.else_branch(), n.then_branch()
Nodes are only listed, if they are not constant.
A node is converted in this way:
0 -> 0
1 -> 1
if_then_else(v,t,e) -> (v, index of then branch +2, index of
else branch +2)
The shift of +2 is for the constant values implicitly
contained in the list.
Each code c refers to the c-2-th position in the conversion
list, if c >=2, else to
the corresponding Boolean constant if c in {0, 1}
EXAMPLES:
>>> from polybori.PyPolyBoRi import Ring, Variable
>>> r=Ring(1000)
>>> x=Variable
>>> to_fast_pickable([Polynomial(1)])
[[1], []]
>>> to_fast_pickable([Polynomial(0)])
[[0], []]
>>> to_fast_pickable([x(0)])
[[2], [(0, 1, 0)]]
>>> to_fast_pickable([x(0)*x(1)+x(1)])
[[2], [(0, 3, 3), (1, 1, 0)]]
>>> to_fast_pickable([x(1)])
[[2], [(1, 1, 0)]]
>>> to_fast_pickable([x(0)+1])
[[2], [(0, 1, 1)]]
>>> to_fast_pickable([x(0)*x(1)])
[[2], [(0, 3, 0), (1, 1, 0)]]
>>> to_fast_pickable([x(0)*x(1)+x(1)])
[[2], [(0, 3, 3), (1, 1, 0)]]
>>> to_fast_pickable([x(0)*x(1)+x(2)])
[[2], [(0, 3, 4), (1, 1, 0), (2, 1, 0)]]
>>> p=x(5)*x(23) + x(5)*x(24)*x(59) + x(5) + x(6)*x(23)*x(89) +
x(6)*x(60)*x(89) + x(23) + x(24)*x(89) + x(24) + x(60)*x(89) + x(89) + 1
>>> from_fast_pickable(to_fast_pickable([p]))==[p]
True
>>> to_fast_pickable([x(0)*x(1), Polynomial(0), Polynomial(1),
x(3)])
[[2, 0, 1, 4], [(0, 3, 0), (1, 1, 0), (3, 1, 0)]]
"""
}}}
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/6177#comment:5>
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
-~----------~----~----~----~------~----~------~--~---