Closed williamstein closed 13 years ago
There are two reasons why this is much slower than we expect it to be: First, the restriction of subspaces, when decomposing them, is checked. This is not necessary and already this increases the performance. Second, sorting the resulting Hecke modules depends on computing several Hecke matrices. This we cannot change without introducing major incompatibilities. But I added an option, that sorts the modules by their basis structure. This makes the function again much fast.
sage: M = ModularSymbols(1000,2,sign=1).new_subspace().cuspidal_subspace()
sage: %time d = M.decomposition(3)
CPU times: user 1.62 s, sys: 0.00 s, total: 1.63 s
Wall time: 1.92 s
and
sage: M = ModularSymbols(1000,2,sign=1).new_subspace().cuspidal_subspace()
sage: %time d = M.decomposition(3, sort_by_basis = True)
CPU times: user 0.94 s, sys: 0.00 s, total: 0.94 s
Wall time: 1.59 s
Note, that the bare decomposition given in the description is not sufficient: We need at least compute two further decompositions, since two of the resulting modules are not irreducible with respect to T(2).
Author: Martin Raum
Description changed:
---
+++
@@ -43,4 +43,7 @@
So Sage is nearly the same as Magma at the decomposition part of the computation, but is getting totally killed by using the wrong algorithm or doing something really dumb that it shouldn't even bother doing. I.e., above 3.2 seconds is spent doing something probably unnecessary, and only 0.08 is spent doing what should be the dominant step.
-There are of course numerous other similar examples. For concreteness, I think to close this ticket one should just worry about making it so that the above example completes in < 0.2 seconds instead of 3.3 seconds.
+There are of course numerous other similar examples. For concreteness, I think to close this ticket one should just worry about making it so that the above example completes in < 0.2 seconds instead of 3.3 seconds.
+
+**Apply:**
+1. trac-4578-optimize_modular_symbols_decomposition.patch
Description changed:
---
+++
@@ -45,5 +45,8 @@
There are of course numerous other similar examples. For concreteness, I think to close this ticket one should just worry about making it so that the above example completes in < 0.2 seconds instead of 3.3 seconds.
+**Depends on:**
+1. #10987
+
**Apply:**
1. trac-4578-optimize_modular_symbols_decomposition.patch
Hang on. Surely this patch doesn't remotely match the ticket description? If called with the default arguments this patch is a complete no-op!
Did you perhaps want to call decomposition_of_subspace
with the argument "check_restrict=False"
? Because Sage's Hecke algebras are always commutative, this check is probably redundant. That would, I imagine, result in a substantial speedup.
Description changed:
---
+++
@@ -50,3 +50,4 @@
**Apply:**
1. trac-4578-optimize_modular_symbols_decomposition.patch
+2. trac-4578-optimize_modular_symbols_decomposition-doctest.patch
Attachment: trac-4578-optimize_modular_symbols_decomposition-doctest.patch.gz
You're completely right. Thank you for catching this! I replaced the old patch with the right one. Doing this it turned out, that I needed to change one doctest. The change is justified as the element alpha - 1 and 1/2 alpha + 1/2 have the same minpolys. They are, thought, elements of number fields defined with completely different polynomial (They are isomorphic!). This happens because the number field is now generated by a different piece of code in the linalg modules of Sage.
The old and new parent are for me
OLD:
Number Field in alpha with defining polynomial x^2 + 4*x + 1
NEW:
Number Field in alpha with defining polynomial x^2 - 2*x - 11
I'm happy with that change. As Martin has pointed out, the timing comparison with Magma is misleading: Sage is computing much more information than Magma (decomposing a bunch more Hecke operators). So I advocate merging Martin's patch and closing this ticket.
Reviewer: David Loeffler
There is an issue with the documentation:
dochtml.log:/mnt/usb1/scratch/jdemeyer/merger/sage-4.7.2.alpha1/local/lib/python2.6/site-packages/sage/modular/hecke/module.py:docstring of sage.modular.hecke.module.HeckeModule_free_module.T:7: (WARNING/2) Bullet list ends without a blank line; unexpected unindent.
Description changed:
---
+++
@@ -49,5 +49,5 @@
1. #10987
**Apply:**
-1. trac-4578-optimize_modular_symbols_decomposition.patch
+1. trac-4578-optimize_modular_symbols_decomposition-v2.patch
2. trac-4578-optimize_modular_symbols_decomposition-doctest.patch
Attachment: trac-4578-optimize_modular_symbols_decomposition-v2.patch.gz
This was a very stupid typo. I have checked that it occurs with the old patch and does not occur with the new one. The only thing that I changes is two spaces, one added, one removed. So I set this back to positive review; Sorry for the inconvenience, Jeroen!
Merged: sage-4.7.2.alpha2
In short, the decomposition function on spaces of modular symbols is mysteriously way slower than it should be. Why?
Consider this:
This huge timing discrepancy isn't due to caching:
For comparison:
So Sage is nearly the same as Magma at the decomposition part of the computation, but is getting totally killed by using the wrong algorithm or doing something really dumb that it shouldn't even bother doing. I.e., above 3.2 seconds is spent doing something probably unnecessary, and only 0.08 is spent doing what should be the dominant step.
There are of course numerous other similar examples. For concreteness, I think to close this ticket one should just worry about making it so that the above example completes in < 0.2 seconds instead of 3.3 seconds.
Depends on:
10987
Apply:
CC: @sagetrac-GeorgSWeber @aghitza
Component: modular forms
Author: Martin Raum
Reviewer: David Loeffler
Merged: sage-4.7.2.alpha2
Issue created by migration from https://trac.sagemath.org/ticket/4578