Karim Belabas on Sat, 31 Jan 2004 18:34:36 +0100


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

Re: bernfrac() faster than bernreal()


* Bill Allombert [2004-01-30 23:38]:
> On Fri, Jan 30, 2004 at 09:16:03PM +0100, Karim Belabas wrote:
> > bernreal is an initialization function, not a 1-shot routine:
> > 
> > ? \p2000
> >   realprecision = 2003 significant digits (2000 digits displayed)
> > ? bernreal(2000);
> > time = 10,070 ms.
> > ? bernreal(2000);
> > time = 0 ms.
> > ? bernreal(1000);
> > time = 0 ms.
> 
> Then I would suggest to update both the help and the documentation to 
> reflect this:

Since I do not intend to let it stay that way, I'd rather not document it.
As you noticed, bernreal is very inefficient in its current incarnation.
Especially if you need a single value for a huge index.

Depending on the algorithm used, there may or may not be useful intermediate
results to be cached. Compare

(18:13) gp > \p10000    
(18:13) gp > zeta(10^4);
time = 60 ms.
(18:13) gp > bernreal(10^4);
  ***   user interrupt after 5mn, 34,860 ms.

We should have a berninit() function ( or a flag to bernreal to force
initialization ), and not depend on the routine actually doing further
initializations.

Cheers,

    Karim.
-- 
Karim Belabas                     Tel: (+33) (0)1 69 15 57 48
Dep. de Mathematiques, Bat. 425   Fax: (+33) (0)1 69 15 60 19
Universite Paris-Sud              http://www.math.u-psud.fr/~belabas/ 
F-91405 Orsay (France)            http://pari.math.u-bordeaux.fr/  [PARI/GP]