diff --git a/acb_dirichlet.h b/acb_dirichlet.h index 18f40b9f..994b2fde 100644 --- a/acb_dirichlet.h +++ b/acb_dirichlet.h @@ -299,6 +299,8 @@ slong _acb_dirichlet_platt_local_hardy_z_zeros( slong Ns_max, const arb_t H, slong sigma_interp, slong prec); slong acb_dirichlet_platt_local_hardy_z_zeros( arb_ptr res, const fmpz_t n, slong len, slong prec); +slong acb_dirichlet_platt_hardy_z_zeros( + arb_ptr res, const fmpz_t n, slong len, slong prec); /* Discrete Fourier Transform */ diff --git a/acb_dirichlet/platt_hardy_z_zeros.c b/acb_dirichlet/platt_hardy_z_zeros.c new file mode 100644 index 00000000..781450a2 --- /dev/null +++ b/acb_dirichlet/platt_hardy_z_zeros.c @@ -0,0 +1,32 @@ +/* + Copyright (C) 2020 D.H.J. Polymath + + This file is part of Arb. + + Arb is free software: you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License (LGPL) as published + by the Free Software Foundation; either version 2.1 of the License, or + (at your option) any later version. See . +*/ + +#include "acb_dirichlet.h" + +slong +acb_dirichlet_platt_hardy_z_zeros( + arb_ptr res, const fmpz_t n, slong len, slong prec) +{ + slong r, s=0; + fmpz_t k; + fmpz_init(k); + fmpz_set(k, n); + while (len - s) + { + r = acb_dirichlet_platt_local_hardy_z_zeros(res + s, k, len - s, prec); + flint_printf("r = %ld\n", r); + if (!r) + break; + s += r; + fmpz_add_si(k, k, r); + } + return s; +} diff --git a/acb_dirichlet/test/t-platt_hardy_z_zeros.c b/acb_dirichlet/test/t-platt_hardy_z_zeros.c new file mode 100644 index 00000000..9c296b5f --- /dev/null +++ b/acb_dirichlet/test/t-platt_hardy_z_zeros.c @@ -0,0 +1,86 @@ +/* + Copyright (C) 2020 D.H.J. Polymath + + This file is part of Arb. + + Arb is free software: you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License (LGPL) as published + by the Free Software Foundation; either version 2.1 of the License, or + (at your option) any later version. See . +*/ + +#include "acb_dirichlet.h" + +int main() +{ + /* Check a specific combination of parameter values that is relatively fast + * to evaluate and that has relatively tight bounds. */ + slong A, B, J, K, sigma_grid, Ns_max, sigma_interp; + arb_t h, H; + fmpz_t T, n; + arb_ptr pa, pb; + slong count, i; + slong maxcount = 50*5; + slong prec = 128; + + flint_printf("platt_hardy_z_zeros...."); + fflush(stdout); + + arb_init(h); + arb_init(H); + fmpz_init(T); + fmpz_init(n); + pa = _arb_vec_init(maxcount); + pb = _arb_vec_init(maxcount); + + fmpz_set_si(n, 10142); + + /* parameters related to the location/resolution/width of the grid */ + fmpz_set_si(T, 10000); + A = 8; + B = 128; + + /* tuning parameters for the evaluation of grid points */ + J = 1000; + K = 30; + sigma_grid = 63; + arb_set_d(h, 4.5); + + /* tuning parameters for interpolation on the grid */ + Ns_max = 200; + sigma_interp = 21; + arb_one(H); + + count = acb_dirichlet_platt_hardy_z_zeros(pa, n, maxcount, prec); + acb_dirichlet_hardy_z_zeros(pb, n, count, prec); + if (count != maxcount) + { + flint_printf("FAIL: not enough zeros were isolated\n\n"); + flint_printf("count = %wd maxcount = %wd\n\n", count, maxcount); + flint_abort(); + } + + for (i = 0; i < count; i++) + { + if (!arb_overlaps(pa+i, pb+i)) + { + flint_printf("FAIL: overlap\n\n"); + flint_printf("observed[%wd] = ", i); + arb_printd(pa+i, 20); flint_printf("\n\n"); + flint_printf("expected[%wd] = ", i); + arb_printd(pb+i, 20); flint_printf("\n\n"); + flint_abort(); + } + } + + arb_clear(h); + arb_clear(H); + fmpz_clear(T); + fmpz_clear(n); + _arb_vec_clear(pa, maxcount); + _arb_vec_clear(pb, maxcount); + + flint_cleanup(); + flint_printf("PASS\n"); + return EXIT_SUCCESS; +} diff --git a/acb_dirichlet/test/t-platt_local_hardy_z_zeros.c b/acb_dirichlet/test/t-platt_local_hardy_z_zeros.c index 79afbeed..26c34eb0 100644 --- a/acb_dirichlet/test/t-platt_local_hardy_z_zeros.c +++ b/acb_dirichlet/test/t-platt_local_hardy_z_zeros.c @@ -1,5 +1,5 @@ /* - Copyright (C) 2019 D.H.J. Polymath + Copyright (C) 2020 D.H.J. Polymath This file is part of Arb. diff --git a/doc/source/acb_dirichlet.rst b/doc/source/acb_dirichlet.rst index f7dc499f..6728ff1f 100644 --- a/doc/source/acb_dirichlet.rst +++ b/doc/source/acb_dirichlet.rst @@ -785,12 +785,15 @@ and formulas described by David J. Platt in [Pla2017]_. .. function:: slong _acb_dirichlet_platt_local_hardy_z_zeros(arb_ptr res, const fmpz_t n, slong len, const fmpz_t T, slong A, slong B, const arb_t h, slong J, slong K, slong sigma_grid, slong Ns_max, const arb_t H, slong sigma_interp, slong prec) .. function:: slong acb_dirichlet_platt_local_hardy_z_zeros(arb_ptr res, const fmpz_t n, slong len, slong prec) +.. function:: slong acb_dirichlet_platt_hardy_z_zeros(arb_ptr res, const fmpz_t n, slong len, slong prec) - Sets the entries of *res* to at most *len* consecutive zeros of the - Hardy Z-function, beginning with the *n*-th zero. Requires positive *n*. - The number of isolated zeros is returned. Internally this function uses - a single call to Platt's grid evaluation of the scaled Lambda function. - The final several parameters of the underscored variant have the same + Sets at most the first *len* entries of *res* to consecutive + zeros of the Hardy Z-function starting with the *n*-th zero. + The number of obtained consecutive zeros is returned. The first two + function variants each make a single call to Platt's grid evaluation + of the scaled Lambda function, whereas the third variant performs as many + evluations as necessary to obtain *len* consecutive zeros. + The final several parameters of the underscored local variant have the same meanings as in the functions :func:`acb_dirichlet_platt_multieval` and :func:`acb_dirichlet_platt_ws_interpolation`. The non-underscored - variant currently requires `10^4 \leq n \leq 3 \times 10^{17}`. + variants currently expect `10^4 \leq n \leq 10^{23}`.