Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Always return int from Poly.degree #361

Merged
merged 2 commits into from
May 16, 2022

Conversation

mhostetter
Copy link
Owner

Fixes #360. In certain circumstances a np.int64 was returned from Poly.degree. When performing irreducibility checks and computing q**m, if either q or m wasn't an int the arithmetic could overflow and the irreducibility check became erroneous.

Now, #360 runs as follows:

# test_2.py
import galois

f = galois.Poly.Degrees([233, 74, 0])
print(galois.is_irreducible(f))

#initial detection loop
for k in range(1, 233):
    poly = galois.Poly.Degrees([233, k, 0])
    if galois.is_irreducible(poly):
        print("Found one: ", k, poly)
In [1]: %run test_2.py
True
Found one:  74 x^233 + x^74 + 1
Found one:  159 x^233 + x^159 + 1

In [2]: 

Fixes #360. In certain circumstances a `np.int64` was returned from `Poly.degree`. When performing irreducibility checks and computing `q**m`, if either `q` or `m` wasn't an `int` the arithmetic could overflow and the irreducibility check became erroneous.
@codecov
Copy link

codecov bot commented May 16, 2022

Codecov Report

Merging #361 (e9a56d4) into master (c5d930d) will not change coverage.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master     #361   +/-   ##
=======================================
  Coverage   96.76%   96.76%           
=======================================
  Files          41       41           
  Lines        5225     5225           
=======================================
  Hits         5056     5056           
  Misses        169      169           
Impacted Files Coverage Δ
galois/_polys/_poly.py 95.77% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c5d930d...e9a56d4. Read the comment docs.

@mhostetter mhostetter merged commit fe379c3 into master May 16, 2022
@mhostetter mhostetter deleted the fix-is-irreducible-bug-for-prime-degree branch May 16, 2022 15:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

galois.is_irreducible(poly) seems to return some false negatives in large odd exponent GFs
1 participant