id summary reporter owner description type status priority milestone component resolution keywords cc merged author reviewer upstream work_issues branch commit dependencies stopgaps
24300 Computation of modular form Hecke matrices is very inefficient davidloeffler "In order to compute the matrix of T(p) on a modular forms space, we currently compute a q-expansion basis of the space (using modular symbols) up to high enough precision that T(p) can be read off from the q-expansions. If the space is at all large, then we will need huge numbers of q-expansion coefficients to do things this way: to compute T(p) on modular forms, this algorithm will trigger computation of T(r) on modular symbols for all primes r up to about p * (Sturm bound for the space), which is very, very slow. For instance, this computation takes a whole 21 seconds:
{{{
sage: C=CuspForms(105, 2)
sage: time C.hecke_matrix(17)
CPU times: user 21 s, sys: 327 ms, total: 21.3 s
Wall time: 21.3 s
[ 1/3 2/3 -1/3 ...
}}}
If you run this with {{{set_verbose(1)}}}, you see that along the way it computes Hecke matrices on {{{C.ambient().modular_symbols(sign=1)}}} for all primes up to 457!
This is trivially fixable by being more intelligent about how we compute Hecke matrices. The following code computes T(2003) in only about half a second, and only needs modular symbol T(r) for r = 2003 and the primes r < Sturm bound:
{{{
sage: A = C.modular_symbols(sign=1)
sage: time sage.modular.modform.cuspidal_submodule._convert_matrix_from_modsyms(A, A.hecke_matrix(2003))[0]
CPU times: user 635 ms, sys: 16.5 ms, total: 652 ms
Wall time: 632 ms
[ 10/3 -28 -155/3 380/3 ...
}}}" defect closed major sage-8.2 modular forms fixed David Loeffler Vincent Delecroix N/A fe985bc15f32bc8d9e221219ae435d5b59e02046 fe985bc15f32bc8d9e221219ae435d5b59e02046