Skip to content

Commit

Permalink
use semi-primitive root as suggested by comment in code
Browse files Browse the repository at this point in the history
  • Loading branch information
yyyyx4 committed Aug 21, 2023
1 parent 04232a4 commit c518b47
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions src/sage/schemes/elliptic_curves/isogeny_small_degree.py
Original file line number Diff line number Diff line change
Expand Up @@ -2397,14 +2397,18 @@ def is_kernel_polynomial(E, m, f):
if m == 2 or m == 3:
return True

# For each a in a set of generators of (Z/mZ)^* we check that the
# multiplication-by-a map permutes the roots of f. It would be
# enough to take a generating (Z/mZ)^*/{1,-1} but that is not
# implemented. If m is prime (or more generally, has a primitive
# root) then only one a will be needed.
# For each a in a set of generators of (Z/mZ)^*/{1,-1} we check
# that the multiplication-by-a map permutes the roots of f.
# If m is prime (or more generally, has a primitive root) then
# only one a will be needed.

from sage.rings.finite_rings.integer_mod_ring import Integers
for a in Integers(m).unit_gens():
if m & 1 and m.is_prime_power():
gens = _least_semi_primitive(m),
else:
from sage.rings.finite_rings.integer_mod_ring import Integers
gens = Integers(m).unit_gens()

Check warning on line 2409 in src/sage/schemes/elliptic_curves/isogeny_small_degree.py

View check run for this annotation

Codecov / codecov/patch

src/sage/schemes/elliptic_curves/isogeny_small_degree.py#L2408-L2409

Added lines #L2408 - L2409 were not covered by tests

for a in gens:
mu = E.multiplication_by_m(a, x_only=True)
if f( S(mu.numerator()) / S(mu.denominator()) ) != 0:
return False
Expand Down

0 comments on commit c518b47

Please sign in to comment.