You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, this is quite a small issue with regards to very large polynomials. Given a specific order and degree, the irreducible polynomial function can cause an overflow error. I'm not sure if this is an issue with other values but it definitely fails with the below code.
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.8/dist-packages/galois/_polys/_irreducible.py", line 247, in irreducible_poly
return next(_random_search(order, degree, "is_irreducible"))
File "/usr/local/lib/python3.8/dist-packages/galois/_polys/_search.py", line 107, in _random_search
if getattr(poly, test)():
File "/usr/local/lib/python3.8/dist-packages/galois/_polys/_irreducible.py", line 112, in is_irreducible
hi = pow(h0, q ** (ni - n0), f)
File "/usr/local/lib/python3.8/dist-packages/galois/_polys/_poly.py", line 1442, in __pow__
q = _dense.pow_jit(self.field)(a, exponent, b)
File "/usr/local/lib/python3.8/dist-packages/galois/_polys/_dense.py", line 352, in __call__
b_vec = np.array(b_vec[::-1], dtype=np.uint64) # Make vector MSWord -> LSWord
OverflowError: Python int too large to convert to C long
I've done my due diligence and tried to find something to help with the issue. It appears that b_vec will have exactly 2**64 as its last value given the above code which causes the overflow. Changing while b > 2**64: to while b >= 2**64: seems to fix the problem. I must admit I'm not that familiar with the specifics of how the pow function implementation works and if this might cause an issue (and if it might cause an issue with something else).
Thanks for the awesome library!
The text was updated successfully, but these errors were encountered:
I believe the fix you identified is the correct one. If you'd like to submit a pull request, that would be great. If not, no worries; I can open one later.
Hi, this is quite a small issue with regards to very large polynomials. Given a specific order and degree, the irreducible polynomial function can cause an overflow error. I'm not sure if this is an issue with other values but it definitely fails with the below code.
Code to reproduce the issue.
I've done my due diligence and tried to find something to help with the issue. It appears that
b_vec
will have exactly 2**64 as its last value given the above code which causes the overflow. Changingwhile b > 2**64:
towhile b >= 2**64:
seems to fix the problem. I must admit I'm not that familiar with the specifics of how the pow function implementation works and if this might cause an issue (and if it might cause an issue with something else).Thanks for the awesome library!
The text was updated successfully, but these errors were encountered: