Commit
1 year ago
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: https://github.com/sagemath/sage/pull/37415 Reported by: Peter Bruin Reviewer(s): Kwankyu Lee, Peter Bruin
Author
Release Manager
Loading