arb/acb_dirichlet/l.c
Pascal 46fa645910 [dirichlet] add conrey type to handle logs + char type
- try to handle even and odd components the same way in the dirichlet group

- switch from phi_q_odd to smaller expo = exponent of the group

  all character orders divide this number, and a character of that order exists

- use conrey logarithm to reuse log and to loop efficiently over the group

  (see the diff on l.c, only 1 log in computed instead of 2 * q)

- NOT TESTED, for the moment it just compiles, I know some errors
  (e.g. the FIXME in group_init.c : the generators have to be lifted mod q)
  this commit is just a proof of concept.
2016-10-08 22:45:58 +02:00

58 lines
1.3 KiB
C

/*
Copyright (C) 2016 Fredrik Johansson
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/>.
*/
#include "acb_dirichlet.h"
void
acb_dirichlet_l(acb_t res, const acb_t s,
const acb_dirichlet_group_t G, ulong m, slong prec)
{
acb_t chi, t, u, a;
acb_conrey_t cm, cn;
acb_init(chi);
acb_conrey_init(cm, G);
acb_conrey_init(cn, G);
acb_init(t);
acb_init(u);
acb_init(a);
acb_conrey_log(cm, G, m);
acb_conrey_one(cn, G);
acb_zero(t);
while (1) {
/* todo: use n_dirichlet_chi and precomputed roots instead */
acb_dirichlet_chi_conrey(chi, G, cm, cn, prec);
acb_set_ui(a, cn->n);
acb_div_ui(a, a, G->q, prec);
acb_hurwitz_zeta(u, s, a, prec);
acb_addmul(t, chi, u, prec);
if (acb_conrey_next(cn, G) == G->num)
break;
}
acb_set_ui(u, G->q);
acb_neg(a, s);
acb_pow(u, u, a, prec);
acb_mul(res, t, u, prec);
acb_conrey_clear(cm);
acb_conrey_clear(cn);
acb_clear(chi);
acb_clear(t);
acb_clear(u);
acb_clear(a);
}