-
-
Notifications
You must be signed in to change notification settings - Fork 567
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
isogeny efficiency improvement #18589
Comments
This comment has been minimized.
This comment has been minimized.
Commit: |
New commits:
|
This comment has been minimized.
This comment has been minimized.
Branch: u/cremona/18589 |
comment:4
Interesting, the hardest part of the computation is checking the consistency, not computing the actual result. I had a look at what PARI can do for isogenies: Minor comment: in the doctest, you don't need
|
comment:5
Thanks for the comments, I noticed you over at pari-dev and wondered what you were up to. I don't know how general the pari code is -- here we can handle arbitrary fields (but only separable isogenies). Over number fields the really hard part is determining which prime degrees to test to get the whole class, and I put a lot of work into this (including CM and "potential CM" cases). Some checking is necessary: I have an example where the 13-division poly factors as 14 degree 6 factors, but only 2 of them are kernel polys! For the rest you need to make a quadratic extension which splits each into two cubics, and then you have to match the factors. The Sage code does this! |
comment:6
Replying to @JohnCremona:
Is this example in Sage? It would be good to have (if it takes too long, just add |
comment:7
Replying to @JohnCremona:
I'm wondering if you could use resultants instead... |
comment:8
Replying to @jdemeyer:
No, but it is Example 3.1.1 on page 28 of [KT2013] which is here: http://wrap.warwick.ac.uk/57568/ |
comment:9
Replying to @jdemeyer:
I thought that we did use resultants... but looking again at Kimi's code, the relevant function is mult() on line 1960: the effect of this function is to take the polynomial f and the rational function m, under the assumption that f is coprime to the denominator of m, and return the poly whose roots are m(alpha) as alpha runs over the roots of f. If m were a polynomial that would be res_Y(X-m(Y),f(Y)). I can see now that we could stil use that formula with m(Y) replaced by the polynomial p(Y) which satisfies p*d=n (mod f) where m=n/d which would amount to one extended gcd and one resultant. This may be better than the current code since it does not use rational functions. Can we keep this idea for another ticket? |
comment:10
Replying to @JohnCremona:
Sure... |
comment:11
In your code, "special case 1" is really a special case of "special case 2". For simplicity, I would therefore keep only special case 2. |
comment:12
There is a pre-existing typo: |
comment:13
There is a redundant
|
comment:14
OK, I will fix the redundant imports; I agree that Case 1 is a special case of Case 2. And I am working on the resultant improvement -- so setting to "needs work" is fine. (Without the patch though I would not have been able to compute this: http://beta.lmfdb.org/EllipticCurve/2.2.89.1/81.1/a/ !! |
comment:15
Since the constant |
comment:16
Also, can't you avoid some conversions? In
the call |
comment:17
In this loop,
when can it happen that |
comment:18
Replying to @JohnCremona:
I don't quite get what you're saying here. I think I said "resultants" too quickly before looking at the actual code. Mathematically, we need to compute
where
Now suppose
which equals
Now compute this in (this was written up quickly, I haven't really checked that it's correct) |
comment:19
Actually, my idea works, but it's not so efficient since you're working mod |
comment:20
I'm going to set this ticket to needs_work such that you can address the several minor points I mentioned (and answer [comment:17], which I need to understand the algorithm better). Never mind the computation of |
comment:21
Replying to @JohnCremona:
Wouldn't it be a good testcase for the current code (both over F_3 and F_9)? |
comment:39
I think you can simplify
to
(in the line below, you are only selecting the degrees you care about anyway) |
comment:40
Replying to @jdemeyer:
Me too, but as I tried to explain the script I was running was computing the isogeny class many times. I am rerunning just E.isogeny_class() under 6.7 now and will report back (but this ticket need not wait). |
comment:41
Replying to @jdemeyer:
Fine, I will make these simplifications! |
Branch pushed to git repo; I updated commit sha1. New commits:
|
Reviewer: Jeroen Demeyer |
comment:43
Replying to @JohnCremona:
I agree that this ticket makes sense by itself. It's just that it only does some easy optimizations, it doesn't fundamentally improve the algorithm. I have been thinking a bit about the computation of I'm wondering if it's worth pursuing further and for that I need to know if |
comment:44
Replying to @sagetrac-git:
The check
|
comment:45
Replying to @jdemeyer:
Agreed.
That is true -- you can use either. You can see in Prop 3.3.1 of the thesis that both are natural! It would be good to improve this.
|
Branch pushed to git repo; I updated commit sha1. New commits:
|
comment:47
Replying to @jdemeyer:
You are right, I had forgotten that in creating the dict it might have had some empty lists. I should have known better than to do more simplifaction than you recommended! New commits:
New commits:
|
comment:48
Any further changes will have to wait until tomorrow.... |
comment:49
Further work: #18611 |
comment:50
Many thanks for a fantastic job reviewing this ( excelletn in both mathematical and coding aspects). I will continue the discussion over at #18611. I suspect that there have been other changes since 6.7 which have sped up my l=89 example, to do with factoring the 89-division polynomial over a quadratic field. As you say, one computation of mult() could not take such a long time even before this patch, yet a single run of E.isogenies_prime_degree(89) is stil running after 14 hours, and all that has to do is run isogenies_prime_degree_general once with l=89. |
comment:51
Replying to @JohnCremona:
Can you interrupt (CTRL-C) it and look at the traceback to see what it's doing? |
comment:52
Replying to @jdemeyer:
As expected: it is in the lines
and
and
and below that
and at the bottom, pari/gen.pyx |
comment:53
Thanks for the info. Interesting, it looks like the |
comment:54
Replying to @jdemeyer:
I think that the real point here is #18461 which re-implemented univariate polynomial gcd! So it is possible that without any of the changes on this ticket or #18611 we would have seen anoticeable improvement. Anyway, between these two tickets we certainly have more efficient code so the exercise was worth carrying out. Thanks! |
comment:55
Replying to @JohnCremona:
From the traceback, you see that PARI is used to compute this gcd, so the generic Sage code doesn't matter. |
Changed branch from u/cremona/18589 to |
Computation of isogenies of prime degree p is expensive when the degree is neither a "genus zero" prime [2,3,5,7,13] or a "hyperelliptic prime" [11, 17, 19, 23, 29, 31, 41, 47, 59, 71] (for these there is special code written). In one situation we can save time, after factoring the degree
(p^2-1)/2
division polynomial, if there is exactly one factor of degree (p-1)/2, or one subset of factors whose product has that degree, then the factor of degree (p-1)/2 must be a kernel polynomial. Then we do not need to check consistency, which is very expensive.The example which led me to this was with p=89 over a quadratic number field, where E.isogeny_class() was taking days. After the change here that goes down to 3 hours. (There are 4 curves in the isogeny class and the code requires factoring the 89-division polynomial of each!) I used a less extreme example for a doctest: a 37-isogeny.
CC: @defeo
Component: elliptic curves
Keywords: isogeny
Author: John Cremona
Branch/Commit:
3d687e5
Reviewer: Jeroen Demeyer
Issue created by migration from https://trac.sagemath.org/ticket/18589
The text was updated successfully, but these errors were encountered: