| |
- compress(...)
- compress(string[, level]) -- Returned compressed string.
Optional arg level is the compression level, in 1-9.
- decompress(...)
- decompress(string[, wbits[, bufsize]]) -- Return decompressed string.
Optional arg wbits is the window buffer size. Optional arg bufsize is
the initial output buffer size.
- from_fast_pickable(l, r)
- from_fast_pickable(l, ring) undoes the operation to_fast_pickable. The first argument is an object created by to_fast_pickable.
For the specified format, see the documentation of to_fast_pickable.
The second argument is ring, in which this polynomial should be created.
INPUT:
see OUTPUT of to_fast_pickable
OUTPUT:
a list of Boolean polynomials
EXAMPLES:
>>> from polybori.PyPolyBoRi import Ring
>>> r=Ring(1000)
>>> x = r.variable
>>> from_fast_pickable([[1], []], r)
[1]
>>> from_fast_pickable([[0], []], r)
[0]
>>> from_fast_pickable([[2], [(0, 1, 0)]], r)
[x(0)]
>>> from_fast_pickable([[2], [(1, 1, 0)]], r)
[x(1)]
>>> from_fast_pickable([[2], [(0, 1, 1)]], r)
[x(0) + 1]
>>> from_fast_pickable([[2], [(0, 3, 0), (1, 1, 0)]], r)
[x(0)*x(1)]
>>> from_fast_pickable([[2], [(0, 3, 3), (1, 1, 0)]], r)
[x(0)*x(1) + x(1)]
>>> from_fast_pickable([[2], [(0, 3, 4), (1, 1, 0), (2, 1, 0)]], r)
[x(0)*x(1) + x(2)]
>>> from_fast_pickable([[2, 0, 1, 4], [(0, 3, 0), (1, 1, 0), (3, 1, 0)]], r)
[x(0)*x(1), 0, 1, x(3)]
- groebner_basis_first_finished(I, *l)
- INPUT:
- I ideal
- l: keyword dictionaries, which will be keyword arguments to groebner_basis.
OUTPUT:
- tries to compute groebner_basis(I, **kwd) for kwd in l
- returns the result of the first terminated computation
EXAMPLES:
>>> from polybori.PyPolyBoRi import Ring
>>> r=Ring(1000)
>>> ideal = [r.variable(1)*r.variable(2)+r.variable(2)+r.variable(1)]
>>> #groebner_basis_first_finished(ideal, dict(heuristic=True), dict(heuristic=False))
[x(1), x(2)]
- if_then_else(...)
- if_then_else( (object)arg1, (BooleSet)arg2, (BooleSet)arg3) -> BooleSet :
if-then else operator
C++ signature :
polybori::BooleSet if_then_else(int,polybori::BooleSet,polybori::BooleSet)
if_then_else( (Variable)arg1, (BooleSet)arg2, (BooleSet)arg3) -> BooleSet :
if-then else operator
C++ signature :
polybori::BooleSet if_then_else(polybori::BooleVariable,polybori::BooleSet,polybori::BooleSet)
- pickle_bset(self)
- pickle_monom(self)
- pickle_polynomial(self)
- pickle_ring(self)
- pickle_var(self)
- 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
>>> r=Ring(1000)
>>> x=r.variable
>>> to_fast_pickable([Polynomial(1, r)])
[[1], []]
>>> to_fast_pickable([Polynomial(0, r)])
[[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]), r)==[p]
True
>>> to_fast_pickable([x(0)*x(1), Polynomial(0, r), Polynomial(1, r), x(3)])
[[2, 0, 1, 4], [(0, 3, 0), (1, 1, 0), (3, 1, 0)]]
|