2016-04-26 17:20:05 +02:00
|
|
|
/*
|
2016-02-23 01:18:07 +01:00
|
|
|
Copyright (C) 2016 Fredrik Johansson
|
2016-09-06 15:32:23 +02:00
|
|
|
Copyright (C) 2016 Pascal Molin
|
2016-02-23 01:18:07 +01:00
|
|
|
|
2016-04-26 17:20:05 +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-02-23 01:18:07 +01:00
|
|
|
|
|
|
|
#include "acb_dirichlet.h"
|
2016-09-09 22:02:45 +02:00
|
|
|
#include "acb_poly.h"
|
2016-02-23 01:18:07 +01:00
|
|
|
|
2016-09-09 22:02:45 +02:00
|
|
|
/* todo: should document or fix that it doesn't allow aliasing */
|
2016-02-23 01:18:07 +01:00
|
|
|
void
|
2016-04-12 15:07:04 +02:00
|
|
|
acb_dirichlet_l_hurwitz(acb_t res, const acb_t s,
|
|
|
|
const acb_dirichlet_group_t G, const acb_dirichlet_char_t chi, slong prec)
|
2016-02-23 01:18:07 +01:00
|
|
|
{
|
2016-04-12 15:07:04 +02:00
|
|
|
ulong chin;
|
2016-09-02 16:09:18 +02:00
|
|
|
acb_t t, u, a;
|
|
|
|
acb_ptr z;
|
2016-04-12 15:07:04 +02:00
|
|
|
acb_dirichlet_conrey_t cn;
|
2016-09-09 22:02:45 +02:00
|
|
|
int deflate;
|
|
|
|
|
|
|
|
/* remove pole in Hurwitz zeta at s = 1 */
|
|
|
|
deflate = 0;
|
|
|
|
if (acb_is_one(s))
|
|
|
|
{
|
|
|
|
/* character is principal */
|
|
|
|
if (chi->x->n == 1)
|
|
|
|
{
|
|
|
|
acb_indeterminate(res);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
deflate = 1;
|
|
|
|
}
|
2016-02-23 01:18:07 +01:00
|
|
|
|
2016-03-22 11:29:21 +01:00
|
|
|
acb_dirichlet_conrey_init(cn, G);
|
2016-02-23 01:18:07 +01:00
|
|
|
acb_init(t);
|
|
|
|
acb_init(u);
|
|
|
|
acb_init(a);
|
|
|
|
|
2016-03-22 11:29:21 +01:00
|
|
|
acb_dirichlet_conrey_one(cn, G);
|
2016-02-23 01:18:07 +01:00
|
|
|
acb_zero(t);
|
|
|
|
|
2016-09-02 16:09:18 +02:00
|
|
|
prec += n_clog(G->phi_q, 2);
|
|
|
|
|
|
|
|
z = _acb_vec_init(chi->order.n);
|
|
|
|
acb_dirichlet_vec_nth_roots(z, chi->order.n, prec);
|
2016-04-12 15:07:04 +02:00
|
|
|
|
2016-08-04 15:35:33 +02:00
|
|
|
do {
|
2016-04-12 15:07:04 +02:00
|
|
|
chin = acb_dirichlet_ui_chi_conrey(G, chi, cn);
|
2016-02-24 11:06:49 +01:00
|
|
|
|
|
|
|
acb_set_ui(a, cn->n);
|
|
|
|
acb_div_ui(a, a, G->q, prec);
|
2016-09-09 22:02:45 +02:00
|
|
|
|
|
|
|
if (deflate == 0)
|
|
|
|
acb_hurwitz_zeta(u, s, a, prec);
|
|
|
|
else
|
|
|
|
_acb_poly_zeta_cpx_series(u, s, a, 1, 1, prec);
|
2016-04-12 15:07:04 +02:00
|
|
|
|
2016-09-02 16:09:18 +02:00
|
|
|
acb_addmul(t, z + chin, u, prec);
|
2016-02-24 11:06:49 +01:00
|
|
|
|
2016-08-04 15:35:33 +02:00
|
|
|
} while (acb_dirichlet_conrey_next(cn, G) >= 0);
|
2016-02-23 01:18:07 +01:00
|
|
|
|
|
|
|
acb_set_ui(u, G->q);
|
|
|
|
acb_neg(a, s);
|
|
|
|
acb_pow(u, u, a, prec);
|
|
|
|
acb_mul(res, t, u, prec);
|
|
|
|
|
2016-03-22 11:29:21 +01:00
|
|
|
acb_dirichlet_conrey_clear(cn);
|
2016-02-24 11:06:49 +01:00
|
|
|
|
2016-09-02 16:09:18 +02:00
|
|
|
_acb_vec_clear(z, chi->order.n);
|
2016-02-23 01:18:07 +01:00
|
|
|
acb_clear(t);
|
|
|
|
acb_clear(u);
|
|
|
|
acb_clear(a);
|
|
|
|
}
|
2016-09-09 22:02:45 +02:00
|
|
|
|