Ticket #6177: trac_6177_reviewer_patch

File trac_6177_reviewer_patch, 7.2 KB (added by burcin, 4 years ago)

minor fixes

Line 
1# HG changeset patch
2# User Burcin Erocal <burcin@erocal.org>
3# Date 1252575359 -7200
4# Node ID 8fcb042dc8c3bb64f50c6c67b6cb03013335f028
5# Parent  d3403b113d5ac446fdee18cfbce94e87e8d5aeee
6Minor fixes to polybori update patches. #6177
7 - eliminate use of Python's eval in module_list.py
8 - fix doctest in sage/crypto/mq/mpolynomialsystem.py
9 - remove commented old code
10
11diff --git a/module_list.py b/module_list.py
12--- a/module_list.py
13+++ b/module_list.py
14@@ -80,11 +80,12 @@
15 ### PolyBoRi defines
16 #########################################################
17 
18+import ast
19 polybori_extra_compile_args = []
20 for line in open(SAGE_LOCAL + "/share/polybori/flags.conf"):
21     if not line.startswith("CPPDEFINES"):
22         continue
23-    polybori_extra_compile_args = ["-D"+e for e in eval(line[len("CPPDEFINES = "):])]
24+    polybori_extra_compile_args = ["-D"+e for e in ast.literal_eval(line[len("CPPDEFINES = "):])]
25     break
26 
27 
28diff --git a/sage/all.py b/sage/all.py
29--- a/sage/all.py
30+++ b/sage/all.py
31@@ -240,9 +240,6 @@
32     import sage.matrix.matrix_mod2_dense
33     sage.matrix.matrix_mod2_dense.free_m4ri()
34 
35-    #import sage.rings.polynomial.pbori
36-    #sage.rings.polynomial.pbori.free_m4ri()
37-
38     import sage.libs.flint.flint
39     sage.libs.flint.flint.free_flint_stack()
40 
41diff --git a/sage/crypto/mq/mpolynomialsystem.py b/sage/crypto/mq/mpolynomialsystem.py
42--- a/sage/crypto/mq/mpolynomialsystem.py
43+++ b/sage/crypto/mq/mpolynomialsystem.py
44@@ -1397,8 +1397,8 @@
45             from sage.rings.polynomial.pbori import GroebnerStrategy
46             g = GroebnerStrategy()
47             for p in self.gens():
48-                g.addAsYouWish(p)
49-            g.optRedTail=True
50+                g.add_as_you_wish(p)
51+            g.reduction_strategy.opt_red_tail=True
52             return g
53 
54 
55diff --git a/sage/rings/polynomial/pbori.pyx b/sage/rings/polynomial/pbori.pyx
56--- a/sage/rings/polynomial/pbori.pyx
57+++ b/sage/rings/polynomial/pbori.pyx
58@@ -1979,7 +1979,7 @@
59         .. note::
60 
61            This function is part of the upstream PolyBoRi
62-           interface. In Sage all hashs are stable.
63+           interface. In Sage all hashes are stable.
64         """
65         return self._pbmonom.stableHash()
66 
67@@ -3615,31 +3615,6 @@
68         """
69         return self._pbpoly.lexLeadDeg()
70 
71-#     def lead_deg(self):
72-#         """
73-#         Return the degree of the leading monomial with respect to the
74-#         lexicographical orderings.
75-       
76-#         EXAMPLE::
77-       
78-#             sage: B.<x,y,z> = BooleanPolynomialRing(3,order='lex')
79-#             sage: f = x + y*z
80-#             sage: f
81-#             x + y*z
82-#             sage: f.lead_deg()
83-#             1
84-       
85-#         ::
86-       
87-#             sage: B.<x,y,z> = BooleanPolynomialRing(3,order='deglex')
88-#             sage: f = x + y*z
89-#             sage: f
90-#             y*z + x
91-#             sage: f.lead_deg()
92-#             2
93-#         """
94-#         return self._pbpoly.leadDeg()
95-
96     def constant(self):
97         r"""
98         Return ``True`` if this element is constant.
99@@ -3661,38 +3636,6 @@
100         """
101         return self._pbpoly.isConstant()
102 
103-#     def isZero(self):
104-#         r"""
105-#         Return ``True`` if this element is zero.
106-       
107-#         EXAMPLE::
108-       
109-#             sage: B.<x,y,z> = BooleanPolynomialRing(3)
110-#             sage: x.isZero()
111-#             False
112-#             sage: B(0).isZero()
113-#             True
114-#             sage: B(1).isZero()
115-#             False
116-#         """
117-#         return self._pbpoly.isZero()
118-
119-#     def isOne(self):
120-#         r"""
121-#         Return ``True`` if this element is one.
122-       
123-#         EXAMPLE::
124-       
125-#             sage: B.<x,y,z> = BooleanPolynomialRing(3)
126-#             sage: x.isOne()
127-#             False
128-#             sage: B(0).isOne()
129-#             False
130-#             sage: B(1).isOne()
131-#             True
132-#         """
133-#         return self._pbpoly.isOne()
134-   
135     def navigation(self):
136         """
137         Navigators provide an interface to diagram nodes, accessing
138@@ -3853,19 +3796,6 @@
139         """
140         return self._pbpoly.nUsedVariables()
141 
142-#     def totalDegree(self):
143-#         """
144-#         Return total degree of this boolean polynomial.
145-       
146-#         EXAMPLE::
147-       
148-#             sage: B.<a,b,c,d> = BooleanPolynomialRing(4)
149-#             sage: f = a*b*c + 1
150-#             sage: f.totalDegree()
151-#             3
152-#         """
153-#         return self._pbpoly.totalDeg()
154-
155     def graded_part(self, int deg):
156         r"""
157         Return graded part of this boolean polynomial of degree
158@@ -4013,7 +3943,7 @@
159         .. note::
160 
161            This function is part of the upstream PolyBoRi
162-           interface. In Sage all hashs are stable.
163+           interface. In Sage all hashes are stable.
164         """
165         return self._pbpoly.stableHash()
166 
167@@ -4384,25 +4314,25 @@
168             sage: F,s = sr.polynomial_system()
169             sage: I = F.ideal()
170             sage: I.interreduced_basis()
171-              [k100 + k003 + 1,
172-               k101 + k003,
173-               k102,
174-               k103 + k003,
175-               x100 + 1,
176-               x101 + 1,
177-               x102 + 1,
178-               x103 + k003,
179-               w100 + k003,
180-               w101,
181-               w102 + k003 + 1,
182-               w103 + k003 + 1,
183-               s000 + 1,
184-               s001 + 1,
185-               s002 + 1,
186-               s003 + k003 + 1,
187-               k000 + k003 + 1,
188-               k001,
189-               k002 + k003]
190+            [k100 + k003 + 1,
191+             k101 + k003,
192+             k102,
193+             k103 + k003,
194+             x100 + 1,
195+             x101 + 1,
196+             x102 + 1,
197+             x103 + k003,
198+             w100 + k003,
199+             w101,
200+             w102 + k003 + 1,
201+             w103 + k003 + 1,
202+             s000 + 1,
203+             s001 + 1,
204+             s002 + 1,
205+             s003 + k003 + 1,
206+             k000 + k003 + 1,
207+             k001,
208+             k002 + k003]
209         """
210         R = self.ring()
211         set_cring(R)
212@@ -4498,36 +4428,6 @@
213     PBPoly_construct_int(&p._pbpoly,juice)
214     return p
215 
216-# cdef class DD:
217-#     def __call__(self):
218-#         return self
219-
220-#     def __dealloc__(self):
221-#         PBDD_destruct(&self._pbdd)
222-
223-#     def empty(self):
224-#         return self._pbdd.emptiness()
225-
226-#     def navigation(self):
227-#         return new_CN_from_PBNavigator(self._pbdd.navigation())
228-
229-#     def subset0(self, idx):
230-#         return new_DD_from_PBDD(self._pbdd.subset0(idx))
231-
232-#     def subset1(self, idx):
233-#         return new_DD_from_PBDD(self._pbdd.subset1(idx))
234-
235-#     def union(self, rhs):
236-#         return new_DD_from_PBDD(self._pbdd.unite((<DD>rhs)._pbdd))
237-
238-# cdef inline DD new_DD_from_PBDD(PBDD juice):
239-#     """
240-#     Construct a new DD
241-#     """
242-#     cdef DD d
243-#     d = <DD>PY_NEW(DD)
244-#     d._pbdd = juice
245-#     return d
246 
247 cdef class BooleSet:
248     """
249@@ -4952,7 +4852,7 @@
250         .. note::
251 
252            This function is part of the upstream PolyBoRi
253-           interface. In Sage all hashs are stable.
254+           interface. In Sage all hashes are stable.
255         """
256         return self._pbset.stableHash()
257