On Friday, 7 June 2019, 7:17:26 am AEST, Karim Belabas <Karim.Belabas@math.u-bordeaux.fr> wrote:
* Andrew Walker [2019-06-06 09:03]:
> Using one of the latest 64 bit binaries for Windows:
> E:\PrimeZeta>gp64-2-12-0.exe
> GP/PARI CALCULATOR Version 2.12.0 (alpha)
> amd64 running mingw (x86-64/GMP-6.1.2 kernel) 64-bit version
> compiled: Jun 3 2019, gcc version 6.3.0 20170516 (GCC)
> threading engine: single
> (readline not compiled in, extended help enabled)
>
> Copyright (C) 2000-2019 The PARI Group
>
> I've found that the memory usage for zeta() is a lot bigger than the previous version I've been using,
> gp64-2-11-1.exe (also 64 bit) from 21 Nov last year.
> Using the default precision, try zeta(0.5+100000.0*I) then at increasing values of the imaginarypart, looking at memory usage in the task manager.
>
> For the latest version zeta(0.5+300000*.0*I) the usage shown gets to over
> 294 Mb whereas forthe earlier one it is just over 20 Mb Is this due to the
> recent changes related to Bernoulli numbers?
Yes. Computing zeta() at this height with Euler-Maclaurin formula requires
computing *a lot* of Bernoulli numbers, B_2, ... B_{2N}. In 2.11 those were
computed (and stored) as floating point numbers; in 2.12, there are computed
(and stored) as exact rational numbers, for about the same cost. Of course,
since the size of Bernoulli numbers B_{2n} increase linearly with n, the new
cache size is quadratic in N, whereas it was linear in 2.11.
On the other hand, it now contains much more information, of course.
2.11:
=====
(22:58) gp > \g3
debug = 3
(22:58) gp > zeta(1/2+100000*I);
lim, nn: [7155, 16078]
Time sum from 1 to N-1: 28
caching Bernoulli numbers 2*14 to 2*7155
Time Bernoulli: 7696
Time Bernoulli sum: 7704
time = 7,732 ms.
(22:58) gp > zeta(1/2+100000*I); \\ second time is fast !
lim, nn: [7155, 16078]
Time sum from 1 to N-1: 32
Time Bernoulli sum: 8 \\ no cache computation here
time = 40 ms.
2.12:
=====
(22:59) gp > \g3
debug = 3
(22:59) gp > zeta(1/2+100000*I);
lim, nn: [7155, 16078]
Time sum from 1 to N-1: 32
caching Bernoulli numbers 2*14 to 2*7155
Time Bernoulli: 7676
Time Bernoulli sum: 7684
time = 7,716 ms.
(22:59) gp > zeta(1/2+100000*I);
lim, nn: [7155, 16078]
Time sum from 1 to N-1: 28
Time Bernoulli sum: 12
time = 40 ms.
Cheers,
K.B.
P.S. See attached a preliminary implementation of the Zetafast algorithm,
written by Henri Cohen and myself, which doesn't need any Bernoulli number
and scales much better than Euler-Maclaurin as Im(s) increases.
Zetafast(D, s) computes L((D/.), s) for any (smallish) fundamental
discriminant D and any complex s in the critical strip in time
O_D(sqrt(|Im(s)|)) for fixed accuracy, so comparable to Rimann-Siegel [but
much simpler]. Whereas zeta(s) sums O(|Im(s)|) terms...
The implementation strives to be efficient outside of the critical strip so
it is quite a bit more complicated than necessary if 0 <= Re(s) <= 1.
(23:01) gp > \r Zetafast
(23:01) gp > Zetafast(1, 1/2+100000*I) \\ = zeta(1/2 + 100000*I)
time = 44 ms.
%1 = 1.0730320148577531321140762694920985307 + 5.7808485443635039842610405578322343743*I
(23:01) gp > Zetafast(1, 1/2+10000000*I)
time = 424 ms.
%2 = 11.458040610577092545002268589041325797 - 8.6434372268360217238182148996339272448*I
(23:01) gp > Zetafast(1, 1/2+1000000000*I)
time = 4,224 ms.
%3 = -2.7617480298380609423768128776672451381 - 1.6775122409894598392132050998908713339*I
(23:02) gp > Zetafast(1, 1/2+100000000000*I)
time = 43,160 ms.
%4 = 0.64366392558011857271943565209178429193 + 0.11686159146168534184488292306042677997*I
--
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]
`