use acb_dirichlet_roots_t in l_hurwitz and l_jet; rename dirichlet_number_primitive -> dirichlet_group_num_primitive

This commit is contained in:
Fredrik Johansson 2016-12-01 22:33:15 +01:00
parent 8f6fa5598c
commit f44c6843fd
7 changed files with 30 additions and 21 deletions

View file

@ -19,9 +19,9 @@ acb_dirichlet_l_hurwitz(acb_t res, const acb_t s,
const dirichlet_group_t G, const dirichlet_char_t chi, slong prec)
{
ulong order, chin, mult;
acb_t t, u, a;
acb_ptr z;
acb_t t, u, a, w;
dirichlet_char_t cn;
acb_dirichlet_roots_t roots;
int deflate;
/* remove pole in Hurwitz zeta at s = 1 */
@ -40,6 +40,7 @@ acb_dirichlet_l_hurwitz(acb_t res, const acb_t s,
acb_init(t);
acb_init(u);
acb_init(a);
acb_init(w);
dirichlet_char_one(cn, G);
acb_zero(t);
@ -48,9 +49,7 @@ acb_dirichlet_l_hurwitz(acb_t res, const acb_t s,
order = dirichlet_order_char(G, chi);
mult = G->expo / order;
z = _acb_vec_init(order);
/* todo: use roots object */
_acb_vec_unit_roots(z, order, prec);
acb_dirichlet_roots_init(roots, order, dirichlet_group_size(G), prec);
do {
chin = dirichlet_pairing_char(G, chi, cn) / mult;
@ -70,7 +69,8 @@ acb_dirichlet_l_hurwitz(acb_t res, const acb_t s,
acb_dirichlet_hurwitz_precomp_eval(u, precomp, cn->n, G->q, prec);
}
acb_addmul(t, z + chin, u, prec);
acb_dirichlet_root(w, roots, chin, prec);
acb_addmul(t, u, w, prec);
} while (dirichlet_char_next(cn, G) >= 0);
@ -81,9 +81,10 @@ acb_dirichlet_l_hurwitz(acb_t res, const acb_t s,
dirichlet_char_clear(cn);
_acb_vec_clear(z, order);
acb_dirichlet_roots_clear(roots);
acb_clear(t);
acb_clear(u);
acb_clear(a);
acb_clear(w);
}

View file

@ -19,9 +19,10 @@ acb_dirichlet_l_jet(acb_ptr res, const acb_t s,
int deflate, slong len, slong prec)
{
ulong order, chin, mult, phi;
acb_t a;
acb_ptr t, u, z;
acb_t a, w;
acb_ptr t, u;
dirichlet_char_t cn;
acb_dirichlet_roots_t roots;
int deflate_hurwitz;
if (len <= 0)
@ -52,6 +53,7 @@ acb_dirichlet_l_jet(acb_ptr res, const acb_t s,
t = _acb_vec_init(len);
u = _acb_vec_init(len + 2);
acb_init(a);
acb_init(w);
dirichlet_char_one(cn, G);
@ -59,8 +61,7 @@ acb_dirichlet_l_jet(acb_ptr res, const acb_t s,
order = dirichlet_order_char(G, chi);
mult = G->expo / order;
z = _acb_vec_init(order);
_acb_vec_unit_roots(z, order, prec);
acb_dirichlet_roots_init(roots, order, dirichlet_group_size(G), prec);
phi = 0;
do
@ -69,7 +70,8 @@ acb_dirichlet_l_jet(acb_ptr res, const acb_t s,
acb_set_ui(a, cn->n);
acb_div_ui(a, a, G->q, prec);
_acb_poly_zeta_cpx_series(u, s, a, deflate_hurwitz, len, prec);
_acb_vec_scalar_addmul(t, u, len, z + chin, prec);
acb_dirichlet_root(w, roots, chin, prec);
_acb_vec_scalar_addmul(t, u, len, w, prec);
phi++;
}
while (dirichlet_char_next(cn, G) >= 0);
@ -112,9 +114,10 @@ acb_dirichlet_l_jet(acb_ptr res, const acb_t s,
dirichlet_char_clear(cn);
_acb_vec_clear(z, order);
acb_dirichlet_roots_clear(roots);
_acb_vec_clear(t, len);
_acb_vec_clear(u, len + 2);
acb_clear(a);
acb_clear(w);
}

View file

@ -71,7 +71,7 @@ int main()
"-1.43652482351673593824956935036654893593947145947637807"
};
flint_printf("l....");
flint_printf("l_hurwitz....");
fflush(stdout);
x = _acb_vec_init(nx);

View file

@ -62,6 +62,8 @@ dirichlet_group_size(const dirichlet_group_t G)
return G->phi_q;
}
ulong dirichlet_group_num_primitive(const dirichlet_group_t G);
void dirichlet_group_init(dirichlet_group_t G, ulong q);
void dirichlet_subgroup_init(dirichlet_group_t H, const dirichlet_group_t G, ulong h);
void dirichlet_group_clear(dirichlet_group_t G);
@ -70,7 +72,6 @@ void dirichlet_group_dlog_clear(dirichlet_group_t G);
/* properties of elements without log */
ulong dirichlet_number_primitive(const dirichlet_group_t G);
ulong dirichlet_conductor_ui(const dirichlet_group_t G, ulong a);
int dirichlet_parity_ui(const dirichlet_group_t G, ulong a);
ulong dirichlet_order_ui(const dirichlet_group_t G, ulong a);

View file

@ -12,7 +12,7 @@
#include "dirichlet.h"
ulong
dirichlet_number_primitive(const dirichlet_group_t G)
dirichlet_group_num_primitive(const dirichlet_group_t G)
{
if (G->q % 4 == 2)
return 0;

View file

@ -74,7 +74,7 @@ int main()
dirichlet_char_first_primitive(x, G);
for (n = 1; dirichlet_char_next_primitive(x, G) >= 0; n++);
ref = dirichlet_number_primitive(G);
ref = dirichlet_group_num_primitive(G);
if (n != ref)
{
flint_printf("FAIL: number of primitive elements\n\n");

View file

@ -82,6 +82,14 @@ Multiplicative group modulo *q*
Clears *G*. Remark this function does *not* clear the discrete logarithm
tables stored in *G* (which may be shared with another group).
.. function:: ulong dirichlet_group_size(const dirichlet_group_t G)
Returns the number of elements in *G*, i.e. `\varphi(q)`.
.. function:: ulong dirichlet_group_num_primitive(const dirichlet_group_t G)
Returns the number of primitive elements in *G*.
.. function:: void dirichlet_group_dlog_precompute(dirichlet_group_t G, ulong num)
Precompute decomposition and tables for discrete log computations in *G*,
@ -194,10 +202,6 @@ Character properties
As a consequence of the Conrey numbering, all these numbers are available at the
level of *number* and *char* object. Both case require no discrete log computation.
.. function:: ulong dirichlet_number_primitive(const dirichlet_group_t G)
Returns the number of primitive elements in *G*.
.. function:: int dirichlet_char_is_principal(const dirichlet_group_t G, const dirichlet_char_t chi)
Returns 1 if *chi* is the principal character mod *q*.