Karim Belabas on Sat, 15 Jul 2017 09:30:45 +0200


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: Dimension of a space of modular form


* Emmanuel ROYER [2017-07-14 12:04]:
> Hello!
> 
> Why does mfdim need to increase the memory to compute the dimension of
> the space of modular forms?

>  mfdim([1,12])
>   *** mfdim: Warning: increasing stack size to 16000000.

The modular form package makes heavy use of various caches. (It was a
design choice to make this transparent to the user.) The cache policy 
for a given table is to initialize a "small" cache as soon as possible,
then increase it as needed (up to some maximum value, currently beyond
user control but this will change).

Starting from an empty session :

? getcache()   \\ caches are empty
%1 = 
[  "Factors" 0 0 0 0]

[ "Divisors" 0 0 0 0]

[        "H" 0 0 0 0]

["CorediscF" 0 0 0 0]

[ "Dihedral" 0 0 0 0]

? mfdim([1,12])  \\ that this is *very* slow: we are building a "useless" cache
time = 32 ms.
%2 = 2
? getcache()   \\ no longer
%3 = 
[  "Factors" 50000 0 0 4479272]

[ "Divisors" 50000 0 0 5189808]

[        "H"     0 0 0       0]

["CorediscF"     0 0 0       0]

[ "Dihedral"     0 0 0       0]

? mfdim([1,12])  \\ now instantaneous
%4 = 2

? mfinit([96,10],0);   \\ now computing a space of modular forms, more caches...
time = 100 ms.
? getcache()
%6 = 
[  "Factors"  50000 0      0 4479272]

[ "Divisors"  50000 1 100000 5189808]

[        "H"  50000 0      0  400008]

["CorediscF" 100000 0      0  800008]

[ "Dihedral"      0 0      0       0]

? mfinit([96,10]);  \\ now faster...
time = 48 ms.

? for(N=1,100,mfinit([N,1,0],0)) \\ now involving weight 1 forms ...
time = 848 ms.
? getcache()
%7 = 
[  "Factors"  50000 0      0 4479272]

[ "Divisors"  50000 1 100000 5189808]

[        "H"  50000 0      0  400008]

["CorediscF" 100000 0      0  800008]

[ "Dihedral"   1000 0      0 1840768]    \\ new cache

? for(N=1,100,mfinit([N,1,0],0)) \\ again faster
time = 138 ms.

Etc.

> Does it also compute the space and not only its dimension?

It doesn't in weight k > 1 (but it usually does in weight k = 1...)

There is no memoization: we do not recall the result of the last
GP function calls. What we do is save a number of costly common ingredients
there were needed to compute it so that we need not recompute them when 
computations in the same general range (e.g. product N*k of the same
magnitude) are requested.


Cheers,

    K.B.
--
Karim Belabas, IMB (UMR 5251)  Tel: (+33) (0)5 40 00 26 17
Universite de Bordeaux         Fax: (+33) (0)5 40 00 21 23
351, cours de la Liberation    http://www.math.u-bordeaux.fr/~kbelabas/
F-33405 Talence (France)       http://pari.math.u-bordeaux.fr/  [PARI/GP]
`