2016-09-06 15:32:23 +02:00
|
|
|
/*
|
2016-03-22 11:29:21 +01:00
|
|
|
Copyright (C) 2016 Pascal Molin
|
2016-02-24 11:06:49 +01:00
|
|
|
|
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-02-24 11:06:49 +01:00
|
|
|
|
|
|
|
#include "acb_dirichlet.h"
|
|
|
|
|
2016-04-05 12:18:39 +02:00
|
|
|
static void
|
2016-04-05 11:55:04 +02:00
|
|
|
chi_vec_evenpart(ulong *v, const acb_dirichlet_group_t G, const acb_dirichlet_char_t chi, slong nv)
|
|
|
|
{
|
|
|
|
|
|
|
|
ulong c3, c4, x;
|
|
|
|
|
|
|
|
if (G->neven >= 1 && (c3 = chi->expo[0]))
|
|
|
|
{
|
|
|
|
for (x = 3; x < nv; x += 4)
|
|
|
|
v[x] = c3;
|
|
|
|
}
|
|
|
|
if (G->neven == 2 && (c4 = chi->expo[1]))
|
|
|
|
{
|
2016-07-14 18:55:44 +02:00
|
|
|
ulong g, vx, xp;
|
|
|
|
nmod_t pe;
|
2016-04-05 11:55:04 +02:00
|
|
|
vx = c4;
|
2016-07-14 18:55:44 +02:00
|
|
|
pe = G->P[1].pe;
|
2016-07-06 18:39:29 +02:00
|
|
|
g = G->P[1].g;
|
2016-04-05 11:55:04 +02:00
|
|
|
|
|
|
|
for (x = g; x > 1;)
|
|
|
|
{
|
|
|
|
|
2016-07-14 18:55:44 +02:00
|
|
|
for (xp = x; xp < nv; xp += pe.n)
|
|
|
|
v[xp] = nmod_add(v[xp], vx, chi->order);
|
2016-04-05 11:55:04 +02:00
|
|
|
|
2016-07-14 18:55:44 +02:00
|
|
|
for (xp = pe.n - x; xp < nv; xp += pe.n)
|
|
|
|
v[xp] = nmod_add(v[xp], vx, chi->order);
|
2016-04-05 11:55:04 +02:00
|
|
|
|
2016-07-14 18:55:44 +02:00
|
|
|
x = nmod_mul(x, g, pe);
|
|
|
|
vx = nmod_add(vx, c4, chi->order);
|
2016-04-05 11:55:04 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-03-22 11:29:21 +01:00
|
|
|
/* loop over primary components */
|
2016-02-24 11:06:49 +01:00
|
|
|
void
|
2016-04-05 12:18:39 +02:00
|
|
|
acb_dirichlet_ui_chi_vec_primeloop(ulong *v, const acb_dirichlet_group_t G, const acb_dirichlet_char_t chi, slong nv)
|
2016-02-24 11:06:49 +01:00
|
|
|
{
|
2016-03-29 14:37:21 +01:00
|
|
|
slong k, l;
|
2016-03-29 14:04:08 +01:00
|
|
|
|
|
|
|
for (k = 1; k < nv; k++)
|
|
|
|
v[k] = 0;
|
|
|
|
|
2016-04-05 11:55:04 +02:00
|
|
|
if (G->neven)
|
|
|
|
chi_vec_evenpart(v, G, chi, nv);
|
|
|
|
|
|
|
|
for (l = G->neven; l < G->num; l++)
|
2016-03-22 11:29:21 +01:00
|
|
|
{
|
2016-07-14 15:51:25 +02:00
|
|
|
acb_dirichlet_prime_group_struct P = G->P[l];
|
2016-04-05 11:55:04 +02:00
|
|
|
|
2016-07-14 15:51:25 +02:00
|
|
|
/* FIXME: there may be some precomputed dlog in P if needed */
|
2016-07-14 18:55:44 +02:00
|
|
|
dlog_vec_add(v, nv, P.g, chi->expo[l], P.pe, P.phi, chi->order);
|
2016-03-29 14:04:08 +01:00
|
|
|
|
2016-03-22 11:29:21 +01:00
|
|
|
}
|
2016-04-05 12:18:39 +02:00
|
|
|
acb_dirichlet_ui_vec_set_null(v, G, nv);
|
2016-02-24 11:06:49 +01:00
|
|
|
}
|