In 9.6 and 9.7.rc1, I follow the suggestions at ticket #32647 and all
seems well:

sage: from sage.modular.dims import dimension_cusp_forms
sage: time dimension_cusp_forms(Gamma0(99), 100)
CPU times: user 4 ms, sys: 0 ns, total: 4 ms
Wall time: 5.19 ms
1184

-- in particular it is fast and I see no deprecation warning.  David,
you didn't say which Sage version you were running.

John

On Tue, 20 Sept 2022 at 09:07, David Loeffler <[email protected]> wrote:
>
> How should one go about *quickly* computing the dimension of a space of 
> cuspidal modular forms (of weight >= 2) in Sage, without actually computing a 
> basis of the space?
>
> The standalone method "dimension_cusp_forms" used to be really good for this, 
> and was a command I personally used very very frequently. However, ticket 
> #32647 slapped a deprecation warning on it. If this indeed gets removed, then 
> the simplest way of getting at this functionality is by typing 
> "CuspForms(...).dimension()".
>
> Unfortunately, this approach is vastly slower than the old standalone 
> function was, since it seems to be doing some kind of unnecessary 
> O(dimension) loop over the basis elements at initialisation time:
>
> sage: time dimension_cusp_forms(Gamma0(99), 100) # deprecated
>
> [ deprecation warning text ]
>
> CPU times: user 8 ms, sys: 0 ns, total: 8 ms
>
> Wall time: 8.94 ms
>
> 1184
>
>
> sage: time CuspForms(Gamma0(99), 100).dimension()
>
> CPU times: user 1.06 s, sys: 124 ms, total: 1.18 s
>
> Wall time: 1.18 s
>
> 1184
>
>
> Note the huge difference in timings: 9 milliseconds vs 1.2 seconds! So the 
> non-deprecated method is 130 times slower than the deprecated one, which 
> seems a bit problematic to me.
>
> IMHO, Sage has shot itself in the foot here, axing a fast and effective 
> command in one of its "core competences" (modular forms) because some 
> developer's notion of code aesthetics has been prioritised over ease-of-use 
> and functionality. I'd like to call for this change made in #32647 to be 
> reversed, and not reintroduced unless CuspForms.__init__() has been 
> re-engineered to make the new code path as quick as the old one was.
>
> (This problem only affects cusp form spaces, not the full modular form space; 
> "ModularForms(...).dimension()" takes about the same time as 
> "dimension_modular_forms()", as it should. If you're crafty, you can work 
> around this by importing "dimension_cusp_forms" from sage.modular.dims, or 
> using the dimension_cusp_forms() method of the Gamma0 group class; but these 
> won't be easy to find for non-expert Sage users.)
>
> Regards, David
>
> --
> You received this message because you are subscribed to the Google Groups 
> "sage-nt" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/sage-nt/CANDN%3DhzJRoKzD09Rn8pfwhMXOnU5tgTeD1j1yhCcPAKeCxYziw%40mail.gmail.com.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-nt" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-nt/CAD0p0K5KCo08r0bZz_YtWja3Sr%2BcuaRSprtBXGZF-UMahOEyEQ%40mail.gmail.com.

Reply via email to