Opened 15 months ago
Last modified 8 weeks ago
#31610 new defect
PolyBori-Bug
Reported by: | gh-hadipourh | Owned by: | |
---|---|---|---|
Priority: | critical | Milestone: | sage-9.7 |
Component: | packages: standard | Keywords: | BRiAL, PyPolyBoRi, degrevlex |
Cc: | fbissey, chapoton | Merged in: | |
Authors: | Hosein Hadipour | Reviewers: | |
Report Upstream: | N/A | Work issues: | |
Branch: | Commit: | ||
Dependencies: | Stopgaps: |
Description (last modified by )
Hello all,
I'd just like to report a bug inside the interface of PolyBori? (BRiAL). It seems, that the load command doesn't work correctly when the term ordering is 'revlex' or 'degrevlex'.
For example using the following commands, one can create a Boolean ideal, store and again load it into the work space.
names = ['x%d' % i for i in [0 .. 100]] BPR = BooleanPolynomialRing(names=names, order='deglex') random_samples = [BPR.random_element() for _ in [0 .. 100]] random_ideal = ideal(random_samples) save(random_ideal, 'random_ideal') reset() ID = load('random_ideal.sobj')
However, as you can see in the following lines, if the term ordering is set to 'degrevlex', the load
command produces an error.
names = ['x%d' % i for i in [0 .. 100]] BPR = BooleanPolynomialRing(names=names, order='degrevlex') random_samples = [BPR.random_element() for _ in [0 .. 100]] random_ideal = ideal(random_samples) save(random_ideal, 'random_ideal') reset() ID = load('random_ideal.sobj')
Error:
KeyError Traceback (most recent call last) sage-9-1/SageMath/local/lib/python3.7/site-packages/sage/all_cmdline.py in <module>() 5 save(random_ideal, 'random_ideal') 6 reset() ----> 7 ID = load('random_ideal.sobj') sage-9-1/SageMath/local/lib/python3.7/site-packages/sage/misc/persist.pyx in sage.misc.persist.load (build/cythonized/sage/misc/persist.c:2900)() 156 157 ## Load file by absolute filename --> 158 with open(filename, 'rb') as fobj: 159 X = loads(fobj.read(), compress=compress, **kwargs) 160 try: sage-9-1/SageMath/local/lib/python3.7/site-packages/sage/misc/persist.pyx in sage.misc.persist.load (build/cythonized/sage/misc/persist.c:2850)() 157 ## Load file by absolute filename 158 with open(filename, 'rb') as fobj: --> 159 X = loads(fobj.read(), compress=compress, **kwargs) 160 try: 161 X._default_filename = os.path.abspath(filename) sage-9-1/SageMath/local/lib/python3.7/site-packages/sage/misc/persist.pyx in sage.misc.persist.loads (build/cythonized/sage/misc/persist.c:7424)() 1042 1043 unpickler = SageUnpickler(io.BytesIO(s), **kwargs) -> 1044 return unpickler.load() 1045 1046 sage-9-1/SageMath/local/lib/python3.7/site-packages/sage/rings/polynomial/pbori.pyx in sage.rings.polynomial.pbori.unpickle_BooleanPolynomial0 (build/cythonized/sage/rings/polynomial/pbori.cpp:59767)() 7837 """ 7838 from brial.parallel import _decode_polynomial -> 7839 return _decode_polynomial(l) 7840 7841 sage-9-1/SageMath/local/lib/python3.7/site-packages/brial/parallel.py in _decode_polynomial(code) 154 155 def _decode_polynomial(code): --> 156 return from_fast_pickable(*code)[0] 157 158 sage-9-1/SageMath/local/lib/python3.7/site-packages/brial/parallel.py in from_fast_pickable(l, r) 137 for i in reversed(range(len(terms))): 138 (v, t, e) = terms[i] --> 139 t = i2poly[t] 140 e = i2poly[e] 141 terms[i] = if_then_else(v, t, e) KeyError: 3
The version of SageMath as well as the specification of the operating system for which the above issue has been observed are as follows:
SageMath version 9.1, Release Date: 2020-05-20 Linux hosein 5.4.0-70-generic #78-Ubuntu SMP Fri Mar 19 13:29:52 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
It should be noted that the same issue exists for SageMath version 9.1 running on Windows 10.
Change History (8)
comment:1 Changed 15 months ago by
- Description modified (diff)
comment:2 Changed 15 months ago by
- Cc fbissey added
- Component changed from PLEASE CHANGE to packages: standard
- Type changed from PLEASE CHANGE to defect
comment:3 Changed 15 months ago by
- Cc chapoton added
comment:4 Changed 15 months ago by
comment:5 Changed 14 months ago by
- Milestone changed from sage-9.3 to sage-9.4
Moving to 9.4, as 9.3 has been released.
comment:6 Changed 10 months ago by
- Milestone changed from sage-9.4 to sage-9.5
comment:7 Changed 6 months ago by
- Milestone changed from sage-9.5 to sage-9.6
comment:8 Changed 8 weeks ago by
- Milestone changed from sage-9.6 to sage-9.7
OK, it still happens in 9.3.rc1
Not really my area of expertise, which is another reason it needed merging in sage. Frédéric Chapoton may have a better idea of where the problem may be.