-
-
Notifications
You must be signed in to change notification settings - Fork 580
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
class group iterator is too slow #10184
Comments
Attachment: classgroup_iterator.patch.gz |
comment:1
Is this waiting on something, or does it just need review? |
comment:2
Hi David, Replying to @roed314:
I think it just hasn't been reviewed by anyone. Cheers, E. |
comment:3
I'll mark it as needs review then. I don't have time to review it at the moment, though I may be able to eventually. |
comment:4
There are some formatting problems. The "sage:" indentation should be left as it was:
And you really should put a blank line between 2 functions, lines 213--214. Also: please put your real name in the Author field on the ticket. |
This comment has been minimized.
This comment has been minimized.
Author: Emmanuel Thome |
Attachment: classgroup_iterator_2.patch.gz |
comment:6
Rebased to 5.11b3. This included adjusting line numbers. Also, last example had to be changed---the order of the class group elements is different. Lastly, the new iterator |
Reviewer: Shahed Sharif |
Changed keywords from none to sd51 |
comment:7
Shahed: I am puzzled by the constructs such as [l for l in reflist[k]] in the doctests in your patch. This is completely equivalent to |
comment:8
Hi David, This is unchanged from Emmanuel's patch, but I can simplify it in a new version. Also, it has been brought to my attention (by you and J. Cremona) that Pari produces the generators for the class group in a different order depending on the implementation. The given doctests were tested on my 32-bit system running sage 5.11b3; someone (probably me given time) will need to test this on a 64-bit system and put in the relevant doc test. Shahed |
comment:9
Replying to @sagetrac-ssharif:
Is it only the order that is different between 32- and 64-bit? In other words, if the output of the function is sorted, would 32- and 64-bit machines produce the same list of generators? |
comment:10
Attachment: classgroup_iterator_3.patch.gz Hi. Thanks for your feedback. I just posted another version of the patch which fixes indentation, and adds documentation and doctests to iter_inner. Looking back at this, and considering your warning on the generators returned by pari, I think that the doctest for the iterator is probably too fragile. What do you think ? E. |
comment:11
Alex and Emmanuel: Yes, the order is exactly the problem---the output of G.list() is permuted between the 2 cases. Also (though I haven't tested this on 64-bit), I believe the representative ideal in each class is also different; but this should not pose a problem, since G(I) for example returns the class of I. I tried using set() to fix the issue, but that didn't work; not sure why. |
comment:15
I made a branch. New commits:
|
Branch: public/10184 |
Commit: |
comment:18
I made some small additional changes for speed and safety (in case inplace multiplication actually becomes inplace, really this does what the previous code was doing). This is really the same algorithm but using less multiplication. So if my changes look good, then positive review. |
Changed reviewer from Shahed Sharif to Shahed Sharif, Travis Scrimshaw |
comment:19
Looks good to me. Let it be. |
Changed reviewer from Shahed Sharif, Travis Scrimshaw to Shahed Sharif, Travis Scrimshaw, Frédéric Chapoton |
Changed branch from public/10184 to |
the class group iterator takes evey element in turn, and computes the product of the
g^i
's. Sure powers are computed by repeated squaring, but for iterators this is suboptimal.On my laptop, from this situation...
the attached patch improves to...
which is a tad better.
doctest included (actually the previous doctest wasn't doing much, this one is slightly more thorough).
Note: while the code would work for any abelian group, I believe it makes sense only when the group operation is sufficiently non-trivial.
Component: number fields
Keywords: sd51
Author: Emmanuel Thome
Branch/Commit:
9fe600e
Reviewer: Shahed Sharif, Travis Scrimshaw, Frédéric Chapoton
Issue created by migration from https://trac.sagemath.org/ticket/10184
The text was updated successfully, but these errors were encountered: