-
-
Notifications
You must be signed in to change notification settings - Fork 481
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
make EllipticCurvePoint_field inherit from EllipticCurvePoint #37415
make EllipticCurvePoint_field inherit from EllipticCurvePoint #37415
Conversation
I agree that points over extension fields should be |
I looked at how you dealt with this in #33228; I think this is a neat solution and I'm happy to simplify |
Eventually we should still make the machinery for points over extension fields work. But I believe this will need some larger adjustments, in particular within some of the isogeny-related code... |
Documentation preview for this PR (built with commit 051126d; changes) is ready! 🎉 |
Indeed, there is definitely some work to be done. I ran into a bug with point homsets over extension fields: #37427 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
…CurvePoint 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 sagemath#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: sagemath#37415 Reported by: Peter Bruin Reviewer(s): Kwankyu Lee, Peter Bruin
…CurvePoint 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 sagemath#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: sagemath#37415 Reported by: Peter Bruin Reviewer(s): Kwankyu Lee, Peter Bruin
…CurvePoint 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 sagemath#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: sagemath#37415 Reported by: Peter Bruin Reviewer(s): Kwankyu Lee, Peter Bruin
The method
EllipticCurve_generic.__contains__()
checks for inheritance fromEllipticCurvePoint
; 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: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)
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)