2016-04-26 17:20:05 +02:00
|
|
|
/*
|
2016-02-21 23:23:51 +01:00
|
|
|
Copyright (C) 2015 Jonathan Bober
|
2016-02-15 16:31:15 +01:00
|
|
|
Copyright (C) 2016 Fredrik Johansson
|
|
|
|
|
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-15 16:31:15 +01:00
|
|
|
|
|
|
|
#ifndef ACB_DIRICHLET_H
|
|
|
|
#define ACB_DIRICHLET_H
|
|
|
|
|
|
|
|
#include "acb.h"
|
2016-03-22 11:29:21 +01:00
|
|
|
#include "dlog.h"
|
2016-02-15 16:31:15 +01:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2016-02-21 23:23:51 +01:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
ulong q; /* modulus */
|
2016-03-23 12:53:08 +01:00
|
|
|
nmod_t mod; /* modulus with precomputed inverse */
|
2016-02-21 23:23:51 +01:00
|
|
|
ulong q_even; /* even part of modulus */
|
|
|
|
ulong q_odd; /* odd part of modulus */
|
2016-02-24 11:06:49 +01:00
|
|
|
ulong phi_q; /* phi(q) = group size */
|
|
|
|
ulong expo; /* group exponent = lcm(phi(q_even), phi(p[k]^e[k]) ) */
|
2016-02-26 16:49:26 +01:00
|
|
|
slong neven; /* number of even components (in 0,1,2)*/
|
2016-02-24 11:06:49 +01:00
|
|
|
slong num; /* number of prime components (even + odd) */
|
|
|
|
ulong * primes; /* primes p[k] */
|
2016-02-21 23:23:51 +01:00
|
|
|
ulong * exponents; /* exponents e[k] */
|
2016-02-26 16:49:26 +01:00
|
|
|
ulong * primepowers; /* powers p[k]^[k] */
|
|
|
|
ulong * generators; /* generator for each prime p[k] lifted mod q */
|
2016-02-24 11:06:49 +01:00
|
|
|
ulong * phi; /* phi(k) = phi(p[k]^e[k]) */
|
|
|
|
ulong * PHI; /* PHI(k) = expo / phi(k) */
|
2016-03-23 12:53:08 +01:00
|
|
|
dlog_precomp_t * dlog; /* precomputed data for discrete log mod p^e */
|
2016-02-21 23:23:51 +01:00
|
|
|
}
|
|
|
|
acb_dirichlet_group_struct;
|
|
|
|
|
|
|
|
typedef acb_dirichlet_group_struct acb_dirichlet_group_t[1];
|
|
|
|
|
2016-02-24 11:06:49 +01:00
|
|
|
/* elements of the group, keep both number and log */
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
ulong n; /* number */
|
|
|
|
ulong * log; /* s.t. prod generators[k]^log[k] = number */
|
|
|
|
}
|
2016-03-22 11:29:21 +01:00
|
|
|
acb_dirichlet_conrey_struct;
|
2016-02-24 11:06:49 +01:00
|
|
|
|
2016-03-22 11:29:21 +01:00
|
|
|
typedef acb_dirichlet_conrey_struct acb_dirichlet_conrey_t[1];
|
2016-02-24 11:06:49 +01:00
|
|
|
|
2016-02-16 02:55:12 +01:00
|
|
|
void _acb_dirichlet_euler_product_real_ui(arb_t res, ulong s,
|
|
|
|
const signed char * chi, int mod, int reciprocal, slong prec);
|
|
|
|
|
2016-02-15 16:31:15 +01:00
|
|
|
void acb_dirichlet_eta(acb_t res, const acb_t s, slong prec);
|
|
|
|
|
2016-02-21 23:23:51 +01:00
|
|
|
void acb_dirichlet_group_init(acb_dirichlet_group_t G, ulong q);
|
|
|
|
void acb_dirichlet_group_clear(acb_dirichlet_group_t G);
|
|
|
|
|
2016-03-22 11:29:21 +01:00
|
|
|
void acb_dirichlet_conrey_init(acb_dirichlet_conrey_t x, const acb_dirichlet_group_t G);
|
|
|
|
void acb_dirichlet_conrey_clear(acb_dirichlet_conrey_t x);
|
|
|
|
void acb_dirichlet_conrey_print(const acb_dirichlet_group_t G, const acb_dirichlet_conrey_t x);
|
2016-02-24 11:06:49 +01:00
|
|
|
|
2016-03-22 11:29:21 +01:00
|
|
|
void acb_dirichlet_conrey_log(acb_dirichlet_conrey_t x, const acb_dirichlet_group_t G, ulong m);
|
2016-02-26 16:49:26 +01:00
|
|
|
|
2016-03-22 11:29:21 +01:00
|
|
|
void acb_dirichlet_conrey_one(acb_dirichlet_conrey_t x, const acb_dirichlet_group_t G);
|
|
|
|
void acb_dirichlet_conrey_first_primitive(acb_dirichlet_conrey_t x, const acb_dirichlet_group_t G);
|
2016-02-24 11:06:49 +01:00
|
|
|
|
2016-03-22 11:29:21 +01:00
|
|
|
int acb_dirichlet_conrey_next(acb_dirichlet_conrey_t x, const acb_dirichlet_group_t G);
|
|
|
|
int acb_dirichlet_conrey_next_primitive(acb_dirichlet_conrey_t x, const acb_dirichlet_group_t G);
|
2016-02-29 00:13:58 +01:00
|
|
|
|
2016-03-22 11:29:21 +01:00
|
|
|
#define CHI_NULL UWORD_MAX
|
2016-02-24 11:06:49 +01:00
|
|
|
|
2016-03-22 11:29:21 +01:00
|
|
|
ulong acb_dirichlet_pairing_conrey(const acb_dirichlet_group_t G, const acb_dirichlet_conrey_t a, const acb_dirichlet_conrey_t b);
|
|
|
|
ulong acb_dirichlet_pairing(const acb_dirichlet_group_t G, ulong m, ulong n);
|
2016-02-24 11:06:49 +01:00
|
|
|
|
2016-03-22 11:29:21 +01:00
|
|
|
void acb_dirichlet_acb_pairing_conrey(acb_t res, const acb_dirichlet_group_t G, const acb_dirichlet_conrey_t a, const acb_dirichlet_conrey_t b, slong prec);
|
|
|
|
void acb_dirichlet_acb_pairing(acb_t res, const acb_dirichlet_group_t G, ulong m, ulong n, slong prec);
|
2016-02-21 23:23:51 +01:00
|
|
|
|
2016-02-24 11:06:49 +01:00
|
|
|
/* introducing character type */
|
|
|
|
|
2016-02-26 16:49:26 +01:00
|
|
|
/* character = reduced exponents, keep order and number */
|
2016-02-24 11:06:49 +01:00
|
|
|
typedef struct
|
|
|
|
{
|
2016-02-26 16:49:26 +01:00
|
|
|
ulong q; /* modulus */
|
|
|
|
ulong n; /* number */
|
|
|
|
ulong order; /* order */
|
|
|
|
ulong * expo; /* reduced exponents ( order * log[k] / gcd( ) ) */
|
2016-02-24 11:06:49 +01:00
|
|
|
}
|
|
|
|
acb_dirichlet_char_struct;
|
|
|
|
|
|
|
|
typedef acb_dirichlet_char_struct acb_dirichlet_char_t[1];
|
|
|
|
|
|
|
|
void acb_dirichlet_char_init(acb_dirichlet_char_t chi, const acb_dirichlet_group_t G);
|
|
|
|
void acb_dirichlet_char_clear(acb_dirichlet_char_t chi);
|
2016-03-22 11:29:21 +01:00
|
|
|
void acb_dirichlet_char_print(const acb_dirichlet_group_t G, const acb_dirichlet_char_t chi);
|
2016-02-24 11:06:49 +01:00
|
|
|
|
|
|
|
void acb_dirichlet_char(acb_dirichlet_char_t chi, const acb_dirichlet_group_t G, ulong n);
|
2016-03-22 11:29:21 +01:00
|
|
|
void acb_dirichlet_char_conrey(acb_dirichlet_char_t chi, const acb_dirichlet_group_t G, const acb_dirichlet_conrey_t x);
|
|
|
|
void acb_dirichlet_char_normalize(acb_dirichlet_char_t chi, const acb_dirichlet_group_t G);
|
|
|
|
void acb_dirichlet_char_denormalize(acb_dirichlet_char_t chi, const acb_dirichlet_group_t G);
|
2016-02-24 11:06:49 +01:00
|
|
|
|
2016-03-23 12:53:08 +01:00
|
|
|
ulong acb_dirichlet_char_conductor(const acb_dirichlet_group_t G, const acb_dirichlet_char_t chi);
|
|
|
|
int acb_dirichlet_char_is_odd(const acb_dirichlet_group_t G, const acb_dirichlet_char_t chi);
|
|
|
|
|
2016-03-22 11:29:21 +01:00
|
|
|
void acb_dirichlet_char_one(acb_dirichlet_char_t chi, const acb_dirichlet_group_t G);
|
|
|
|
void acb_dirichlet_char_first_primitive(acb_dirichlet_char_t chi, const acb_dirichlet_group_t G);
|
2016-02-24 11:06:49 +01:00
|
|
|
|
2016-03-22 11:29:21 +01:00
|
|
|
ulong acb_dirichlet_chi(const acb_dirichlet_group_t G, const acb_dirichlet_char_t chi, ulong n);
|
|
|
|
void acb_dirichlet_acb_chi(acb_t res, const acb_dirichlet_group_t G, const acb_dirichlet_char_t chi, ulong n, slong prec);
|
2016-02-24 11:06:49 +01:00
|
|
|
|
2016-03-22 11:29:21 +01:00
|
|
|
void acb_dirichlet_vec_set_null(ulong *v, ulong nv, const acb_dirichlet_group_t G);
|
|
|
|
void acb_dirichlet_chi_vec_loop(ulong *v, ulong nv, const acb_dirichlet_group_t G, const acb_dirichlet_char_t chi);
|
|
|
|
void acb_dirichlet_chi_vec_primeloop(ulong *v, ulong nv, const acb_dirichlet_group_t G, const acb_dirichlet_char_t chi);
|
|
|
|
void acb_dirichlet_chi_vec_sieve(ulong *v, ulong nv, const acb_dirichlet_group_t G, const acb_dirichlet_char_t chi);
|
|
|
|
void acb_dirichlet_chi_vec(ulong *v, ulong nv, const acb_dirichlet_group_t G, const acb_dirichlet_char_t chi);
|
2016-02-24 11:06:49 +01:00
|
|
|
|
|
|
|
void acb_dirichlet_char_vec(acb_t res, const acb_dirichlet_group_t G, const acb_dirichlet_char_t chi, ulong n, slong prec);
|
|
|
|
|
2016-03-23 12:53:08 +01:00
|
|
|
|
|
|
|
void acb_dirichlet_zeta(acb_t res, ulong order, slong prec);
|
|
|
|
void acb_dirichlet_arb_quadratic_powers(arb_ptr v, slong nv, const arb_t x, slong prec);
|
|
|
|
|
2016-02-15 16:31:15 +01:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|