arb/examples/lcentral.c

88 lines
1.8 KiB
C
Raw Normal View History

2016-09-06 17:00:42 +02:00
/* This file is public domain. Author: Pascal Molin. */
2016-09-02 16:09:18 +02:00
2016-09-06 14:19:50 +02:00
#include <string.h>
2016-09-07 14:09:05 +02:00
#include <math.h>
2016-09-02 16:09:18 +02:00
#include "acb_dirichlet.h"
2016-09-07 14:09:05 +02:00
static int usage(char *argv[])
{
printf("usage: %s [--quiet] [--prec <bits>] qmin qmax\n", argv[0]);
return 1;
}
2016-09-06 14:19:50 +02:00
int main(int argc, char *argv[])
2016-09-02 16:09:18 +02:00
{
2016-09-06 14:19:50 +02:00
int i, out = 1;
2016-09-02 16:09:18 +02:00
slong prec = 100, digits = 30;
2016-09-06 14:19:50 +02:00
ulong qmin, qmax, q;
2016-09-02 16:09:18 +02:00
acb_t s;
2016-09-06 14:19:50 +02:00
if (argc < 3)
2016-09-07 14:09:05 +02:00
return usage(argv);
2016-09-06 14:19:50 +02:00
for (i = 1; i < argc - 2; i++)
{
if (!strcmp(argv[i],"--quiet"))
out = 0;
2016-09-07 14:09:05 +02:00
else if (!strcmp(argv[i],"--prec"))
2016-09-06 14:19:50 +02:00
{
2016-09-07 14:09:05 +02:00
i++;
prec = atol(argv[i]);
digits = floor(prec * 0.3);
2016-09-06 14:19:50 +02:00
}
}
2016-09-07 14:09:05 +02:00
if (argc < i + 2)
return usage(argv);
qmin = atol(argv[i]);
qmax = atol(argv[i+1]);
2016-09-06 14:19:50 +02:00
2016-09-02 16:09:18 +02:00
fflush(stdout);
acb_init(s);
acb_one(s);
acb_div_si(s, s, 2, prec);
2016-09-06 14:19:50 +02:00
for (q = qmin; q <= qmax; q++)
2016-09-02 16:09:18 +02:00
{
ulong k;
acb_dirichlet_group_t G;
acb_dirichlet_conrey_t x;
acb_ptr z;
if (q % 4 == 2)
continue;
acb_dirichlet_group_init(G, q);
acb_dirichlet_conrey_init(x, G);
z = _acb_vec_init(G->phi_q);
acb_dirichlet_l_vec_hurwitz(z, s, G, prec);
2016-09-06 14:19:50 +02:00
if (out)
{
k = 0;
acb_dirichlet_conrey_one(x, G);
while (acb_dirichlet_conrey_next(x, G) >= 0)
{
k++;
if (acb_dirichlet_conrey_conductor(G,x) < q)
continue;
flint_printf("%wu,%wu: ", q, x->n);
acb_printd(z + k, digits);
flint_printf("\n");
}
2016-09-02 16:09:18 +02:00
}
_acb_vec_clear(z, G->phi_q);
acb_dirichlet_conrey_clear(x);
acb_dirichlet_group_clear(G);
}
acb_clear(s);
flint_cleanup();
return EXIT_SUCCESS;
}