-
-
Notifications
You must be signed in to change notification settings - Fork 419
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
Two bug fixes for elliptic curve abelian_group() #3111
Comments
comment:1
Under OS X (10.5.1 intel core2 duo with 2GB RAM)
Running this under gdb yields nothing useful:
|
comment:2
NOte -- the above is not a leak between calls of abelian_group. It's that one single calculation is somehow using up all memory and crashing sage. |
comment:3
With Sage 3.0.1 on sage.math this seems rather harmless:
If for some dumb reason pari doubles the stack once more on OSX you are SOL. I tried on OSX 10.5 and I hit the same error. Now it sounds like a 64 bit OSX version of Sage would fix that issue, but ..... Cheers, Michael |
comment:4
I found the bug which causes this. It is not in any of the generic code at all, but in some lines I added quite late on in ell_finite_field.py to make one step (in code which happens relatively infrequently) "more efficient". I'll post a patch on Wednesday. |
comment:5
Two bugs fixed:
For the future: I still have some more plans for ell_finite_field in cases where j is not in the prime field. Then, at present the only way we have to compute the cardinality is via the group structure, but for the majority of cases it should be easier to compute the cardinality only using Mestre's trick. However, Mestre's trick (as stated and proved by Schoof's second JNTB paper) is usually stated over prime fields, and over non-prime fields of square size there is one situation where Mestre's trick does not work (specifically when q is a square and the Frobenius is an integer and the group order (and structure) is either When I have worked out how best to detect that case there will be a new patch. Until then, curves whose j is not in the prime field and which do not have cyclic groups run into the efficiency problem (fixed above but only when the cardinality is already known) where some rather large elliptic curve discrete logs may need to be computed. |
comment:6
Hmm ... there doesn't seem to be a patch attached, despite the title saying "with patch." :) |
comment:7
Attachment: sage-3111.patch.gz Sorry about that, it is there now. And as I looked at the patch after uploading it I saw that there are a couple of debugging print statements which need deleting, near the end (lines 1194/5) but I'll leave that until tomorrow. |
comment:8
Doctests pass in ell_generic.py and ell_finite_field. No more printed failues when running code in ticket description (they were there before I applied the paths), though I also run out of memory on mac 10.5 with 2 GB ram. If this is not expected behavior it should be reported as a separate ticket. Positive review pending removal of debugging print statements. |
comment:9
I think that we should also add at least one doctest showing that this behavior is fixed. |
Additional tp sage-3111.patch |
comment:10
Attachment: sage-3111-extra.patch.gz sage-3111-extra.patch does the following:
For the doctest I check that it is OK for 10 random primes up to |
comment:11
I would prefer to use 10 specific primes, as using random primes gives unrepeatable results. Unless Sage does something like reset the random seed before each test? |
comment:12
Replying to @JohnCremona:
Hi John, you could do two tests:
Cheers, Michael |
comment:13
Replying to @sagetrac-broune:
Sage now uses the same seed per default for randomness at the start of each doctest, so it is reproducible. Not all sources of randomness have that property yet, but for primes it should work. So no need to stick Cheers, Michael |
Attachment: sage-3111-extra2.patch.gz Apply after previous two |
comment:14
Michael, I have added an extra patch anyway -- my comment on it was killed by trac as you were editing at the same time )I thought trac would be cleverer than that!) John |
comment:15
If you still want the long test (all primes to 10000) I can add it tomorrow -- my bedtime now. |
comment:16
Sorry about the misinformation on random - it is good that Sage handles this nicely. Runnning the doctest code for the 10 primes with an unpatched Sage does not trigger the bug after I tried it a few times on my machine. Ten primes just does not seem to be enough to hit the bug with high probability. It would be better to find some primes that always trigger the bug. I get different numbers failing on each run, except that 7 seems to show up every time. So it would be nice to check p=7 every time in the doctest, in addition to the random tests. |
Attachment: sage-3111-extra3.patch.gz apply after all previous |
comment:17
Yet another patch sage-3111-extra3.patch now tests the original full code for primes to 10000 but this longer test is marked #long as it takes around 20s. Apologies for the succession of small cumulative patches, Michael: I only trust myself to do |
comment:18
The phrase "needs minimal further review" resulted in this one not being listed by trac as a "needs review" ticket so I have changed that and hope that someone can oblige. The extra patches do what was wanted by the orginal reviewer. |
comment:19
This looks good. (I don't know how this slipped under the radar as long as it did.) |
comment:20
Finally! Merged all four patches in Sage 3.0.3.alpha1 |
Paste this code into a Sage session:
The output varies on run and computer. Typical output looks like this:
The actual failures are assertion failures in the baby-step giant-step implementation.
-- William
Component: number theory
Issue created by migration from https://trac.sagemath.org/ticket/3111
The text was updated successfully, but these errors were encountered: