Skip to content

Commit

Permalink
use _order in has_order when possible
Browse files Browse the repository at this point in the history
  • Loading branch information
grhkm21 committed Sep 11, 2024
1 parent c9e33ea commit 41cb6e9
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions src/sage/schemes/elliptic_curves/ell_finite_field.py
Original file line number Diff line number Diff line change
Expand Up @@ -1399,6 +1399,7 @@ def has_order(self, value, num_checks=8):
True
sage: E.has_order(N^2)
True
sage: del E._order
sage: E.has_order(N^2 + N)
True
Expand All @@ -1419,7 +1420,7 @@ def has_order(self, value, num_checks=8):
# orders So we go with computing directly instead.
# In #38341, the bound has been increased to a large value (2^64), but
# it should be decreased (to ~100) after bug #38617 is fixed.
if q <= 2**64:
if q <= 2**64 or hasattr(self, "_order"):
return self.order() == value

# This might be slow
Expand Down Expand Up @@ -3008,24 +3009,24 @@ def EllipticCurve_with_prime_order(N):
sage: set_random_seed(1337)
sage: for _, E in zip(range(3), EllipticCurve_with_prime_order(10^9 + 7)):
....: print(E)
verbose 2 (2866: ell_finite_field.py, EllipticCurve_with_prime_order) Computing the Hilbert class polynomial H_-163
verbose 2 (...: ell_finite_field.py, EllipticCurve_with_prime_order) Computing the Hilbert class polynomial H_-163
Elliptic Curve defined by y^2 = x^3 + 265977778*x + 120868502 over Finite Field of size 1000041437
verbose 2 (2866: ell_finite_field.py, EllipticCurve_with_prime_order) Computing the Hilbert class polynomial H_-667
verbose 2 (...: ell_finite_field.py, EllipticCurve_with_prime_order) Computing the Hilbert class polynomial H_-667
Elliptic Curve defined by y^2 = x^3 + 689795416*x + 188156157 over Finite Field of size 999969307
Elliptic Curve defined by y^2 = x^3 + 999178436*x + 900579394 over Finite Field of size 999969307
sage: set_verbose(4)
sage: set_random_seed(1337)
sage: for _, E in zip(range(3), EllipticCurve_with_prime_order(10^9 + 7)):
....: print(E)
verbose 4 (2866: ell_finite_field.py, EllipticCurve_with_prime_order) Testing D=-19
verbose 4 (...: ell_finite_field.py, EllipticCurve_with_prime_order) Testing D=-19
...
verbose 4 (2866: ell_finite_field.py, EllipticCurve_with_prime_order) Testing D=-163
verbose 2 (2866: ell_finite_field.py, EllipticCurve_with_prime_order) Computing the Hilbert class polynomial H_-163
verbose 4 (...: ell_finite_field.py, EllipticCurve_with_prime_order) Testing D=-163
verbose 2 (...: ell_finite_field.py, EllipticCurve_with_prime_order) Computing the Hilbert class polynomial H_-163
Elliptic Curve defined by y^2 = x^3 + 265977778*x + 120868502 over Finite Field of size 1000041437
verbose 4 (2866: ell_finite_field.py, EllipticCurve_with_prime_order) Testing D=-179
verbose 4 (...: ell_finite_field.py, EllipticCurve_with_prime_order) Testing D=-179
...
verbose 4 (2866: ell_finite_field.py, EllipticCurve_with_prime_order) Testing D=-667
verbose 2 (2866: ell_finite_field.py, EllipticCurve_with_prime_order) Computing the Hilbert class polynomial H_-667
verbose 4 (...: ell_finite_field.py, EllipticCurve_with_prime_order) Testing D=-667
verbose 2 (...: ell_finite_field.py, EllipticCurve_with_prime_order) Computing the Hilbert class polynomial H_-667
Elliptic Curve defined by y^2 = x^3 + 689795416*x + 188156157 over Finite Field of size 999969307
Elliptic Curve defined by y^2 = x^3 + 999178436*x + 900579394 over Finite Field of size 999969307
Expand Down

0 comments on commit 41cb6e9

Please sign in to comment.