-
-
Notifications
You must be signed in to change notification settings - Fork 482
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
gh-37415: make EllipticCurvePoint_field inherit from EllipticCurvePoint
The method `EllipticCurve_generic.__contains__()` checks for inheritance from `EllipticCurvePoint`; however, the other classes for points on elliptic curves do not inherit from this class. This pull request fixes this. Note that there is some overlap with #33228. This change makes `P in E` much faster: - Over **Q**: ```python E = EllipticCurve('37a1') P = E((0, -1)) %timeit P in E ``` Before: `35.3 µs ± 186 ns per loop (mean ± std. dev. of 7 runs, 10,000 loops each)` After: `324 ns ± 0.535 ns per loop (mean ± std. dev. of 7 runs, 1,000,000 loops each)` - Over a finite field: ```python F.<a> = FiniteField((23, 2), modulus='random') E = EllipticCurve_from_j(F.random_element()) P = E.random_point() %timeit P in E ``` Before: `36.4 µs ± 542 ns per loop (mean ± std. dev. of 7 runs, 10,000 loops each)` After: `333 ns ± 5.03 ns per loop (mean ± std. dev. of 7 runs, 1,000,000 loops each)` URL: #37415 Reported by: Peter Bruin Reviewer(s): Kwankyu Lee, Peter Bruin
- Loading branch information
Showing
2 changed files
with
41 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters