2016-09-06 15:32:23 +02:00
|
|
|
/*
|
2016-04-12 15:07:04 +02:00
|
|
|
Copyright (C) 2016 Pascal Molin
|
|
|
|
|
2016-09-06 15:32:23 +02:00
|
|
|
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 <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
2016-04-12 15:07:04 +02:00
|
|
|
|
|
|
|
#include "acb_dirichlet.h"
|
|
|
|
|
|
|
|
void
|
|
|
|
acb_dirichlet_gauss_sum_theta(acb_t res, const acb_dirichlet_group_t G, const acb_dirichlet_char_t chi, slong prec)
|
|
|
|
{
|
|
|
|
arb_t x;
|
|
|
|
acb_t eps;
|
|
|
|
|
|
|
|
arb_init(x);
|
|
|
|
|
2016-09-01 12:12:33 +02:00
|
|
|
if (chi->conductor < G->q || (G->q == 300 && (chi->x->n == 71 || chi->x->n == 131))
|
2016-08-04 18:56:27 +02:00
|
|
|
|| (G->q == 600 && (chi->x->n == 11 || chi->x->n == 491)))
|
2016-04-12 15:07:04 +02:00
|
|
|
{
|
|
|
|
/* or could use l'Hopital rule */
|
|
|
|
acb_dirichlet_gauss_sum_naive(res, G, chi, prec);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
arb_one(x);
|
2016-09-08 18:01:09 +02:00
|
|
|
acb_dirichlet_theta_arb(res, G, chi, x, prec);
|
2016-04-12 15:07:04 +02:00
|
|
|
acb_init(eps);
|
|
|
|
acb_conj(eps, res);
|
|
|
|
acb_div(eps, res, eps, prec);
|
|
|
|
|
|
|
|
if (chi->parity)
|
|
|
|
{
|
|
|
|
arb_zero(acb_realref(res));
|
|
|
|
arb_sqrt_ui(acb_imagref(res), G->q, prec);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
arb_zero(acb_imagref(res));
|
|
|
|
arb_sqrt_ui(acb_realref(res), G->q, prec);
|
|
|
|
}
|
|
|
|
|
|
|
|
acb_mul(res, res, eps, prec);
|
|
|
|
|
|
|
|
arb_clear(x);
|
|
|
|
acb_clear(eps);
|
|
|
|
}
|