mirror of
https://github.com/vale981/arb
synced 2025-03-04 17:01:40 -05:00
separate dirichlet/acb_dirichlet
This commit is contained in:
parent
201c241172
commit
6debd55328
80 changed files with 749 additions and 714 deletions
|
@ -13,7 +13,7 @@ QUIET_AR = @echo ' ' AR ' ' $@;
|
|||
AT=@
|
||||
|
||||
BUILD_DIRS = fmpr arf mag arb arb_mat arb_poly arb_calc acb acb_mat acb_poly \
|
||||
acb_calc acb_hypgeom acb_modular acb_dft acb_dirichlet arb_hypgeom bernoulli hypgeom \
|
||||
acb_calc acb_hypgeom acb_modular dirichlet acb_dft acb_dirichlet arb_hypgeom bernoulli hypgeom \
|
||||
fmpz_extras bool_mat partitions dlog \
|
||||
$(EXTRA_BUILD_DIRS)
|
||||
|
||||
|
|
243
acb_dirichlet.h
243
acb_dirichlet.h
|
@ -21,7 +21,7 @@
|
|||
#endif
|
||||
|
||||
#include "acb.h"
|
||||
#include "dlog.h"
|
||||
#include "dirichlet.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
@ -32,205 +32,8 @@ void _acb_dirichlet_euler_product_real_ui(arb_t res, ulong s,
|
|||
|
||||
void acb_dirichlet_eta(acb_t res, const acb_t s, slong prec);
|
||||
|
||||
/* should this dlog pointer be in the prime or the global group? */
|
||||
typedef struct
|
||||
{
|
||||
ulong p; /* underlying prime */
|
||||
int e; /* exponent */
|
||||
nmod_t pe; /* modulus */
|
||||
ulong phi; /* phi(p^e) */
|
||||
ulong g; /* conrey generator */
|
||||
dlog_precomp_struct * dlog; /* precomputed data for discrete log mod p^e */
|
||||
}
|
||||
acb_dirichlet_prime_group_struct;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
ulong q; /* modulus */
|
||||
ulong q_even; /* even part of modulus */
|
||||
nmod_t mod; /* modulus with precomputed inverse */
|
||||
ulong rad_q; /* radical = product of odd primes */
|
||||
ulong phi_q; /* phi(q) = group size */
|
||||
slong neven; /* number of even components (in 0,1,2)*/
|
||||
slong num; /* number of prime components (even + odd) */
|
||||
ulong expo; /* exponent = largest order in G */
|
||||
acb_dirichlet_prime_group_struct * P;
|
||||
ulong * generators; /* generators lifted mod q */
|
||||
ulong * PHI; /* PHI(k) = expo / phi(k) */
|
||||
}
|
||||
acb_dirichlet_group_struct;
|
||||
|
||||
typedef acb_dirichlet_group_struct acb_dirichlet_group_t[1];
|
||||
|
||||
ACB_DIRICHLET_INLINE ulong
|
||||
acb_dirichlet_group_size(const acb_dirichlet_group_t G)
|
||||
{
|
||||
return G->phi_q;
|
||||
}
|
||||
|
||||
void acb_dirichlet_group_init(acb_dirichlet_group_t G, ulong q);
|
||||
void acb_dirichlet_subgroup_init(acb_dirichlet_group_t H, const acb_dirichlet_group_t G, ulong h);
|
||||
void acb_dirichlet_group_clear(acb_dirichlet_group_t G);
|
||||
void acb_dirichlet_group_dlog_precompute(acb_dirichlet_group_t G, ulong num);
|
||||
void acb_dirichlet_group_dlog_clear(acb_dirichlet_group_t G);
|
||||
|
||||
/* properties of elements without log */
|
||||
|
||||
ulong acb_dirichlet_number_primitive(const acb_dirichlet_group_t G);
|
||||
ulong acb_dirichlet_ui_conductor(const acb_dirichlet_group_t G, ulong a);
|
||||
int acb_dirichlet_ui_parity(const acb_dirichlet_group_t G, ulong a);
|
||||
ulong acb_dirichlet_ui_order(const acb_dirichlet_group_t G, ulong a);
|
||||
|
||||
/* elements of the group, keep both number and log */
|
||||
typedef struct
|
||||
{
|
||||
ulong n; /* number */
|
||||
ulong * log; /* s.t. prod generators[k]^log[k] = number */
|
||||
}
|
||||
acb_dirichlet_conrey_struct;
|
||||
|
||||
typedef acb_dirichlet_conrey_struct acb_dirichlet_conrey_t[1];
|
||||
|
||||
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);
|
||||
|
||||
ACB_DIRICHLET_INLINE void
|
||||
acb_dirichlet_conrey_set(acb_dirichlet_conrey_t x, const acb_dirichlet_group_t G, const acb_dirichlet_conrey_t y)
|
||||
{
|
||||
slong k;
|
||||
x->n = y->n;
|
||||
for (k = 0; k < G->num; k++)
|
||||
x->log[k] = y->log[k];
|
||||
}
|
||||
|
||||
ACB_DIRICHLET_INLINE int
|
||||
acb_dirichlet_conrey_eq(const acb_dirichlet_conrey_t x, const acb_dirichlet_conrey_t y)
|
||||
{
|
||||
return (x->n == y->n);
|
||||
}
|
||||
|
||||
int acb_dirichlet_conrey_eq_deep(const acb_dirichlet_group_t G, const acb_dirichlet_conrey_t x, const acb_dirichlet_conrey_t y);
|
||||
int acb_dirichlet_conrey_parity(const acb_dirichlet_group_t G, const acb_dirichlet_conrey_t x);
|
||||
ulong acb_dirichlet_conrey_conductor(const acb_dirichlet_group_t G, const acb_dirichlet_conrey_t x);
|
||||
ulong acb_dirichlet_conrey_order(const acb_dirichlet_group_t G, const acb_dirichlet_conrey_t x);
|
||||
|
||||
void acb_dirichlet_conrey_log(acb_dirichlet_conrey_t x, const acb_dirichlet_group_t G, ulong m);
|
||||
ulong acb_dirichlet_conrey_exp(acb_dirichlet_conrey_t x, const acb_dirichlet_group_t G);
|
||||
|
||||
void acb_dirichlet_conrey_index(acb_dirichlet_conrey_t x, const acb_dirichlet_group_t G, ulong j);
|
||||
ulong acb_dirichlet_index_conrey(const acb_dirichlet_group_t G, const acb_dirichlet_conrey_t x);
|
||||
|
||||
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);
|
||||
|
||||
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);
|
||||
|
||||
void acb_dirichlet_conrey_mul(acb_dirichlet_conrey_t c, const acb_dirichlet_group_t G, const acb_dirichlet_conrey_t a, const acb_dirichlet_conrey_t b);
|
||||
void acb_dirichlet_conrey_pow(acb_dirichlet_conrey_t c, const acb_dirichlet_group_t G, const acb_dirichlet_conrey_t a, ulong n);
|
||||
void acb_dirichlet_conrey_primitive(acb_dirichlet_conrey_t y, const acb_dirichlet_group_t G, const acb_dirichlet_conrey_t x, ulong cond);
|
||||
|
||||
#define ACB_DIRICHLET_CHI_NULL UWORD_MAX
|
||||
|
||||
ulong acb_dirichlet_ui_pairing_conrey(const acb_dirichlet_group_t G, const acb_dirichlet_conrey_t a, const acb_dirichlet_conrey_t b);
|
||||
ulong acb_dirichlet_ui_pairing(const acb_dirichlet_group_t G, ulong m, ulong n);
|
||||
|
||||
void acb_dirichlet_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_pairing(acb_t res, const acb_dirichlet_group_t G, ulong m, ulong n, slong prec);
|
||||
|
||||
/* introducing character type */
|
||||
|
||||
/* character = reduced exponents, keep order, number and conductor */
|
||||
typedef struct
|
||||
{
|
||||
ulong q; /* modulus */
|
||||
nmod_t order; /* order */
|
||||
acb_dirichlet_conrey_t x;
|
||||
ulong * expo; /* reduced exponents ( log[k] * PHI[k] / gcd( ) ) */
|
||||
int parity; /* 0 for even char, 1 for odd */
|
||||
ulong conductor;
|
||||
}
|
||||
acb_dirichlet_char_struct;
|
||||
|
||||
typedef acb_dirichlet_char_struct acb_dirichlet_char_t[1];
|
||||
|
||||
ACB_DIRICHLET_INLINE ulong
|
||||
acb_dirichlet_char_order(const acb_dirichlet_char_t chi)
|
||||
{
|
||||
return chi->order.n;
|
||||
}
|
||||
|
||||
ACB_DIRICHLET_INLINE ulong
|
||||
acb_dirichlet_char_conductor(const acb_dirichlet_char_t chi)
|
||||
{
|
||||
return chi->conductor;
|
||||
}
|
||||
|
||||
ACB_DIRICHLET_INLINE int
|
||||
acb_dirichlet_char_parity(const acb_dirichlet_char_t chi)
|
||||
{
|
||||
return chi->parity;
|
||||
}
|
||||
|
||||
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);
|
||||
void acb_dirichlet_char_print(const acb_dirichlet_group_t G, const acb_dirichlet_char_t chi);
|
||||
|
||||
ACB_DIRICHLET_INLINE void
|
||||
acb_dirichlet_char_set(acb_dirichlet_char_t chi1, const acb_dirichlet_group_t G, const acb_dirichlet_char_t chi2)
|
||||
{
|
||||
slong k;
|
||||
|
||||
chi1->q = chi2->q;
|
||||
chi1->conductor = chi2->conductor;
|
||||
chi1->order = chi2->order;
|
||||
chi1->parity = chi2->parity;
|
||||
acb_dirichlet_conrey_set(chi1->x, G, chi2->x);
|
||||
for (k = 0; k < G->num; k++)
|
||||
chi1->expo[k] = chi2->expo[k];
|
||||
}
|
||||
|
||||
ACB_DIRICHLET_INLINE int
|
||||
acb_dirichlet_char_eq(const acb_dirichlet_char_t chi1, const acb_dirichlet_char_t chi2)
|
||||
{
|
||||
return (chi1->q == chi2->q && chi1->x->n == chi2->x->n);
|
||||
}
|
||||
|
||||
int acb_dirichlet_char_eq_deep(const acb_dirichlet_group_t G, const acb_dirichlet_char_t chi1, const acb_dirichlet_char_t chi2);
|
||||
ACB_DIRICHLET_INLINE int
|
||||
acb_dirichlet_char_is_principal(const acb_dirichlet_char_t chi)
|
||||
{
|
||||
return (chi->x->n == 1);
|
||||
}
|
||||
ACB_DIRICHLET_INLINE int
|
||||
acb_dirichlet_char_is_real(const acb_dirichlet_char_t chi)
|
||||
{
|
||||
return (chi->order.n <= 2);
|
||||
}
|
||||
|
||||
void acb_dirichlet_char(acb_dirichlet_char_t chi, const acb_dirichlet_group_t G, ulong n);
|
||||
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_set_expo(acb_dirichlet_char_t chi, const acb_dirichlet_group_t G);
|
||||
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);
|
||||
|
||||
void acb_dirichlet_char_mul(acb_dirichlet_char_t chi12, const acb_dirichlet_group_t G, const acb_dirichlet_char_t chi1, const acb_dirichlet_char_t chi2);
|
||||
void acb_dirichlet_char_primitive(acb_dirichlet_char_t chi0, const acb_dirichlet_group_t G0, const acb_dirichlet_group_t G, const acb_dirichlet_char_t chi);
|
||||
|
||||
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);
|
||||
|
||||
int acb_dirichlet_char_next(acb_dirichlet_char_t chi, const acb_dirichlet_group_t G);
|
||||
int acb_dirichlet_char_next_primitive(acb_dirichlet_char_t chi, const acb_dirichlet_group_t G);
|
||||
|
||||
ulong acb_dirichlet_ui_chi_conrey(const acb_dirichlet_group_t G, const acb_dirichlet_char_t chi, const acb_dirichlet_conrey_t x);
|
||||
ulong acb_dirichlet_ui_chi(const acb_dirichlet_group_t G, const acb_dirichlet_char_t chi, ulong n);
|
||||
|
||||
void acb_dirichlet_ui_vec_set_null(ulong *v, const acb_dirichlet_group_t G, slong nv);
|
||||
void acb_dirichlet_ui_chi_vec_loop(ulong *v, const acb_dirichlet_group_t G, const acb_dirichlet_char_t chi, slong nv);
|
||||
void acb_dirichlet_ui_chi_vec_primeloop(ulong *v, const acb_dirichlet_group_t G, const acb_dirichlet_char_t chi, slong nv);
|
||||
void acb_dirichlet_ui_chi_vec(ulong *v, const acb_dirichlet_group_t G, const acb_dirichlet_char_t chi, slong nv);
|
||||
void acb_dirichlet_pairing_conrey(acb_t res, const dirichlet_group_t G, const dirichlet_conrey_t a, const dirichlet_conrey_t b, slong prec);
|
||||
void acb_dirichlet_pairing(acb_t res, const dirichlet_group_t G, ulong m, ulong n, slong prec);
|
||||
|
||||
/* precompute powers of a root of unity */
|
||||
typedef struct
|
||||
|
@ -250,8 +53,8 @@ void acb_dirichlet_powers_init(acb_dirichlet_powers_t t, ulong order, slong num,
|
|||
void acb_dirichlet_powers_clear(acb_dirichlet_powers_t t);
|
||||
void acb_dirichlet_power(acb_t z, const acb_dirichlet_powers_t t, ulong n, slong prec);
|
||||
|
||||
void acb_dirichlet_chi(acb_t res, const acb_dirichlet_group_t G, const acb_dirichlet_char_t chi, ulong n, slong prec);
|
||||
void acb_dirichlet_chi_vec(acb_ptr v, const acb_dirichlet_group_t G, const acb_dirichlet_char_t chi, slong nv, slong prec);
|
||||
void acb_dirichlet_chi(acb_t res, const dirichlet_group_t G, const dirichlet_char_t chi, ulong n, slong prec);
|
||||
void acb_dirichlet_chi_vec(acb_ptr v, const dirichlet_group_t G, const dirichlet_char_t chi, slong nv, slong prec);
|
||||
|
||||
void acb_dirichlet_arb_quadratic_powers(arb_ptr v, slong nv, const arb_t x, slong prec);
|
||||
void acb_dirichlet_qseries_arb(acb_t res, acb_srcptr a, const arb_t x, slong len, slong prec);
|
||||
|
@ -263,34 +66,34 @@ ulong acb_dirichlet_theta_length(ulong q, const arb_t x, slong prec);
|
|||
void mag_tail_kexpk2_arb(mag_t res, const arb_t a, ulong n);
|
||||
|
||||
void _acb_dirichlet_theta_argument_at_arb(arb_t xt, ulong q, const arb_t t, slong prec);
|
||||
void acb_dirichlet_theta_arb(acb_t res, const acb_dirichlet_group_t G, const acb_dirichlet_char_t chi, const arb_t t, slong prec);
|
||||
void acb_dirichlet_ui_theta_arb(acb_t res, const acb_dirichlet_group_t G, ulong a, const arb_t t, slong prec);
|
||||
void acb_dirichlet_theta_arb(acb_t res, const dirichlet_group_t G, const dirichlet_char_t chi, const arb_t t, slong prec);
|
||||
void acb_dirichlet_ui_theta_arb(acb_t res, const dirichlet_group_t G, ulong a, const arb_t t, slong prec);
|
||||
|
||||
void acb_dirichlet_gauss_sum_naive(acb_t res, const acb_dirichlet_group_t G, const acb_dirichlet_char_t chi, slong prec);
|
||||
void acb_dirichlet_gauss_sum_factor(acb_t res, const acb_dirichlet_group_t G, const acb_dirichlet_char_t chi, slong prec);
|
||||
void acb_dirichlet_gauss_sum_order2(acb_t res, const acb_dirichlet_char_t chi, slong prec);
|
||||
void acb_dirichlet_gauss_sum_theta(acb_t res, const acb_dirichlet_group_t G, const acb_dirichlet_char_t chi, slong prec);
|
||||
void acb_dirichlet_gauss_sum(acb_t res, const acb_dirichlet_group_t G, const acb_dirichlet_char_t chi, slong prec);
|
||||
void acb_dirichlet_gauss_sum_naive(acb_t res, const dirichlet_group_t G, const dirichlet_char_t chi, slong prec);
|
||||
void acb_dirichlet_gauss_sum_factor(acb_t res, const dirichlet_group_t G, const dirichlet_char_t chi, slong prec);
|
||||
void acb_dirichlet_gauss_sum_order2(acb_t res, const dirichlet_char_t chi, slong prec);
|
||||
void acb_dirichlet_gauss_sum_theta(acb_t res, const dirichlet_group_t G, const dirichlet_char_t chi, slong prec);
|
||||
void acb_dirichlet_gauss_sum(acb_t res, const dirichlet_group_t G, const dirichlet_char_t chi, slong prec);
|
||||
|
||||
void acb_dirichlet_root_number_theta(acb_t res, const acb_dirichlet_group_t G, const acb_dirichlet_char_t chi, slong prec);
|
||||
void acb_dirichlet_root_number(acb_t res, const acb_dirichlet_group_t G, const acb_dirichlet_char_t chi, slong prec);
|
||||
void acb_dirichlet_root_number_theta(acb_t res, const dirichlet_group_t G, const dirichlet_char_t chi, slong prec);
|
||||
void acb_dirichlet_root_number(acb_t res, const dirichlet_group_t G, const dirichlet_char_t chi, slong prec);
|
||||
|
||||
void acb_dirichlet_si_poly_evaluate(acb_t res, slong * v, slong len, const acb_t z, slong prec);
|
||||
|
||||
void acb_dirichlet_jacobi_sum_naive(acb_t res, const acb_dirichlet_group_t G, const acb_dirichlet_char_t chi1, const acb_dirichlet_char_t chi2, slong prec);
|
||||
void acb_dirichlet_jacobi_sum_naive(acb_t res, const dirichlet_group_t G, const dirichlet_char_t chi1, const dirichlet_char_t chi2, slong prec);
|
||||
ulong jacobi_one_prime(ulong p, ulong e, ulong pe, ulong cond);
|
||||
void acb_dirichlet_jacobi_sum_factor(acb_t res, const acb_dirichlet_group_t G, const acb_dirichlet_char_t chi1, const acb_dirichlet_char_t chi2, slong prec);
|
||||
void acb_dirichlet_jacobi_sum_gauss(acb_t res, const acb_dirichlet_group_t G, const acb_dirichlet_char_t chi1, const acb_dirichlet_char_t chi2, slong prec);
|
||||
void acb_dirichlet_jacobi_sum(acb_t res, const acb_dirichlet_group_t G, const acb_dirichlet_char_t chi1, const acb_dirichlet_char_t chi2, slong prec);
|
||||
void acb_dirichlet_jacobi_sum_ui(acb_t res, const acb_dirichlet_group_t G, ulong a, ulong b, slong prec);
|
||||
void acb_dirichlet_jacobi_sum_factor(acb_t res, const dirichlet_group_t G, const dirichlet_char_t chi1, const dirichlet_char_t chi2, slong prec);
|
||||
void acb_dirichlet_jacobi_sum_gauss(acb_t res, const dirichlet_group_t G, const dirichlet_char_t chi1, const dirichlet_char_t chi2, slong prec);
|
||||
void acb_dirichlet_jacobi_sum(acb_t res, const dirichlet_group_t G, const dirichlet_char_t chi1, const dirichlet_char_t chi2, slong prec);
|
||||
void acb_dirichlet_jacobi_sum_ui(acb_t res, const dirichlet_group_t G, ulong a, ulong b, slong prec);
|
||||
|
||||
void 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);
|
||||
void acb_dirichlet_l_vec_hurwitz(acb_ptr res, const acb_t s, const acb_dirichlet_group_t G, slong prec);
|
||||
void acb_dirichlet_l_hurwitz(acb_t res, const acb_t s, const dirichlet_group_t G, const dirichlet_char_t chi, slong prec);
|
||||
void acb_dirichlet_l_vec_hurwitz(acb_ptr res, const acb_t s, const dirichlet_group_t G, slong prec);
|
||||
|
||||
/* Discrete Fourier Transform */
|
||||
|
||||
void acb_dirichlet_dft_conrey(acb_ptr w, acb_srcptr v, const acb_dirichlet_group_t G, slong prec);
|
||||
void acb_dirichlet_dft(acb_ptr w, acb_srcptr v, const acb_dirichlet_group_t G, slong prec);
|
||||
void acb_dirichlet_dft_conrey(acb_ptr w, acb_srcptr v, const dirichlet_group_t G, slong prec);
|
||||
void acb_dirichlet_dft(acb_ptr w, acb_srcptr v, const dirichlet_group_t G, slong prec);
|
||||
|
||||
/* utils */
|
||||
|
||||
|
|
|
@ -1,19 +0,0 @@
|
|||
/*
|
||||
Copyright (C) 2016 Pascal Molin
|
||||
|
||||
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_char_mul(acb_dirichlet_char_t chi12, const acb_dirichlet_group_t G, const acb_dirichlet_char_t chi1, const acb_dirichlet_char_t chi2)
|
||||
{
|
||||
acb_dirichlet_conrey_mul(chi12->x, G, chi1->x, chi2->x);
|
||||
acb_dirichlet_char_conrey(chi12, G, NULL);
|
||||
}
|
|
@ -14,11 +14,11 @@
|
|||
#include "acb_dirichlet.h"
|
||||
|
||||
void
|
||||
acb_dirichlet_chi(acb_t res, const acb_dirichlet_group_t G, const acb_dirichlet_char_t chi, ulong n, slong prec)
|
||||
acb_dirichlet_chi(acb_t res, const dirichlet_group_t G, const dirichlet_char_t chi, ulong n, slong prec)
|
||||
{
|
||||
ulong expo;
|
||||
expo = acb_dirichlet_ui_chi(G, chi, n);
|
||||
if (expo == ACB_DIRICHLET_CHI_NULL)
|
||||
expo = dirichlet_ui_chi(G, chi, n);
|
||||
if (expo == DIRICHLET_CHI_NULL)
|
||||
acb_zero(res);
|
||||
else
|
||||
{
|
||||
|
|
|
@ -12,21 +12,21 @@
|
|||
#include "acb_dirichlet.h"
|
||||
|
||||
void
|
||||
acb_dirichlet_chi_vec(acb_ptr v, const acb_dirichlet_group_t G, const acb_dirichlet_char_t chi, slong nv, slong prec)
|
||||
acb_dirichlet_chi_vec(acb_ptr v, const dirichlet_group_t G, const dirichlet_char_t chi, slong nv, slong prec)
|
||||
{
|
||||
slong k;
|
||||
ulong * a;
|
||||
acb_dirichlet_powers_t t;
|
||||
|
||||
a = flint_malloc(nv * sizeof(ulong));
|
||||
acb_dirichlet_ui_chi_vec(a, G, chi, nv);
|
||||
dirichlet_ui_chi_vec(a, G, chi, nv);
|
||||
|
||||
acb_dirichlet_powers_init(t, chi->order.n, nv, prec);
|
||||
|
||||
acb_zero(v + 0);
|
||||
for (k = 0; k < nv; k++)
|
||||
{
|
||||
if (a[k] != ACB_DIRICHLET_CHI_NULL)
|
||||
if (a[k] != DIRICHLET_CHI_NULL)
|
||||
acb_dirichlet_power(v + k, t, a[k], prec);
|
||||
else
|
||||
acb_zero(v + k);
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
/* dft, lexicographic conrey indexing, array size G->phi_q */
|
||||
void
|
||||
acb_dirichlet_dft_conrey(acb_ptr w, acb_srcptr v, const acb_dirichlet_group_t G, slong prec)
|
||||
acb_dirichlet_dft_conrey(acb_ptr w, acb_srcptr v, const dirichlet_group_t G, slong prec)
|
||||
{
|
||||
slong k, l, * cyc;
|
||||
cyc = flint_malloc(G->num * sizeof(slong));
|
||||
|
@ -27,34 +27,34 @@ acb_dirichlet_dft_conrey(acb_ptr w, acb_srcptr v, const acb_dirichlet_group_t G,
|
|||
|
||||
/* dft, number indexing, array size G->q */
|
||||
void
|
||||
acb_dirichlet_dft(acb_ptr w, acb_srcptr v, const acb_dirichlet_group_t G, slong prec)
|
||||
acb_dirichlet_dft(acb_ptr w, acb_srcptr v, const dirichlet_group_t G, slong prec)
|
||||
{
|
||||
ulong i, len;
|
||||
acb_ptr t1, t2;
|
||||
acb_dirichlet_conrey_t x;
|
||||
dirichlet_conrey_t x;
|
||||
|
||||
len = G->phi_q;
|
||||
t1 = flint_malloc(len * sizeof(acb_struct));
|
||||
|
||||
acb_dirichlet_conrey_init(x, G);
|
||||
acb_dirichlet_conrey_one(x, G);
|
||||
dirichlet_conrey_init(x, G);
|
||||
dirichlet_conrey_one(x, G);
|
||||
for (i = 0; i < len; i++)
|
||||
{
|
||||
t1[i] = v[x->n];
|
||||
acb_dirichlet_conrey_next(x, G);
|
||||
dirichlet_conrey_next(x, G);
|
||||
};
|
||||
|
||||
t2 = _acb_vec_init(len);
|
||||
acb_dirichlet_dft_conrey(t2, t1, G, prec);
|
||||
|
||||
acb_dirichlet_conrey_one(x, G);
|
||||
dirichlet_conrey_one(x, G);
|
||||
for (i = 0; i < len; i++)
|
||||
{
|
||||
acb_set(w + x->n, t2 + i);
|
||||
acb_dirichlet_conrey_next(x, G);
|
||||
dirichlet_conrey_next(x, G);
|
||||
};
|
||||
|
||||
_acb_vec_clear(t2, len);
|
||||
acb_dirichlet_conrey_clear(x);
|
||||
dirichlet_conrey_clear(x);
|
||||
flint_free(t1);
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
#include "acb_dirichlet.h"
|
||||
|
||||
static void
|
||||
gauss_sum_non_primitive(acb_t res, const acb_dirichlet_group_t G, const acb_dirichlet_char_t chi, slong prec)
|
||||
gauss_sum_non_primitive(acb_t res, const dirichlet_group_t G, const dirichlet_char_t chi, slong prec)
|
||||
{
|
||||
|
||||
slong k, mu = 1;
|
||||
|
@ -52,13 +52,13 @@ gauss_sum_non_primitive(acb_t res, const acb_dirichlet_group_t G, const acb_diri
|
|||
else
|
||||
{
|
||||
|
||||
acb_dirichlet_group_t G0;
|
||||
acb_dirichlet_char_t chi0;
|
||||
dirichlet_group_t G0;
|
||||
dirichlet_char_t chi0;
|
||||
acb_t z;
|
||||
|
||||
acb_dirichlet_subgroup_init(G0, G, chi->conductor);
|
||||
acb_dirichlet_char_init(chi0, G);
|
||||
acb_dirichlet_char_primitive(chi0, G0, G, chi);
|
||||
dirichlet_subgroup_init(G0, G, chi->conductor);
|
||||
dirichlet_char_init(chi0, G);
|
||||
dirichlet_char_primitive(chi0, G0, G, chi);
|
||||
|
||||
acb_init(z);
|
||||
acb_dirichlet_gauss_sum(z, G0, chi0, prec);
|
||||
|
@ -68,14 +68,14 @@ gauss_sum_non_primitive(acb_t res, const acb_dirichlet_group_t G, const acb_diri
|
|||
acb_mul(res, res, z, prec);
|
||||
acb_mul_si(res, res, mu, prec);
|
||||
|
||||
acb_dirichlet_group_clear(G0);
|
||||
acb_dirichlet_char_clear(chi0);
|
||||
dirichlet_group_clear(G0);
|
||||
dirichlet_char_clear(chi0);
|
||||
acb_clear(z);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
acb_dirichlet_gauss_sum(acb_t res, const acb_dirichlet_group_t G, const acb_dirichlet_char_t chi, slong prec)
|
||||
acb_dirichlet_gauss_sum(acb_t res, const dirichlet_group_t G, const dirichlet_char_t chi, slong prec)
|
||||
{
|
||||
/* TODO: no need, factor also does it... */
|
||||
if (chi->conductor != G->q)
|
||||
|
@ -100,11 +100,11 @@ acb_dirichlet_gauss_sum(acb_t res, const acb_dirichlet_group_t G, const acb_diri
|
|||
}
|
||||
|
||||
void
|
||||
acb_dirichlet_gauss_sum_ui(acb_t res, const acb_dirichlet_group_t G, ulong a, slong prec)
|
||||
acb_dirichlet_gauss_sum_ui(acb_t res, const dirichlet_group_t G, ulong a, slong prec)
|
||||
{
|
||||
acb_dirichlet_char_t chi;
|
||||
acb_dirichlet_char_init(chi, G);
|
||||
acb_dirichlet_char(chi, G, a);
|
||||
dirichlet_char_t chi;
|
||||
dirichlet_char_init(chi, G);
|
||||
dirichlet_char(chi, G, a);
|
||||
acb_dirichlet_gauss_sum(res, G, chi, prec);
|
||||
acb_dirichlet_char_clear(chi);
|
||||
dirichlet_char_clear(chi);
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
#include "acb_dirichlet.h"
|
||||
|
||||
void
|
||||
acb_dirichlet_gauss_sum_factor(acb_t res, const acb_dirichlet_group_t G, const acb_dirichlet_char_t chi, slong prec)
|
||||
acb_dirichlet_gauss_sum_factor(acb_t res, const dirichlet_group_t G, const dirichlet_char_t chi, slong prec)
|
||||
{
|
||||
|
||||
slong k;
|
||||
|
@ -36,11 +36,11 @@ acb_dirichlet_gauss_sum_factor(acb_t res, const acb_dirichlet_group_t G, const a
|
|||
for (k = (G->neven == 2); k < G->num; k++)
|
||||
{
|
||||
ulong pe = G->P[k].pe.n;
|
||||
acb_dirichlet_group_t Gp;
|
||||
acb_dirichlet_char_t chip;
|
||||
dirichlet_group_t Gp;
|
||||
dirichlet_char_t chip;
|
||||
|
||||
acb_dirichlet_subgroup_init(Gp, G, pe);
|
||||
acb_dirichlet_char_init(chip, Gp);
|
||||
dirichlet_subgroup_init(Gp, G, pe);
|
||||
dirichlet_char_init(chip, Gp);
|
||||
|
||||
chip->x->n = chi->x->n % pe;
|
||||
|
||||
|
@ -52,7 +52,7 @@ acb_dirichlet_gauss_sum_factor(acb_t res, const acb_dirichlet_group_t G, const a
|
|||
else
|
||||
chip->x->log[0] = chi->x->log[k];
|
||||
|
||||
acb_dirichlet_char_conrey(chip, Gp, NULL);
|
||||
dirichlet_char_conrey(chip, Gp, NULL);
|
||||
|
||||
/* chi_pe(a, q/pe) * G_pe(a) */
|
||||
acb_dirichlet_gauss_sum(tmp, Gp, chip, prec);
|
||||
|
@ -61,8 +61,8 @@ acb_dirichlet_gauss_sum_factor(acb_t res, const acb_dirichlet_group_t G, const a
|
|||
acb_dirichlet_chi(tmp, Gp, chip, (G->q / pe) % pe, prec);
|
||||
acb_mul(res, res, tmp, prec);
|
||||
|
||||
acb_dirichlet_char_clear(chip);
|
||||
acb_dirichlet_group_clear(Gp);
|
||||
dirichlet_char_clear(chip);
|
||||
dirichlet_group_clear(Gp);
|
||||
}
|
||||
|
||||
if (G->q_even == 2)
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
#include "acb_poly.h"
|
||||
|
||||
void
|
||||
acb_dirichlet_gauss_sum_naive(acb_t res, const acb_dirichlet_group_t G, const acb_dirichlet_char_t chi, slong prec)
|
||||
acb_dirichlet_gauss_sum_naive(acb_t res, const dirichlet_group_t G, const dirichlet_char_t chi, slong prec)
|
||||
{
|
||||
acb_t z;
|
||||
acb_ptr v;
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
#include "acb_dirichlet.h"
|
||||
|
||||
void
|
||||
acb_dirichlet_gauss_sum_order2(acb_t res, const acb_dirichlet_char_t chi, slong prec)
|
||||
acb_dirichlet_gauss_sum_order2(acb_t res, const dirichlet_char_t chi, slong prec)
|
||||
{
|
||||
if (chi->parity)
|
||||
{
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
#include "acb_dirichlet.h"
|
||||
|
||||
void
|
||||
acb_dirichlet_gauss_sum_theta(acb_t res, const acb_dirichlet_group_t G, const acb_dirichlet_char_t chi, slong prec)
|
||||
acb_dirichlet_gauss_sum_theta(acb_t res, const dirichlet_group_t G, const dirichlet_char_t chi, slong prec)
|
||||
{
|
||||
if (chi->conductor < G->q || (G->q == 300 && (chi->x->n == 71 || chi->x->n == 131))
|
||||
|| (G->q == 600 && (chi->x->n == 11 || chi->x->n == 491)))
|
||||
|
|
|
@ -30,7 +30,7 @@ jacobi_one_prime(ulong p, ulong e, ulong pe, ulong cond)
|
|||
}
|
||||
|
||||
static ulong
|
||||
jacobi_one(const acb_dirichlet_group_t G, ulong cond)
|
||||
jacobi_one(const dirichlet_group_t G, ulong cond)
|
||||
{
|
||||
slong k, r = 1;
|
||||
|
||||
|
@ -41,7 +41,7 @@ jacobi_one(const acb_dirichlet_group_t G, ulong cond)
|
|||
}
|
||||
|
||||
void
|
||||
acb_dirichlet_jacobi_sum(acb_t res, const acb_dirichlet_group_t G, const acb_dirichlet_char_t chi1, const acb_dirichlet_char_t chi2, slong prec)
|
||||
acb_dirichlet_jacobi_sum(acb_t res, const dirichlet_group_t G, const dirichlet_char_t chi1, const dirichlet_char_t chi2, slong prec)
|
||||
{
|
||||
if (G->q_even > 1)
|
||||
{
|
||||
|
@ -75,7 +75,7 @@ acb_dirichlet_jacobi_sum(acb_t res, const acb_dirichlet_group_t G, const acb_dir
|
|||
}
|
||||
|
||||
void
|
||||
acb_dirichlet_jacobi_sum_ui(acb_t res, const acb_dirichlet_group_t G, ulong a, ulong b, slong prec)
|
||||
acb_dirichlet_jacobi_sum_ui(acb_t res, const dirichlet_group_t G, ulong a, ulong b, slong prec)
|
||||
{
|
||||
if (G->q_even > 1)
|
||||
{
|
||||
|
@ -83,27 +83,27 @@ acb_dirichlet_jacobi_sum_ui(acb_t res, const acb_dirichlet_group_t G, ulong a, u
|
|||
}
|
||||
else if (a == 1 || b == 1)
|
||||
{
|
||||
ulong cond = (a == 1) ? acb_dirichlet_ui_conductor(G, b) : acb_dirichlet_ui_conductor(G, a);
|
||||
ulong cond = (a == 1) ? dirichlet_ui_conductor(G, b) : dirichlet_ui_conductor(G, a);
|
||||
acb_set_si(res, jacobi_one(G, cond));
|
||||
}
|
||||
else if (nmod_mul(a, b, G->mod) == 1)
|
||||
{
|
||||
ulong n;
|
||||
n = jacobi_one(G, acb_dirichlet_ui_conductor(G, a));
|
||||
if (acb_dirichlet_ui_parity(G, a))
|
||||
n = jacobi_one(G, dirichlet_ui_conductor(G, a));
|
||||
if (dirichlet_ui_parity(G, a))
|
||||
acb_set_si(res, -n);
|
||||
else
|
||||
acb_set_si(res, n);
|
||||
}
|
||||
else
|
||||
{
|
||||
acb_dirichlet_char_t chi1, chi2;
|
||||
acb_dirichlet_char_init(chi1, G);
|
||||
acb_dirichlet_char_init(chi2, G);
|
||||
acb_dirichlet_char(chi1, G, a);
|
||||
acb_dirichlet_char(chi2, G, b);
|
||||
dirichlet_char_t chi1, chi2;
|
||||
dirichlet_char_init(chi1, G);
|
||||
dirichlet_char_init(chi2, G);
|
||||
dirichlet_char(chi1, G, a);
|
||||
dirichlet_char(chi2, G, b);
|
||||
acb_dirichlet_jacobi_sum(res, G, chi1, chi2, prec);
|
||||
acb_dirichlet_char_clear(chi1);
|
||||
acb_dirichlet_char_clear(chi2);
|
||||
dirichlet_char_clear(chi1);
|
||||
dirichlet_char_clear(chi2);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
#include "acb_dirichlet.h"
|
||||
|
||||
void
|
||||
acb_dirichlet_jacobi_sum_factor(acb_t res, const acb_dirichlet_group_t G, const acb_dirichlet_char_t chi1, const acb_dirichlet_char_t chi2, slong prec)
|
||||
acb_dirichlet_jacobi_sum_factor(acb_t res, const dirichlet_group_t G, const dirichlet_char_t chi1, const dirichlet_char_t chi2, slong prec)
|
||||
{
|
||||
slong k;
|
||||
acb_t tmp;
|
||||
|
@ -47,20 +47,20 @@ acb_dirichlet_jacobi_sum_factor(acb_t res, const acb_dirichlet_group_t G, const
|
|||
}
|
||||
else
|
||||
{
|
||||
acb_dirichlet_group_t Gp;
|
||||
acb_dirichlet_char_t chi1p, chi2p;
|
||||
dirichlet_group_t Gp;
|
||||
dirichlet_char_t chi1p, chi2p;
|
||||
|
||||
acb_dirichlet_group_init(Gp, pe.n);
|
||||
acb_dirichlet_char_init(chi1p, Gp);
|
||||
acb_dirichlet_char_init(chi2p, Gp);
|
||||
dirichlet_group_init(Gp, pe.n);
|
||||
dirichlet_char_init(chi1p, Gp);
|
||||
dirichlet_char_init(chi2p, Gp);
|
||||
|
||||
chi1p->x->n = ap;
|
||||
chi1p->x->log[0] = chi1->x->log[k];
|
||||
chi2p->x->n = ap;
|
||||
chi2p->x->log[0] = chi2->x->log[k];
|
||||
|
||||
acb_dirichlet_char_conrey(chi1p, Gp, NULL);
|
||||
acb_dirichlet_char_conrey(chi2p, Gp, NULL);
|
||||
dirichlet_char_conrey(chi1p, Gp, NULL);
|
||||
dirichlet_char_conrey(chi2p, Gp, NULL);
|
||||
|
||||
/* TODO: work out gauss relations for e > 1 */
|
||||
if (p <= 100 || e > 1)
|
||||
|
@ -70,9 +70,9 @@ acb_dirichlet_jacobi_sum_factor(acb_t res, const acb_dirichlet_group_t G, const
|
|||
|
||||
acb_mul(res, res, tmp, prec);
|
||||
|
||||
acb_dirichlet_char_clear(chi1p);
|
||||
acb_dirichlet_char_clear(chi2p);
|
||||
acb_dirichlet_group_clear(Gp);
|
||||
dirichlet_char_clear(chi1p);
|
||||
dirichlet_char_clear(chi2p);
|
||||
dirichlet_group_clear(Gp);
|
||||
}
|
||||
}
|
||||
acb_clear(tmp);
|
||||
|
|
|
@ -13,14 +13,14 @@
|
|||
|
||||
/* should use only for prime power modulus */
|
||||
void
|
||||
acb_dirichlet_jacobi_sum_gauss(acb_t res, const acb_dirichlet_group_t G, const acb_dirichlet_char_t chi1, const acb_dirichlet_char_t chi2, slong prec)
|
||||
acb_dirichlet_jacobi_sum_gauss(acb_t res, const dirichlet_group_t G, const dirichlet_char_t chi1, const dirichlet_char_t chi2, slong prec)
|
||||
{
|
||||
/* J_q(a,b)G_q(ab) = G_q(a)G_q(b) */
|
||||
acb_t tmp;
|
||||
acb_dirichlet_char_t chi12;
|
||||
dirichlet_char_t chi12;
|
||||
|
||||
acb_dirichlet_char_init(chi12, G);
|
||||
acb_dirichlet_char_mul(chi12, G, chi1, chi2);
|
||||
dirichlet_char_init(chi12, G);
|
||||
dirichlet_char_mul(chi12, G, chi1, chi2);
|
||||
|
||||
acb_init(tmp);
|
||||
|
||||
|
@ -33,6 +33,6 @@ acb_dirichlet_jacobi_sum_gauss(acb_t res, const acb_dirichlet_group_t G, const a
|
|||
acb_dirichlet_gauss_sum(tmp, G, chi12, prec);
|
||||
acb_div(res, res, tmp, prec);
|
||||
|
||||
acb_dirichlet_char_clear(chi12);
|
||||
dirichlet_char_clear(chi12);
|
||||
acb_clear(tmp);
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
#include "acb_dirichlet.h"
|
||||
|
||||
void
|
||||
acb_dirichlet_jacobi_sum_naive(acb_t res, const acb_dirichlet_group_t G, const acb_dirichlet_char_t chi1, const acb_dirichlet_char_t chi2, slong prec)
|
||||
acb_dirichlet_jacobi_sum_naive(acb_t res, const dirichlet_group_t G, const dirichlet_char_t chi1, const dirichlet_char_t chi2, slong prec)
|
||||
{
|
||||
|
||||
ulong k1, k2, m1, m2, g, e;
|
||||
|
@ -24,11 +24,11 @@ acb_dirichlet_jacobi_sum_naive(acb_t res, const acb_dirichlet_group_t G, const a
|
|||
v1 = flint_malloc(G->q * sizeof(ulong));
|
||||
v2 = flint_malloc(G->q * sizeof(ulong));
|
||||
|
||||
acb_dirichlet_ui_vec_set_null(v1, G, G->q);
|
||||
acb_dirichlet_ui_chi_vec_loop(v1, G, chi1, G->q);
|
||||
dirichlet_ui_vec_set_null(v1, G, G->q);
|
||||
dirichlet_ui_chi_vec_loop(v1, G, chi1, G->q);
|
||||
|
||||
acb_dirichlet_ui_vec_set_null(v2, G, G->q);
|
||||
acb_dirichlet_ui_chi_vec_loop(v2, G, chi2, G->q);
|
||||
dirichlet_ui_vec_set_null(v2, G, G->q);
|
||||
dirichlet_ui_chi_vec_loop(v2, G, chi2, G->q);
|
||||
|
||||
m1 = chi1->order.n;
|
||||
m2 = chi2->order.n;
|
||||
|
@ -44,8 +44,8 @@ acb_dirichlet_jacobi_sum_naive(acb_t res, const acb_dirichlet_group_t G, const a
|
|||
|
||||
for (k1 = 2, k2 = G->q - 1; k2 > 1; k1++, k2--)
|
||||
{
|
||||
if (v1[k1] == ACB_DIRICHLET_CHI_NULL ||
|
||||
v2[k2] == ACB_DIRICHLET_CHI_NULL)
|
||||
if (v1[k1] == DIRICHLET_CHI_NULL ||
|
||||
v2[k2] == DIRICHLET_CHI_NULL)
|
||||
continue;
|
||||
e = nmod_add(v1[k1] * m1, v2[k2] * m2, order);
|
||||
v[e]++;
|
||||
|
|
|
@ -16,12 +16,12 @@
|
|||
/* todo: should document or fix that it doesn't allow aliasing */
|
||||
void
|
||||
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)
|
||||
const dirichlet_group_t G, const dirichlet_char_t chi, slong prec)
|
||||
{
|
||||
ulong chin;
|
||||
acb_t t, u, a;
|
||||
acb_ptr z;
|
||||
acb_dirichlet_conrey_t cn;
|
||||
dirichlet_conrey_t cn;
|
||||
int deflate;
|
||||
|
||||
/* remove pole in Hurwitz zeta at s = 1 */
|
||||
|
@ -37,12 +37,12 @@ acb_dirichlet_l_hurwitz(acb_t res, const acb_t s,
|
|||
deflate = 1;
|
||||
}
|
||||
|
||||
acb_dirichlet_conrey_init(cn, G);
|
||||
dirichlet_conrey_init(cn, G);
|
||||
acb_init(t);
|
||||
acb_init(u);
|
||||
acb_init(a);
|
||||
|
||||
acb_dirichlet_conrey_one(cn, G);
|
||||
dirichlet_conrey_one(cn, G);
|
||||
acb_zero(t);
|
||||
|
||||
prec += n_clog(G->phi_q, 2);
|
||||
|
@ -51,7 +51,7 @@ acb_dirichlet_l_hurwitz(acb_t res, const acb_t s,
|
|||
_acb_vec_nth_roots(z, chi->order.n, prec);
|
||||
|
||||
do {
|
||||
chin = acb_dirichlet_ui_chi_conrey(G, chi, cn);
|
||||
chin = dirichlet_ui_chi_conrey(G, chi, cn);
|
||||
|
||||
acb_set_ui(a, cn->n);
|
||||
acb_div_ui(a, a, G->q, prec);
|
||||
|
@ -63,14 +63,14 @@ acb_dirichlet_l_hurwitz(acb_t res, const acb_t s,
|
|||
|
||||
acb_addmul(t, z + chin, u, prec);
|
||||
|
||||
} while (acb_dirichlet_conrey_next(cn, G) >= 0);
|
||||
} while (dirichlet_conrey_next(cn, G) >= 0);
|
||||
|
||||
acb_set_ui(u, G->q);
|
||||
acb_neg(a, s);
|
||||
acb_pow(u, u, a, prec);
|
||||
acb_mul(res, t, u, prec);
|
||||
|
||||
acb_dirichlet_conrey_clear(cn);
|
||||
dirichlet_conrey_clear(cn);
|
||||
|
||||
_acb_vec_clear(z, chi->order.n);
|
||||
acb_clear(t);
|
||||
|
|
|
@ -14,17 +14,17 @@
|
|||
|
||||
void
|
||||
acb_dirichlet_l_vec_hurwitz(acb_ptr res, const acb_t s,
|
||||
const acb_dirichlet_group_t G, slong prec)
|
||||
const dirichlet_group_t G, slong prec)
|
||||
{
|
||||
acb_t a, qs;
|
||||
acb_ptr zeta, z;
|
||||
acb_dirichlet_conrey_t cn;
|
||||
dirichlet_conrey_t cn;
|
||||
int deflate;
|
||||
|
||||
/* remove pole in Hurwitz zeta at s = 1 */
|
||||
deflate = acb_is_one(s);
|
||||
|
||||
acb_dirichlet_conrey_init(cn, G);
|
||||
dirichlet_conrey_init(cn, G);
|
||||
acb_init(qs);
|
||||
acb_init(a);
|
||||
|
||||
|
@ -35,7 +35,7 @@ acb_dirichlet_l_vec_hurwitz(acb_ptr res, const acb_t s,
|
|||
acb_pow(qs, qs, a, prec);
|
||||
|
||||
zeta = z = _acb_vec_init(G->phi_q);
|
||||
acb_dirichlet_conrey_one(cn, G);
|
||||
dirichlet_conrey_one(cn, G);
|
||||
do {
|
||||
|
||||
acb_set_ui(a, cn->n);
|
||||
|
@ -49,7 +49,7 @@ acb_dirichlet_l_vec_hurwitz(acb_ptr res, const acb_t s,
|
|||
acb_mul(z, z, qs, prec);
|
||||
|
||||
z++;
|
||||
} while (acb_dirichlet_conrey_next(cn, G) >= 0);
|
||||
} while (dirichlet_conrey_next(cn, G) >= 0);
|
||||
|
||||
acb_dirichlet_dft_conrey(res, zeta, G, prec);
|
||||
|
||||
|
@ -57,7 +57,7 @@ acb_dirichlet_l_vec_hurwitz(acb_ptr res, const acb_t s,
|
|||
if (deflate)
|
||||
acb_indeterminate(res);
|
||||
|
||||
acb_dirichlet_conrey_clear(cn);
|
||||
dirichlet_conrey_clear(cn);
|
||||
_acb_vec_clear(zeta, G->phi_q);
|
||||
acb_clear(qs);
|
||||
acb_clear(a);
|
||||
|
|
|
@ -12,11 +12,11 @@
|
|||
#include "acb_dirichlet.h"
|
||||
|
||||
void
|
||||
acb_dirichlet_pairing(acb_t res, const acb_dirichlet_group_t G, ulong m, ulong n, slong prec)
|
||||
acb_dirichlet_pairing(acb_t res, const dirichlet_group_t G, ulong m, ulong n, slong prec)
|
||||
{
|
||||
ulong expo;
|
||||
expo = acb_dirichlet_ui_pairing(G, m, n);
|
||||
if (expo == ACB_DIRICHLET_CHI_NULL)
|
||||
expo = dirichlet_ui_pairing(G, m, n);
|
||||
if (expo == DIRICHLET_CHI_NULL)
|
||||
acb_zero(res);
|
||||
else
|
||||
{
|
||||
|
|
|
@ -12,11 +12,11 @@
|
|||
#include "acb_dirichlet.h"
|
||||
|
||||
void
|
||||
acb_dirichlet_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)
|
||||
acb_dirichlet_pairing_conrey(acb_t res, const dirichlet_group_t G, const dirichlet_conrey_t a, const dirichlet_conrey_t b, slong prec)
|
||||
{
|
||||
ulong expo;
|
||||
expo = acb_dirichlet_ui_pairing_conrey(G, a, b);
|
||||
if (expo == ACB_DIRICHLET_CHI_NULL)
|
||||
expo = dirichlet_ui_pairing_conrey(G, a, b);
|
||||
if (expo == DIRICHLET_CHI_NULL)
|
||||
acb_zero(res);
|
||||
else
|
||||
{
|
||||
|
|
|
@ -34,7 +34,7 @@ acb_dirichlet_qseries_arb_powers_naive(acb_t res, const arb_t x, int parity, con
|
|||
{
|
||||
arb_mul(dx, dx, x2, prec);
|
||||
arb_mul(xk2, xk2, dx, prec);
|
||||
if (a[k] != ACB_DIRICHLET_CHI_NULL)
|
||||
if (a[k] != DIRICHLET_CHI_NULL)
|
||||
{
|
||||
acb_dirichlet_power(zk, z, a[k], prec);
|
||||
if (parity)
|
||||
|
@ -76,7 +76,7 @@ acb_dirichlet_qseries_arb_powers_smallorder(acb_t res, const arb_t x, int parity
|
|||
{
|
||||
arb_mul(dx, dx, x2, prec);
|
||||
arb_mul(xk2, xk2, dx, prec);
|
||||
if (a[k] != ACB_DIRICHLET_CHI_NULL)
|
||||
if (a[k] != DIRICHLET_CHI_NULL)
|
||||
{
|
||||
if (parity)
|
||||
{
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
#include "acb_dirichlet.h"
|
||||
|
||||
void
|
||||
acb_dirichlet_root_number_theta(acb_t res, const acb_dirichlet_group_t G, const acb_dirichlet_char_t chi, slong prec)
|
||||
acb_dirichlet_root_number_theta(acb_t res, const dirichlet_group_t G, const dirichlet_char_t chi, slong prec)
|
||||
{
|
||||
arb_t x;
|
||||
acb_t eps;
|
||||
|
@ -29,7 +29,7 @@ acb_dirichlet_root_number_theta(acb_t res, const acb_dirichlet_group_t G, const
|
|||
}
|
||||
|
||||
void
|
||||
acb_dirichlet_root_number(acb_t res, const acb_dirichlet_group_t G, const acb_dirichlet_char_t chi, slong prec)
|
||||
acb_dirichlet_root_number(acb_t res, const dirichlet_group_t G, const dirichlet_char_t chi, slong prec)
|
||||
{
|
||||
if (chi->conductor < G->q)
|
||||
{
|
||||
|
|
|
@ -23,15 +23,15 @@ int main()
|
|||
for (iter = 0; iter < 10000 * arb_test_multiplier(); iter++)
|
||||
{
|
||||
acb_t zn1, zn2, zn1n2, zn1zn2;
|
||||
acb_dirichlet_group_t G;
|
||||
acb_dirichlet_char_t chi;
|
||||
dirichlet_group_t G;
|
||||
dirichlet_char_t chi;
|
||||
ulong q, m, n1, n2, iter2;
|
||||
int res;
|
||||
|
||||
q = 1 + n_randint(state, 1000);
|
||||
|
||||
acb_dirichlet_group_init(G, q);
|
||||
acb_dirichlet_char_init(chi, G);
|
||||
dirichlet_group_init(G, q);
|
||||
dirichlet_char_init(chi, G);
|
||||
acb_init(zn1);
|
||||
acb_init(zn2);
|
||||
acb_init(zn1n2);
|
||||
|
@ -44,7 +44,7 @@ int main()
|
|||
m = 1 + n_randint(state, q);
|
||||
} while (n_gcd(q, m) != 1);
|
||||
|
||||
acb_dirichlet_char(chi, G, m);
|
||||
dirichlet_char(chi, G, m);
|
||||
|
||||
n1 = n_randint(state, 1000);
|
||||
n2 = n_randint(state, 1000);
|
||||
|
@ -53,19 +53,19 @@ int main()
|
|||
acb_dirichlet_pairing(zn2, G, m, n1, 53);
|
||||
if (!acb_overlaps(zn1, zn2))
|
||||
{
|
||||
acb_dirichlet_conrey_t x;
|
||||
dirichlet_conrey_t x;
|
||||
flint_printf("FAIL: overlap\n\n");
|
||||
flint_printf("q = %wu\n\n", q);
|
||||
flint_printf("m = %wu\n\n", m);
|
||||
flint_printf("n = %wu\n\n", n1);
|
||||
flint_printf("char = "); acb_printd(zn1, 15); flint_printf("\n\n");
|
||||
flint_printf("pairing = "); acb_printd(zn2, 15); flint_printf("\n\n");
|
||||
acb_dirichlet_char_print(G, chi);
|
||||
acb_dirichlet_conrey_init(x, G);
|
||||
acb_dirichlet_conrey_log(x, G, m);
|
||||
flint_printf("log(m) = "); acb_dirichlet_conrey_print(G, x);
|
||||
acb_dirichlet_conrey_log(x, G, n1);
|
||||
flint_printf("log(n1) = "); acb_dirichlet_conrey_print(G, x);
|
||||
dirichlet_char_print(G, chi);
|
||||
dirichlet_conrey_init(x, G);
|
||||
dirichlet_conrey_log(x, G, m);
|
||||
flint_printf("log(m) = "); dirichlet_conrey_print(G, x);
|
||||
dirichlet_conrey_log(x, G, n1);
|
||||
flint_printf("log(n1) = "); dirichlet_conrey_print(G, x);
|
||||
abort();
|
||||
}
|
||||
|
||||
|
@ -119,8 +119,8 @@ int main()
|
|||
}
|
||||
}
|
||||
|
||||
acb_dirichlet_group_clear(G);
|
||||
acb_dirichlet_char_clear(chi);
|
||||
dirichlet_group_clear(G);
|
||||
dirichlet_char_clear(chi);
|
||||
acb_clear(zn1);
|
||||
acb_clear(zn2);
|
||||
acb_clear(zn1n2);
|
||||
|
|
|
@ -69,42 +69,42 @@ int main()
|
|||
for (k = 0; k < nq; k++)
|
||||
{
|
||||
slong i, j, len;
|
||||
acb_dirichlet_group_t G;
|
||||
acb_dirichlet_conrey_t x, y;
|
||||
dirichlet_group_t G;
|
||||
dirichlet_conrey_t x, y;
|
||||
acb_t chiy;
|
||||
acb_ptr v, w1, w2;
|
||||
|
||||
acb_dirichlet_group_init(G, q[k]);
|
||||
dirichlet_group_init(G, q[k]);
|
||||
|
||||
len = G->phi_q;
|
||||
v = _acb_vec_init(len);
|
||||
w1 = _acb_vec_init(len);
|
||||
w2 = _acb_vec_init(len);
|
||||
|
||||
acb_dirichlet_conrey_init(x, G);
|
||||
acb_dirichlet_conrey_one(x, G);
|
||||
dirichlet_conrey_init(x, G);
|
||||
dirichlet_conrey_one(x, G);
|
||||
for (i = 0; i < len; i++)
|
||||
acb_randtest_precise(v + i, state, prec, 0);
|
||||
|
||||
/* naive */
|
||||
acb_init(chiy);
|
||||
acb_dirichlet_conrey_init(y, G);
|
||||
acb_dirichlet_conrey_one(x, G);
|
||||
dirichlet_conrey_init(y, G);
|
||||
dirichlet_conrey_one(x, G);
|
||||
for (i = 0; i < len; i++)
|
||||
{
|
||||
acb_zero(w1 + i);
|
||||
acb_dirichlet_conrey_one(y, G);
|
||||
dirichlet_conrey_one(y, G);
|
||||
for (j = 0; j < len; j++)
|
||||
{
|
||||
acb_dirichlet_pairing_conrey(chiy, G, x, y, prec);
|
||||
acb_addmul(w1 + i, chiy, v + j, prec);
|
||||
acb_dirichlet_conrey_next(y, G);
|
||||
dirichlet_conrey_next(y, G);
|
||||
}
|
||||
acb_dirichlet_conrey_next(x, G);
|
||||
dirichlet_conrey_next(x, G);
|
||||
}
|
||||
acb_clear(chiy);
|
||||
acb_dirichlet_conrey_clear(y);
|
||||
acb_dirichlet_conrey_clear(x);
|
||||
dirichlet_conrey_clear(y);
|
||||
dirichlet_conrey_clear(x);
|
||||
|
||||
/* dft */
|
||||
acb_dirichlet_dft_conrey(w2, v, G, prec);
|
||||
|
@ -115,7 +115,7 @@ int main()
|
|||
_acb_vec_clear(w1, len);
|
||||
_acb_vec_clear(w2, len);
|
||||
|
||||
acb_dirichlet_group_clear(G);
|
||||
dirichlet_group_clear(G);
|
||||
}
|
||||
|
||||
flint_randclear(state);
|
||||
|
|
|
@ -23,25 +23,25 @@ int main()
|
|||
|
||||
for (q = 3; q < 250; q ++)
|
||||
{
|
||||
acb_dirichlet_group_t G;
|
||||
acb_dirichlet_conrey_t x;
|
||||
acb_dirichlet_char_t chi;
|
||||
dirichlet_group_t G;
|
||||
dirichlet_conrey_t x;
|
||||
dirichlet_char_t chi;
|
||||
|
||||
acb_t s1, s2, s3, s4;
|
||||
|
||||
acb_dirichlet_group_init(G, q);
|
||||
acb_dirichlet_conrey_init(x, G);
|
||||
acb_dirichlet_char_init(chi, G);
|
||||
dirichlet_group_init(G, q);
|
||||
dirichlet_conrey_init(x, G);
|
||||
dirichlet_char_init(chi, G);
|
||||
|
||||
acb_init(s1);
|
||||
acb_init(s2);
|
||||
acb_init(s3);
|
||||
acb_init(s4);
|
||||
acb_dirichlet_conrey_one(x, G);
|
||||
dirichlet_conrey_one(x, G);
|
||||
|
||||
while (1) {
|
||||
|
||||
acb_dirichlet_char_conrey(chi, G, x);
|
||||
dirichlet_char_conrey(chi, G, x);
|
||||
|
||||
acb_dirichlet_gauss_sum_naive(s1, G, chi, prec);
|
||||
acb_dirichlet_gauss_sum(s2, G, chi, prec);
|
||||
|
@ -67,7 +67,7 @@ int main()
|
|||
abort();
|
||||
}
|
||||
|
||||
if (acb_dirichlet_conrey_next(x, G) < 0)
|
||||
if (dirichlet_conrey_next(x, G) < 0)
|
||||
break;
|
||||
}
|
||||
acb_clear(s1);
|
||||
|
@ -75,9 +75,9 @@ int main()
|
|||
acb_clear(s3);
|
||||
acb_clear(s4);
|
||||
|
||||
acb_dirichlet_group_clear(G);
|
||||
acb_dirichlet_char_clear(chi);
|
||||
acb_dirichlet_conrey_clear(x);
|
||||
dirichlet_group_clear(G);
|
||||
dirichlet_char_clear(chi);
|
||||
dirichlet_conrey_clear(x);
|
||||
}
|
||||
|
||||
flint_cleanup();
|
||||
|
|
|
@ -24,24 +24,24 @@ int main()
|
|||
for (q = 29 * 29; q > 1; q = q%2 ? 3*q+1 : q/2)
|
||||
{
|
||||
slong m1, m2;
|
||||
acb_dirichlet_group_t G;
|
||||
acb_dirichlet_char_t chi1, chi2;
|
||||
dirichlet_group_t G;
|
||||
dirichlet_char_t chi1, chi2;
|
||||
|
||||
acb_t s1, s2;
|
||||
|
||||
acb_dirichlet_group_init(G, q);
|
||||
acb_dirichlet_char_init(chi1, G);
|
||||
acb_dirichlet_char_init(chi2, G);
|
||||
dirichlet_group_init(G, q);
|
||||
dirichlet_char_init(chi1, G);
|
||||
dirichlet_char_init(chi2, G);
|
||||
|
||||
acb_init(s1);
|
||||
acb_init(s2);
|
||||
|
||||
acb_dirichlet_char_one(chi1, G);
|
||||
dirichlet_char_one(chi1, G);
|
||||
|
||||
for (m1 = 0; m1 < 50; m1++)
|
||||
{
|
||||
|
||||
acb_dirichlet_char_one(chi2, G);
|
||||
dirichlet_char_one(chi2, G);
|
||||
|
||||
for (m2 = 0; m2 < 50; m2++)
|
||||
{
|
||||
|
@ -60,25 +60,25 @@ int main()
|
|||
flint_printf("\n");
|
||||
flint_printf("cond = %wu, %wu, %wu\n",
|
||||
chi1->conductor, chi2->conductor,
|
||||
acb_dirichlet_ui_conductor(G, nmod_mul(chi1->x->n, chi2->x->n, G->mod))
|
||||
dirichlet_ui_conductor(G, nmod_mul(chi1->x->n, chi2->x->n, G->mod))
|
||||
);
|
||||
abort();
|
||||
}
|
||||
if (acb_dirichlet_char_next(chi2, G) < 0)
|
||||
if (dirichlet_char_next(chi2, G) < 0)
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
if (acb_dirichlet_char_next(chi1, G) < 0)
|
||||
if (dirichlet_char_next(chi1, G) < 0)
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
acb_clear(s1);
|
||||
acb_clear(s2);
|
||||
acb_dirichlet_group_clear(G);
|
||||
acb_dirichlet_char_clear(chi1);
|
||||
acb_dirichlet_char_clear(chi2);
|
||||
dirichlet_group_clear(G);
|
||||
dirichlet_char_clear(chi1);
|
||||
dirichlet_char_clear(chi2);
|
||||
}
|
||||
|
||||
flint_cleanup();
|
||||
|
|
|
@ -19,15 +19,15 @@ test_dft(ulong q)
|
|||
{
|
||||
ulong i;
|
||||
slong prec = 100;
|
||||
acb_dirichlet_group_t G;
|
||||
acb_dirichlet_conrey_t x;
|
||||
acb_dirichlet_char_t chi;
|
||||
dirichlet_group_t G;
|
||||
dirichlet_conrey_t x;
|
||||
dirichlet_char_t chi;
|
||||
acb_t s, z;
|
||||
acb_ptr v;
|
||||
|
||||
acb_dirichlet_group_init(G, q);
|
||||
acb_dirichlet_conrey_init(x, G);
|
||||
acb_dirichlet_char_init(chi, G);
|
||||
dirichlet_group_init(G, q);
|
||||
dirichlet_conrey_init(x, G);
|
||||
dirichlet_char_init(chi, G);
|
||||
|
||||
acb_init(s);
|
||||
acb_one(s);
|
||||
|
@ -42,10 +42,10 @@ test_dft(ulong q)
|
|||
|
||||
i = 0;
|
||||
acb_init(z);
|
||||
acb_dirichlet_conrey_one(x, G);
|
||||
dirichlet_conrey_one(x, G);
|
||||
do {
|
||||
|
||||
acb_dirichlet_char_conrey(chi, G, x);
|
||||
dirichlet_char_conrey(chi, G, x);
|
||||
acb_dirichlet_l_hurwitz(z, s, G, chi, prec);
|
||||
|
||||
if (!acb_overlaps(z, v + i))
|
||||
|
@ -76,13 +76,13 @@ test_dft(ulong q)
|
|||
}
|
||||
|
||||
i++;
|
||||
} while (acb_dirichlet_conrey_next(x, G) >= 0);
|
||||
} while (dirichlet_conrey_next(x, G) >= 0);
|
||||
|
||||
acb_clear(s);
|
||||
_acb_vec_clear(v, G->phi_q);
|
||||
acb_dirichlet_char_clear(chi);
|
||||
acb_dirichlet_conrey_clear(x);
|
||||
acb_dirichlet_group_clear(G);
|
||||
dirichlet_char_clear(chi);
|
||||
dirichlet_conrey_clear(x);
|
||||
dirichlet_group_clear(G);
|
||||
}
|
||||
|
||||
int main()
|
||||
|
@ -164,13 +164,13 @@ int main()
|
|||
|
||||
for (i = 0; i < nq; i++)
|
||||
{
|
||||
acb_dirichlet_group_t G;
|
||||
acb_dirichlet_char_t chi;
|
||||
dirichlet_group_t G;
|
||||
dirichlet_char_t chi;
|
||||
|
||||
acb_dirichlet_group_init(G, q[i]);
|
||||
acb_dirichlet_char_init(chi, G);
|
||||
dirichlet_group_init(G, q[i]);
|
||||
dirichlet_char_init(chi, G);
|
||||
|
||||
acb_dirichlet_char(chi, G, m[i]);
|
||||
dirichlet_char(chi, G, m[i]);
|
||||
|
||||
for (j = 0; j < nx; j++)
|
||||
{
|
||||
|
@ -201,8 +201,8 @@ int main()
|
|||
}
|
||||
|
||||
}
|
||||
acb_dirichlet_char_clear(chi);
|
||||
acb_dirichlet_group_clear(G);
|
||||
dirichlet_char_clear(chi);
|
||||
dirichlet_group_clear(G);
|
||||
|
||||
/* test using dft */
|
||||
test_dft(q[i]);
|
||||
|
|
|
@ -27,8 +27,8 @@ int main()
|
|||
|
||||
for (q = 3; q < 1000; q ++)
|
||||
{
|
||||
acb_dirichlet_group_t G;
|
||||
acb_dirichlet_char_t chi;
|
||||
dirichlet_group_t G;
|
||||
dirichlet_char_t chi;
|
||||
ulong * v, nv, k;
|
||||
|
||||
acb_t sum;
|
||||
|
@ -41,8 +41,8 @@ int main()
|
|||
/* no primitive character mod q */
|
||||
continue;
|
||||
|
||||
acb_dirichlet_group_init(G, q);
|
||||
acb_dirichlet_char_init(chi, G);
|
||||
dirichlet_group_init(G, q);
|
||||
dirichlet_char_init(chi, G);
|
||||
|
||||
z = _acb_vec_init(G->expo);
|
||||
_acb_vec_nth_roots(z, G->expo, prec);
|
||||
|
@ -65,19 +65,19 @@ int main()
|
|||
|
||||
/* theta function on primitive characters */
|
||||
acb_init(sum);
|
||||
acb_dirichlet_char_first_primitive(chi, G);
|
||||
dirichlet_char_first_primitive(chi, G);
|
||||
|
||||
do {
|
||||
ulong m;
|
||||
acb_zero(sum);
|
||||
|
||||
acb_dirichlet_ui_chi_vec(v, G, chi, nv);
|
||||
dirichlet_ui_chi_vec(v, G, chi, nv);
|
||||
|
||||
m = G->expo / chi->order.n;
|
||||
tt = acb_dirichlet_char_parity(chi) ? kt : t;
|
||||
tt = dirichlet_char_parity(chi) ? kt : t;
|
||||
|
||||
for (k = 1; k < nv; k++)
|
||||
if (v[k] != ACB_DIRICHLET_CHI_NULL)
|
||||
if (v[k] != DIRICHLET_CHI_NULL)
|
||||
acb_addmul_arb(sum, z + (v[k] * m), tt + k, prec);
|
||||
|
||||
if ((q == 300 && (chi->x->n == 71 || chi->x->n == 131))
|
||||
|
@ -88,7 +88,7 @@ int main()
|
|||
flint_printf("FAIL: Theta(chi_%wu(%wu))=", q, chi->x->n);
|
||||
acb_printd(sum, 10);
|
||||
flint_printf("\n");
|
||||
acb_dirichlet_char_print(G, chi);
|
||||
dirichlet_char_print(G, chi);
|
||||
flint_printf("\n");
|
||||
abort();
|
||||
}
|
||||
|
@ -98,12 +98,12 @@ int main()
|
|||
flint_printf("FAIL: Theta(chi_%wu(%wu))=", q, chi->x->n);
|
||||
acb_printd(sum, 10);
|
||||
flint_printf("\n");
|
||||
acb_dirichlet_char_print(G, chi);
|
||||
dirichlet_char_print(G, chi);
|
||||
flint_printf("\n");
|
||||
abort();
|
||||
}
|
||||
|
||||
} while (acb_dirichlet_char_next_primitive(chi, G) >= 0);
|
||||
} while (dirichlet_char_next_primitive(chi, G) >= 0);
|
||||
|
||||
_acb_vec_clear(z, G->expo);
|
||||
_arb_vec_clear(kt, nv);
|
||||
|
@ -111,8 +111,8 @@ int main()
|
|||
acb_clear(sum);
|
||||
arb_clear(eq);
|
||||
flint_free(v);
|
||||
acb_dirichlet_group_clear(G);
|
||||
acb_dirichlet_char_clear(chi);
|
||||
dirichlet_group_clear(G);
|
||||
dirichlet_char_clear(chi);
|
||||
}
|
||||
|
||||
flint_cleanup();
|
||||
|
|
|
@ -30,27 +30,27 @@ int main()
|
|||
|
||||
for (q = 2; q < 600; q ++)
|
||||
{
|
||||
acb_dirichlet_group_t G;
|
||||
acb_dirichlet_conrey_t x;
|
||||
acb_dirichlet_char_t chi;
|
||||
dirichlet_group_t G;
|
||||
dirichlet_conrey_t x;
|
||||
dirichlet_char_t chi;
|
||||
ulong * v1, * v2, nv, k;
|
||||
|
||||
acb_dirichlet_group_init(G, q);
|
||||
acb_dirichlet_conrey_init(x, G);
|
||||
acb_dirichlet_char_init(chi, G);
|
||||
dirichlet_group_init(G, q);
|
||||
dirichlet_conrey_init(x, G);
|
||||
dirichlet_char_init(chi, G);
|
||||
|
||||
nv = 100;
|
||||
v1 = flint_malloc(nv * sizeof(ulong));
|
||||
v2 = flint_malloc(nv * sizeof(ulong));
|
||||
|
||||
acb_dirichlet_conrey_one(x, G);
|
||||
dirichlet_conrey_one(x, G);
|
||||
|
||||
do {
|
||||
|
||||
acb_dirichlet_char_conrey(chi, G, x);
|
||||
dirichlet_char_conrey(chi, G, x);
|
||||
|
||||
acb_dirichlet_ui_chi_vec_loop(v1, G, chi, nv);
|
||||
acb_dirichlet_ui_chi_vec_primeloop(v2, G, chi, nv);
|
||||
dirichlet_ui_chi_vec_loop(v1, G, chi, nv);
|
||||
dirichlet_ui_chi_vec_primeloop(v2, G, chi, nv);
|
||||
|
||||
if ((k = vec_diff(v1, v2, nv)))
|
||||
{
|
||||
|
@ -59,13 +59,13 @@ int main()
|
|||
abort();
|
||||
}
|
||||
|
||||
} while (acb_dirichlet_conrey_next(x, G) >= 0);
|
||||
} while (dirichlet_conrey_next(x, G) >= 0);
|
||||
|
||||
flint_free(v1);
|
||||
flint_free(v2);
|
||||
acb_dirichlet_group_clear(G);
|
||||
acb_dirichlet_char_clear(chi);
|
||||
acb_dirichlet_conrey_clear(x);
|
||||
dirichlet_group_clear(G);
|
||||
dirichlet_char_clear(chi);
|
||||
dirichlet_conrey_clear(x);
|
||||
}
|
||||
|
||||
flint_cleanup();
|
||||
|
|
|
@ -13,13 +13,13 @@
|
|||
#include "acb_poly.h"
|
||||
|
||||
void
|
||||
_acb_dirichlet_theta_arb_smallorder(acb_t res, const acb_dirichlet_group_t G, const acb_dirichlet_char_t chi, const arb_t xt, slong len, slong prec)
|
||||
_acb_dirichlet_theta_arb_smallorder(acb_t res, const dirichlet_group_t G, const dirichlet_char_t chi, const arb_t xt, slong len, slong prec)
|
||||
{
|
||||
ulong * a;
|
||||
acb_dirichlet_powers_t z;
|
||||
|
||||
a = flint_malloc(len * sizeof(ulong));
|
||||
acb_dirichlet_ui_chi_vec(a, G, chi, len);
|
||||
dirichlet_ui_chi_vec(a, G, chi, len);
|
||||
|
||||
_acb_dirichlet_powers_init(z, chi->order.n, 0, 0, prec);
|
||||
acb_dirichlet_qseries_arb_powers_smallorder(res, xt, chi->parity, a, z, len, prec);
|
||||
|
@ -29,7 +29,7 @@ _acb_dirichlet_theta_arb_smallorder(acb_t res, const acb_dirichlet_group_t G, co
|
|||
}
|
||||
|
||||
void
|
||||
_acb_dirichlet_theta_arb_series(acb_t res, const acb_dirichlet_group_t G, const acb_dirichlet_char_t chi, const arb_t xt, slong len, slong prec)
|
||||
_acb_dirichlet_theta_arb_series(acb_t res, const dirichlet_group_t G, const dirichlet_char_t chi, const arb_t xt, slong len, slong prec)
|
||||
{
|
||||
acb_ptr a;
|
||||
a = _acb_vec_init(len);
|
||||
|
@ -45,13 +45,13 @@ _acb_dirichlet_theta_arb_series(acb_t res, const acb_dirichlet_group_t G, const
|
|||
}
|
||||
|
||||
void
|
||||
_acb_dirichlet_theta_arb_naive(acb_t res, const acb_dirichlet_group_t G, const acb_dirichlet_char_t chi, const arb_t xt, slong len, slong prec)
|
||||
_acb_dirichlet_theta_arb_naive(acb_t res, const dirichlet_group_t G, const dirichlet_char_t chi, const arb_t xt, slong len, slong prec)
|
||||
{
|
||||
ulong * a;
|
||||
acb_dirichlet_powers_t z;
|
||||
|
||||
a = flint_malloc(len * sizeof(ulong));
|
||||
acb_dirichlet_ui_chi_vec(a, G, chi, len);
|
||||
dirichlet_ui_chi_vec(a, G, chi, len);
|
||||
|
||||
acb_dirichlet_powers_init(z, chi->order.n, len, prec);
|
||||
|
||||
|
@ -62,7 +62,7 @@ _acb_dirichlet_theta_arb_naive(acb_t res, const acb_dirichlet_group_t G, const a
|
|||
}
|
||||
|
||||
void
|
||||
acb_dirichlet_theta_arb(acb_t res, const acb_dirichlet_group_t G, const acb_dirichlet_char_t chi, const arb_t t, slong prec)
|
||||
acb_dirichlet_theta_arb(acb_t res, const dirichlet_group_t G, const dirichlet_char_t chi, const arb_t t, slong prec)
|
||||
{
|
||||
slong len;
|
||||
arb_t xt;
|
||||
|
|
|
@ -12,14 +12,14 @@
|
|||
#include "acb_dirichlet.h"
|
||||
|
||||
void
|
||||
acb_dirichlet_ui_theta_arb(acb_t res, const acb_dirichlet_group_t G, ulong a, const arb_t t, slong prec)
|
||||
acb_dirichlet_ui_theta_arb(acb_t res, const dirichlet_group_t G, ulong a, const arb_t t, slong prec)
|
||||
{
|
||||
acb_dirichlet_char_t chi;
|
||||
dirichlet_char_t chi;
|
||||
|
||||
acb_dirichlet_char_init(chi, G);
|
||||
acb_dirichlet_char(chi, G, a);
|
||||
dirichlet_char_init(chi, G);
|
||||
dirichlet_char(chi, G, a);
|
||||
|
||||
acb_dirichlet_theta_arb(res, G, chi, t, prec);
|
||||
|
||||
acb_dirichlet_char_clear(chi);
|
||||
dirichlet_char_clear(chi);
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
#include "acb_dirichlet.h"
|
||||
|
||||
void
|
||||
acb_dirichlet_vec_mellin_arb(acb_ptr res, const acb_dirichlet_group_t G, const acb_dirichlet_char_t chi, slong len, const arb_t t, slong n, slong prec)
|
||||
acb_dirichlet_vec_mellin_arb(acb_ptr res, const dirichlet_group_t G, const dirichlet_char_t chi, slong len, const arb_t t, slong n, slong prec)
|
||||
{
|
||||
slong k;
|
||||
arb_t tk, xt, stk, st;
|
||||
|
|
232
dirichlet.h
Normal file
232
dirichlet.h
Normal file
|
@ -0,0 +1,232 @@
|
|||
/*
|
||||
Copyright (C) 2016 Pascal Molin
|
||||
|
||||
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/>.
|
||||
*/
|
||||
|
||||
#ifndef DIRICHLET_H
|
||||
#define DIRICHLET_H
|
||||
|
||||
#ifdef DIRICHLET_INLINES_C
|
||||
#define DIRICHLET_INLINE
|
||||
#else
|
||||
#define DIRICHLET_INLINE static __inline__
|
||||
#endif
|
||||
|
||||
#include "acb.h"
|
||||
#include "dlog.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* should this dlog pointer be in the prime or the global group? */
|
||||
typedef struct
|
||||
{
|
||||
ulong p; /* underlying prime */
|
||||
int e; /* exponent */
|
||||
nmod_t pe; /* modulus */
|
||||
ulong phi; /* phi(p^e) */
|
||||
ulong g; /* conrey generator */
|
||||
dlog_precomp_struct * dlog; /* precomputed data for discrete log mod p^e */
|
||||
}
|
||||
dirichlet_prime_group_struct;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
ulong q; /* modulus */
|
||||
ulong q_even; /* even part of modulus */
|
||||
nmod_t mod; /* modulus with precomputed inverse */
|
||||
ulong rad_q; /* radical = product of odd primes */
|
||||
ulong phi_q; /* phi(q) = group size */
|
||||
slong neven; /* number of even components (in 0,1,2)*/
|
||||
slong num; /* number of prime components (even + odd) */
|
||||
ulong expo; /* exponent = largest order in G */
|
||||
dirichlet_prime_group_struct * P;
|
||||
ulong * generators; /* generators lifted mod q */
|
||||
ulong * PHI; /* PHI(k) = expo / phi(k) */
|
||||
}
|
||||
dirichlet_group_struct;
|
||||
|
||||
typedef dirichlet_group_struct dirichlet_group_t[1];
|
||||
|
||||
DIRICHLET_INLINE ulong
|
||||
dirichlet_group_size(const dirichlet_group_t G)
|
||||
{
|
||||
return G->phi_q;
|
||||
}
|
||||
|
||||
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);
|
||||
void dirichlet_group_dlog_precompute(dirichlet_group_t G, ulong num);
|
||||
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_ui_conductor(const dirichlet_group_t G, ulong a);
|
||||
int dirichlet_ui_parity(const dirichlet_group_t G, ulong a);
|
||||
ulong dirichlet_ui_order(const dirichlet_group_t G, ulong a);
|
||||
|
||||
/* elements of the group, keep both number and log */
|
||||
typedef struct
|
||||
{
|
||||
ulong n; /* number */
|
||||
ulong * log; /* s.t. prod generators[k]^log[k] = number */
|
||||
}
|
||||
dirichlet_conrey_struct;
|
||||
|
||||
typedef dirichlet_conrey_struct dirichlet_conrey_t[1];
|
||||
|
||||
void dirichlet_conrey_init(dirichlet_conrey_t x, const dirichlet_group_t G);
|
||||
void dirichlet_conrey_clear(dirichlet_conrey_t x);
|
||||
void dirichlet_conrey_print(const dirichlet_group_t G, const dirichlet_conrey_t x);
|
||||
|
||||
DIRICHLET_INLINE void
|
||||
dirichlet_conrey_set(dirichlet_conrey_t x, const dirichlet_group_t G, const dirichlet_conrey_t y)
|
||||
{
|
||||
slong k;
|
||||
x->n = y->n;
|
||||
for (k = 0; k < G->num; k++)
|
||||
x->log[k] = y->log[k];
|
||||
}
|
||||
|
||||
DIRICHLET_INLINE int
|
||||
dirichlet_conrey_eq(const dirichlet_conrey_t x, const dirichlet_conrey_t y)
|
||||
{
|
||||
return (x->n == y->n);
|
||||
}
|
||||
|
||||
int dirichlet_conrey_eq_deep(const dirichlet_group_t G, const dirichlet_conrey_t x, const dirichlet_conrey_t y);
|
||||
int dirichlet_conrey_parity(const dirichlet_group_t G, const dirichlet_conrey_t x);
|
||||
ulong dirichlet_conrey_conductor(const dirichlet_group_t G, const dirichlet_conrey_t x);
|
||||
ulong dirichlet_conrey_order(const dirichlet_group_t G, const dirichlet_conrey_t x);
|
||||
|
||||
void dirichlet_conrey_log(dirichlet_conrey_t x, const dirichlet_group_t G, ulong m);
|
||||
ulong dirichlet_conrey_exp(dirichlet_conrey_t x, const dirichlet_group_t G);
|
||||
|
||||
void dirichlet_conrey_index(dirichlet_conrey_t x, const dirichlet_group_t G, ulong j);
|
||||
ulong dirichlet_index_conrey(const dirichlet_group_t G, const dirichlet_conrey_t x);
|
||||
|
||||
void dirichlet_conrey_one(dirichlet_conrey_t x, const dirichlet_group_t G);
|
||||
void dirichlet_conrey_first_primitive(dirichlet_conrey_t x, const dirichlet_group_t G);
|
||||
|
||||
int dirichlet_conrey_next(dirichlet_conrey_t x, const dirichlet_group_t G);
|
||||
int dirichlet_conrey_next_primitive(dirichlet_conrey_t x, const dirichlet_group_t G);
|
||||
|
||||
void dirichlet_conrey_mul(dirichlet_conrey_t c, const dirichlet_group_t G, const dirichlet_conrey_t a, const dirichlet_conrey_t b);
|
||||
void dirichlet_conrey_pow(dirichlet_conrey_t c, const dirichlet_group_t G, const dirichlet_conrey_t a, ulong n);
|
||||
void dirichlet_conrey_primitive(dirichlet_conrey_t y, const dirichlet_group_t G, const dirichlet_conrey_t x, ulong cond);
|
||||
|
||||
#define DIRICHLET_CHI_NULL UWORD_MAX
|
||||
|
||||
ulong dirichlet_ui_pairing_conrey(const dirichlet_group_t G, const dirichlet_conrey_t a, const dirichlet_conrey_t b);
|
||||
ulong dirichlet_ui_pairing(const dirichlet_group_t G, ulong m, ulong n);
|
||||
|
||||
void dirichlet_pairing_conrey(acb_t res, const dirichlet_group_t G, const dirichlet_conrey_t a, const dirichlet_conrey_t b, slong prec);
|
||||
void dirichlet_pairing(acb_t res, const dirichlet_group_t G, ulong m, ulong n, slong prec);
|
||||
|
||||
/* introducing character type */
|
||||
|
||||
/* character = reduced exponents, keep order, number and conductor */
|
||||
typedef struct
|
||||
{
|
||||
ulong q; /* modulus */
|
||||
nmod_t order; /* order */
|
||||
dirichlet_conrey_t x;
|
||||
ulong * expo; /* reduced exponents ( log[k] * PHI[k] / gcd( ) ) */
|
||||
int parity; /* 0 for even char, 1 for odd */
|
||||
ulong conductor;
|
||||
}
|
||||
dirichlet_char_struct;
|
||||
|
||||
typedef dirichlet_char_struct dirichlet_char_t[1];
|
||||
|
||||
DIRICHLET_INLINE ulong
|
||||
dirichlet_char_order(const dirichlet_char_t chi)
|
||||
{
|
||||
return chi->order.n;
|
||||
}
|
||||
|
||||
DIRICHLET_INLINE ulong
|
||||
dirichlet_char_conductor(const dirichlet_char_t chi)
|
||||
{
|
||||
return chi->conductor;
|
||||
}
|
||||
|
||||
DIRICHLET_INLINE int
|
||||
dirichlet_char_parity(const dirichlet_char_t chi)
|
||||
{
|
||||
return chi->parity;
|
||||
}
|
||||
|
||||
void dirichlet_char_init(dirichlet_char_t chi, const dirichlet_group_t G);
|
||||
void dirichlet_char_clear(dirichlet_char_t chi);
|
||||
void dirichlet_char_print(const dirichlet_group_t G, const dirichlet_char_t chi);
|
||||
|
||||
DIRICHLET_INLINE void
|
||||
dirichlet_char_set(dirichlet_char_t chi1, const dirichlet_group_t G, const dirichlet_char_t chi2)
|
||||
{
|
||||
slong k;
|
||||
|
||||
chi1->q = chi2->q;
|
||||
chi1->conductor = chi2->conductor;
|
||||
chi1->order = chi2->order;
|
||||
chi1->parity = chi2->parity;
|
||||
dirichlet_conrey_set(chi1->x, G, chi2->x);
|
||||
for (k = 0; k < G->num; k++)
|
||||
chi1->expo[k] = chi2->expo[k];
|
||||
}
|
||||
|
||||
DIRICHLET_INLINE int
|
||||
dirichlet_char_eq(const dirichlet_char_t chi1, const dirichlet_char_t chi2)
|
||||
{
|
||||
return (chi1->q == chi2->q && chi1->x->n == chi2->x->n);
|
||||
}
|
||||
|
||||
int dirichlet_char_eq_deep(const dirichlet_group_t G, const dirichlet_char_t chi1, const dirichlet_char_t chi2);
|
||||
DIRICHLET_INLINE int
|
||||
dirichlet_char_is_principal(const dirichlet_char_t chi)
|
||||
{
|
||||
return (chi->x->n == 1);
|
||||
}
|
||||
DIRICHLET_INLINE int
|
||||
dirichlet_char_is_real(const dirichlet_char_t chi)
|
||||
{
|
||||
return (chi->order.n <= 2);
|
||||
}
|
||||
|
||||
void dirichlet_char(dirichlet_char_t chi, const dirichlet_group_t G, ulong n);
|
||||
void dirichlet_char_conrey(dirichlet_char_t chi, const dirichlet_group_t G, const dirichlet_conrey_t x);
|
||||
void dirichlet_char_set_expo(dirichlet_char_t chi, const dirichlet_group_t G);
|
||||
void dirichlet_char_normalize(dirichlet_char_t chi, const dirichlet_group_t G);
|
||||
void dirichlet_char_denormalize(dirichlet_char_t chi, const dirichlet_group_t G);
|
||||
|
||||
void dirichlet_char_mul(dirichlet_char_t chi12, const dirichlet_group_t G, const dirichlet_char_t chi1, const dirichlet_char_t chi2);
|
||||
void dirichlet_char_primitive(dirichlet_char_t chi0, const dirichlet_group_t G0, const dirichlet_group_t G, const dirichlet_char_t chi);
|
||||
|
||||
void dirichlet_char_one(dirichlet_char_t chi, const dirichlet_group_t G);
|
||||
void dirichlet_char_first_primitive(dirichlet_char_t chi, const dirichlet_group_t G);
|
||||
|
||||
int dirichlet_char_next(dirichlet_char_t chi, const dirichlet_group_t G);
|
||||
int dirichlet_char_next_primitive(dirichlet_char_t chi, const dirichlet_group_t G);
|
||||
|
||||
ulong dirichlet_ui_chi_conrey(const dirichlet_group_t G, const dirichlet_char_t chi, const dirichlet_conrey_t x);
|
||||
ulong dirichlet_ui_chi(const dirichlet_group_t G, const dirichlet_char_t chi, ulong n);
|
||||
|
||||
void dirichlet_ui_vec_set_null(ulong *v, const dirichlet_group_t G, slong nv);
|
||||
void dirichlet_ui_chi_vec_loop(ulong *v, const dirichlet_group_t G, const dirichlet_char_t chi, slong nv);
|
||||
void dirichlet_ui_chi_vec_primeloop(ulong *v, const dirichlet_group_t G, const dirichlet_char_t chi, slong nv);
|
||||
void dirichlet_ui_chi_vec(ulong *v, const dirichlet_group_t G, const dirichlet_char_t chi, slong nv);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -9,11 +9,11 @@
|
|||
(at your option) any later version. See <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "acb_dirichlet.h"
|
||||
#include "dirichlet.h"
|
||||
|
||||
void
|
||||
acb_dirichlet_char(acb_dirichlet_char_t chi, const acb_dirichlet_group_t G, ulong n)
|
||||
dirichlet_char(dirichlet_char_t chi, const dirichlet_group_t G, ulong n)
|
||||
{
|
||||
acb_dirichlet_conrey_log(chi->x, G, n);
|
||||
acb_dirichlet_char_conrey(chi, G, NULL);
|
||||
dirichlet_conrey_log(chi->x, G, n);
|
||||
dirichlet_char_conrey(chi, G, NULL);
|
||||
}
|
|
@ -9,11 +9,11 @@
|
|||
(at your option) any later version. See <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "acb_dirichlet.h"
|
||||
#include "dirichlet.h"
|
||||
|
||||
void
|
||||
acb_dirichlet_char_clear(acb_dirichlet_char_t chi)
|
||||
dirichlet_char_clear(dirichlet_char_t chi)
|
||||
{
|
||||
acb_dirichlet_conrey_clear(chi->x);
|
||||
dirichlet_conrey_clear(chi->x);
|
||||
flint_free(chi->expo);
|
||||
}
|
|
@ -9,24 +9,24 @@
|
|||
(at your option) any later version. See <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "acb_dirichlet.h"
|
||||
#include "dirichlet.h"
|
||||
|
||||
/* char n has exponents = log[k]*PHI[k] / gcd and order expo / gcd
|
||||
* so that log = expo[k] */
|
||||
void
|
||||
acb_dirichlet_char_conrey(acb_dirichlet_char_t chi, const acb_dirichlet_group_t G, const acb_dirichlet_conrey_t x)
|
||||
dirichlet_char_conrey(dirichlet_char_t chi, const dirichlet_group_t G, const dirichlet_conrey_t x)
|
||||
{
|
||||
/* assume chi->x already set if x == NULL */
|
||||
if (x == NULL)
|
||||
x = chi->x;
|
||||
else
|
||||
acb_dirichlet_conrey_set(chi->x, G, x);
|
||||
dirichlet_conrey_set(chi->x, G, x);
|
||||
|
||||
chi->q = G->q;
|
||||
chi->parity = acb_dirichlet_conrey_parity(G, x);
|
||||
chi->conductor = acb_dirichlet_conrey_conductor(G, x);
|
||||
chi->parity = dirichlet_conrey_parity(G, x);
|
||||
chi->conductor = dirichlet_conrey_conductor(G, x);
|
||||
|
||||
acb_dirichlet_char_set_expo(chi, G);
|
||||
dirichlet_char_set_expo(chi, G);
|
||||
/* optional: divide by gcd to obtain true order */
|
||||
acb_dirichlet_char_normalize(chi, G);
|
||||
dirichlet_char_normalize(chi, G);
|
||||
}
|
|
@ -9,12 +9,12 @@
|
|||
(at your option) any later version. See <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "acb_dirichlet.h"
|
||||
#include "dirichlet.h"
|
||||
|
||||
int
|
||||
acb_dirichlet_char_eq_deep(const acb_dirichlet_group_t G, const acb_dirichlet_char_t chi1, const acb_dirichlet_char_t chi2)
|
||||
dirichlet_char_eq_deep(const dirichlet_group_t G, const dirichlet_char_t chi1, const dirichlet_char_t chi2)
|
||||
{
|
||||
acb_dirichlet_conrey_t x, y;
|
||||
dirichlet_conrey_t x, y;
|
||||
|
||||
if (chi1->q != chi2->q)
|
||||
return 0;
|
||||
|
@ -25,13 +25,13 @@ acb_dirichlet_char_eq_deep(const acb_dirichlet_group_t G, const acb_dirichlet_ch
|
|||
if (chi1->conductor != chi2->conductor)
|
||||
return 0;
|
||||
|
||||
if (!acb_dirichlet_conrey_eq_deep(G, chi1->x, chi2->x))
|
||||
if (!dirichlet_conrey_eq_deep(G, chi1->x, chi2->x))
|
||||
return 0;
|
||||
|
||||
x->n = y->n = 1;
|
||||
x->log = chi1->expo;
|
||||
y->log = chi2->expo;
|
||||
if (!acb_dirichlet_conrey_eq_deep(G, x, y))
|
||||
if (!dirichlet_conrey_eq_deep(G, x, y))
|
||||
return 0;
|
||||
|
||||
return 1;
|
|
@ -9,12 +9,12 @@
|
|||
(at your option) any later version. See <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "acb_dirichlet.h"
|
||||
#include "dirichlet.h"
|
||||
|
||||
void
|
||||
acb_dirichlet_char_first_primitive(acb_dirichlet_char_t chi, const acb_dirichlet_group_t G)
|
||||
dirichlet_char_first_primitive(dirichlet_char_t chi, const dirichlet_group_t G)
|
||||
{
|
||||
acb_dirichlet_conrey_first_primitive(chi->x, G);
|
||||
acb_dirichlet_char_conrey(chi, G, NULL);
|
||||
acb_dirichlet_char_normalize(chi, G);
|
||||
dirichlet_conrey_first_primitive(chi->x, G);
|
||||
dirichlet_char_conrey(chi, G, NULL);
|
||||
dirichlet_char_normalize(chi, G);
|
||||
}
|
|
@ -9,13 +9,13 @@
|
|||
(at your option) any later version. See <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "acb_dirichlet.h"
|
||||
#include "dirichlet.h"
|
||||
|
||||
void
|
||||
acb_dirichlet_char_init(acb_dirichlet_char_t chi, const acb_dirichlet_group_t G)
|
||||
dirichlet_char_init(dirichlet_char_t chi, const dirichlet_group_t G)
|
||||
{
|
||||
slong k;
|
||||
acb_dirichlet_conrey_init(chi->x, G);
|
||||
dirichlet_conrey_init(chi->x, G);
|
||||
chi->expo = flint_malloc(G->num * sizeof(ulong));
|
||||
chi->q = G->q;
|
||||
chi->conductor = 1;
|
19
dirichlet/char_mul.c
Normal file
19
dirichlet/char_mul.c
Normal file
|
@ -0,0 +1,19 @@
|
|||
/*
|
||||
Copyright (C) 2016 Pascal Molin
|
||||
|
||||
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 "dirichlet.h"
|
||||
|
||||
void
|
||||
dirichlet_char_mul(dirichlet_char_t chi12, const dirichlet_group_t G, const dirichlet_char_t chi1, const dirichlet_char_t chi2)
|
||||
{
|
||||
dirichlet_conrey_mul(chi12->x, G, chi1->x, chi2->x);
|
||||
dirichlet_char_conrey(chi12, G, NULL);
|
||||
}
|
|
@ -9,14 +9,14 @@
|
|||
(at your option) any later version. See <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "acb_dirichlet.h"
|
||||
#include "dirichlet.h"
|
||||
|
||||
int
|
||||
acb_dirichlet_char_next(acb_dirichlet_char_t chi, const acb_dirichlet_group_t G)
|
||||
dirichlet_char_next(dirichlet_char_t chi, const dirichlet_group_t G)
|
||||
{
|
||||
int k;
|
||||
k = acb_dirichlet_conrey_next(chi->x, G);
|
||||
acb_dirichlet_char_conrey(chi, G, NULL);
|
||||
k = dirichlet_conrey_next(chi->x, G);
|
||||
dirichlet_char_conrey(chi, G, NULL);
|
||||
/* return last index modified */
|
||||
return k;
|
||||
}
|
|
@ -9,14 +9,14 @@
|
|||
(at your option) any later version. See <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "acb_dirichlet.h"
|
||||
#include "dirichlet.h"
|
||||
|
||||
int
|
||||
acb_dirichlet_char_next_primitive(acb_dirichlet_char_t chi, const acb_dirichlet_group_t G)
|
||||
dirichlet_char_next_primitive(dirichlet_char_t chi, const dirichlet_group_t G)
|
||||
{
|
||||
int k;
|
||||
k = acb_dirichlet_conrey_next_primitive(chi->x, G);
|
||||
acb_dirichlet_char_conrey(chi, G, NULL);
|
||||
k = dirichlet_conrey_next_primitive(chi->x, G);
|
||||
dirichlet_char_conrey(chi, G, NULL);
|
||||
/* return last index modified */
|
||||
return k;
|
||||
}
|
|
@ -9,10 +9,10 @@
|
|||
(at your option) any later version. See <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "acb_dirichlet.h"
|
||||
#include "dirichlet.h"
|
||||
|
||||
void
|
||||
acb_dirichlet_char_set_expo(acb_dirichlet_char_t chi, const acb_dirichlet_group_t G)
|
||||
dirichlet_char_set_expo(dirichlet_char_t chi, const dirichlet_group_t G)
|
||||
{
|
||||
slong k;
|
||||
for (k = 0; k < G->num; k++)
|
||||
|
@ -21,7 +21,7 @@ acb_dirichlet_char_set_expo(acb_dirichlet_char_t chi, const acb_dirichlet_group_
|
|||
}
|
||||
|
||||
void
|
||||
acb_dirichlet_char_normalize(acb_dirichlet_char_t chi, const acb_dirichlet_group_t G)
|
||||
dirichlet_char_normalize(dirichlet_char_t chi, const dirichlet_group_t G)
|
||||
{
|
||||
ulong k, g;
|
||||
g = G->expo;
|
||||
|
@ -36,7 +36,7 @@ acb_dirichlet_char_normalize(acb_dirichlet_char_t chi, const acb_dirichlet_group
|
|||
}
|
||||
|
||||
void
|
||||
acb_dirichlet_char_denormalize(acb_dirichlet_char_t chi, const acb_dirichlet_group_t G)
|
||||
dirichlet_char_denormalize(dirichlet_char_t chi, const dirichlet_group_t G)
|
||||
{
|
||||
ulong k, g;
|
||||
g = G->expo / chi->order.n;
|
|
@ -9,13 +9,13 @@
|
|||
(at your option) any later version. See <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "acb_dirichlet.h"
|
||||
#include "dirichlet.h"
|
||||
|
||||
void
|
||||
acb_dirichlet_char_one(acb_dirichlet_char_t chi, const acb_dirichlet_group_t G)
|
||||
dirichlet_char_one(dirichlet_char_t chi, const dirichlet_group_t G)
|
||||
{
|
||||
slong k;
|
||||
acb_dirichlet_conrey_one(chi->x, G);
|
||||
dirichlet_conrey_one(chi->x, G);
|
||||
chi->q = G->q;
|
||||
chi->conductor = 1;
|
||||
chi->parity = 0;
|
|
@ -9,16 +9,16 @@
|
|||
(at your option) any later version. See <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "acb_dirichlet.h"
|
||||
#include "dirichlet.h"
|
||||
|
||||
void
|
||||
acb_dirichlet_char_primitive(acb_dirichlet_char_t chi0, const acb_dirichlet_group_t G0, const acb_dirichlet_group_t G, const acb_dirichlet_char_t chi)
|
||||
dirichlet_char_primitive(dirichlet_char_t chi0, const dirichlet_group_t G0, const dirichlet_group_t G, const dirichlet_char_t chi)
|
||||
{
|
||||
chi0->q = chi->conductor;
|
||||
chi0->parity = chi->parity;
|
||||
chi0->conductor = chi->conductor;
|
||||
acb_dirichlet_conrey_primitive(chi0->x, G, chi->x, chi->conductor);
|
||||
acb_dirichlet_char_set_expo(chi0, G0);
|
||||
dirichlet_conrey_primitive(chi0->x, G, chi->x, chi->conductor);
|
||||
dirichlet_char_set_expo(chi0, G0);
|
||||
/* optional: divide by gcd to obtain true order */
|
||||
acb_dirichlet_char_normalize(chi0, G0);
|
||||
dirichlet_char_normalize(chi0, G0);
|
||||
}
|
|
@ -9,15 +9,15 @@
|
|||
(at your option) any later version. See <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "acb_dirichlet.h"
|
||||
#include "dirichlet.h"
|
||||
|
||||
void
|
||||
acb_dirichlet_char_print(const acb_dirichlet_group_t G, const acb_dirichlet_char_t chi)
|
||||
dirichlet_char_print(const dirichlet_group_t G, const dirichlet_char_t chi)
|
||||
{
|
||||
acb_dirichlet_conrey_t x;
|
||||
dirichlet_conrey_t x;
|
||||
flint_printf("chi_%wu(%wu,.) of order %wu, parity %wd, index ", G->q, chi->x->n, chi->order, chi->parity);
|
||||
acb_dirichlet_conrey_print(G, chi->x);
|
||||
dirichlet_conrey_print(G, chi->x);
|
||||
flint_printf(" and exponents ");
|
||||
x->log = chi->expo;
|
||||
acb_dirichlet_conrey_print(G, x);
|
||||
dirichlet_conrey_print(G, x);
|
||||
}
|
|
@ -9,15 +9,15 @@
|
|||
(at your option) any later version. See <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "acb_dirichlet.h"
|
||||
#include "dirichlet.h"
|
||||
|
||||
void
|
||||
acb_dirichlet_conrey_init(acb_dirichlet_conrey_t x, const acb_dirichlet_group_t G) {
|
||||
dirichlet_conrey_init(dirichlet_conrey_t x, const dirichlet_group_t G) {
|
||||
x->log = flint_malloc(G->num * sizeof(ulong));
|
||||
acb_dirichlet_conrey_one(x, G);
|
||||
dirichlet_conrey_one(x, G);
|
||||
}
|
||||
|
||||
void
|
||||
acb_dirichlet_conrey_clear(acb_dirichlet_conrey_t x) {
|
||||
dirichlet_conrey_clear(dirichlet_conrey_t x) {
|
||||
flint_free(x->log);
|
||||
}
|
|
@ -9,10 +9,10 @@
|
|||
(at your option) any later version. See <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "acb_dirichlet.h"
|
||||
#include "dirichlet.h"
|
||||
|
||||
ulong
|
||||
acb_dirichlet_conrey_conductor(const acb_dirichlet_group_t G, const acb_dirichlet_conrey_t x)
|
||||
dirichlet_conrey_conductor(const dirichlet_group_t G, const dirichlet_conrey_t x)
|
||||
{
|
||||
int k, f;
|
||||
ulong cond = 1;
|
|
@ -9,10 +9,10 @@
|
|||
(at your option) any later version. See <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "acb_dirichlet.h"
|
||||
#include "dirichlet.h"
|
||||
|
||||
int
|
||||
acb_dirichlet_conrey_eq_deep(const acb_dirichlet_group_t G, const acb_dirichlet_conrey_t x, const acb_dirichlet_conrey_t y)
|
||||
dirichlet_conrey_eq_deep(const dirichlet_group_t G, const dirichlet_conrey_t x, const dirichlet_conrey_t y)
|
||||
{
|
||||
slong k;
|
||||
|
|
@ -9,10 +9,10 @@
|
|||
(at your option) any later version. See <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "acb_dirichlet.h"
|
||||
#include "dirichlet.h"
|
||||
|
||||
ulong
|
||||
acb_dirichlet_conrey_exp(acb_dirichlet_conrey_t x, const acb_dirichlet_group_t G)
|
||||
dirichlet_conrey_exp(dirichlet_conrey_t x, const dirichlet_group_t G)
|
||||
{
|
||||
ulong k, n = 1;
|
||||
for (k = 0; k < G->num; k++)
|
|
@ -9,15 +9,15 @@
|
|||
(at your option) any later version. See <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "acb_dirichlet.h"
|
||||
#include "dirichlet.h"
|
||||
|
||||
void
|
||||
acb_dirichlet_conrey_first_primitive(acb_dirichlet_conrey_t x, const acb_dirichlet_group_t G)
|
||||
dirichlet_conrey_first_primitive(dirichlet_conrey_t x, const dirichlet_group_t G)
|
||||
{
|
||||
ulong k;
|
||||
if (G->q % 4 == 2)
|
||||
{
|
||||
flint_printf("Exception (acb_dirichlet_conrey_first_primitive). No primitive element mod %wu.\n",G->q);
|
||||
flint_printf("Exception (dirichlet_conrey_first_primitive). No primitive element mod %wu.\n",G->q);
|
||||
abort();
|
||||
}
|
||||
x->n = 1;
|
|
@ -23,10 +23,10 @@
|
|||
|
||||
******************************************************************************/
|
||||
|
||||
#include "acb_dirichlet.h"
|
||||
#include "dirichlet.h"
|
||||
|
||||
void
|
||||
acb_dirichlet_conrey_index(acb_dirichlet_conrey_t x, const acb_dirichlet_group_t G, ulong j)
|
||||
dirichlet_conrey_index(dirichlet_conrey_t x, const dirichlet_group_t G, ulong j)
|
||||
{
|
||||
slong k;
|
||||
|
||||
|
@ -36,5 +36,5 @@ acb_dirichlet_conrey_index(acb_dirichlet_conrey_t x, const acb_dirichlet_group_t
|
|||
j = j / G->P[k].phi;
|
||||
}
|
||||
|
||||
acb_dirichlet_conrey_exp(x, G);
|
||||
dirichlet_conrey_exp(x, G);
|
||||
}
|
|
@ -12,11 +12,11 @@
|
|||
*/
|
||||
|
||||
#include "dlog.h"
|
||||
#include "acb_dirichlet.h"
|
||||
#include "dirichlet.h"
|
||||
|
||||
/* assume m is invertible */
|
||||
void
|
||||
acb_dirichlet_conrey_log(acb_dirichlet_conrey_t x, const acb_dirichlet_group_t G, ulong m)
|
||||
dirichlet_conrey_log(dirichlet_conrey_t x, const dirichlet_group_t G, ulong m)
|
||||
{
|
||||
slong k;
|
||||
/* even part */
|
||||
|
@ -36,7 +36,7 @@ acb_dirichlet_conrey_log(acb_dirichlet_conrey_t x, const acb_dirichlet_group_t G
|
|||
/* odd part */
|
||||
for (k = G->neven; k < G->num; k++)
|
||||
{
|
||||
acb_dirichlet_prime_group_struct P = G->P[k];
|
||||
dirichlet_prime_group_struct P = G->P[k];
|
||||
if (P.dlog == NULL)
|
||||
{
|
||||
x->log[k] = dlog_once(m % P.pe.n, P.g, P.pe, P.phi);
|
|
@ -9,10 +9,10 @@
|
|||
(at your option) any later version. See <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "acb_dirichlet.h"
|
||||
#include "dirichlet.h"
|
||||
|
||||
void
|
||||
acb_dirichlet_conrey_mul(acb_dirichlet_conrey_t c, const acb_dirichlet_group_t G, const acb_dirichlet_conrey_t a, const acb_dirichlet_conrey_t b)
|
||||
dirichlet_conrey_mul(dirichlet_conrey_t c, const dirichlet_group_t G, const dirichlet_conrey_t a, const dirichlet_conrey_t b)
|
||||
{
|
||||
ulong k;
|
||||
for (k = 0; k < G->num ; k++)
|
|
@ -9,10 +9,10 @@
|
|||
(at your option) any later version. See <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "acb_dirichlet.h"
|
||||
#include "dirichlet.h"
|
||||
|
||||
int
|
||||
acb_dirichlet_conrey_next(acb_dirichlet_conrey_t x, const acb_dirichlet_group_t G)
|
||||
dirichlet_conrey_next(dirichlet_conrey_t x, const dirichlet_group_t G)
|
||||
{
|
||||
/* update index */
|
||||
int k;
|
|
@ -9,10 +9,10 @@
|
|||
(at your option) any later version. See <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "acb_dirichlet.h"
|
||||
#include "dirichlet.h"
|
||||
|
||||
int
|
||||
acb_dirichlet_conrey_next_primitive(acb_dirichlet_conrey_t x, const acb_dirichlet_group_t G)
|
||||
dirichlet_conrey_next_primitive(dirichlet_conrey_t x, const dirichlet_group_t G)
|
||||
{
|
||||
/* update index avoiding multiples of p except for first component
|
||||
if 8|q */
|
|
@ -9,10 +9,10 @@
|
|||
(at your option) any later version. See <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "acb_dirichlet.h"
|
||||
#include "dirichlet.h"
|
||||
|
||||
void
|
||||
acb_dirichlet_conrey_one(acb_dirichlet_conrey_t x, const acb_dirichlet_group_t G)
|
||||
dirichlet_conrey_one(dirichlet_conrey_t x, const dirichlet_group_t G)
|
||||
{
|
||||
ulong k;
|
||||
for (k = 0; k < G->num ; k++)
|
|
@ -9,10 +9,10 @@
|
|||
(at your option) any later version. See <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "acb_dirichlet.h"
|
||||
#include "dirichlet.h"
|
||||
|
||||
ulong
|
||||
acb_dirichlet_conrey_order(const acb_dirichlet_group_t G, const acb_dirichlet_conrey_t x)
|
||||
dirichlet_conrey_order(const dirichlet_group_t G, const dirichlet_conrey_t x)
|
||||
{
|
||||
ulong k, g;
|
||||
g = G->expo;
|
|
@ -9,10 +9,10 @@
|
|||
(at your option) any later version. See <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "acb_dirichlet.h"
|
||||
#include "dirichlet.h"
|
||||
|
||||
int
|
||||
acb_dirichlet_conrey_parity(const acb_dirichlet_group_t G, const acb_dirichlet_conrey_t x)
|
||||
dirichlet_conrey_parity(const dirichlet_group_t G, const dirichlet_conrey_t x)
|
||||
{
|
||||
int k, odd = 0;
|
||||
for (k = 0; k < G->num; k++)
|
|
@ -9,10 +9,10 @@
|
|||
(at your option) any later version. See <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "acb_dirichlet.h"
|
||||
#include "dirichlet.h"
|
||||
|
||||
void
|
||||
acb_dirichlet_conrey_pow(acb_dirichlet_conrey_t c, const acb_dirichlet_group_t G, const acb_dirichlet_conrey_t a, ulong n)
|
||||
dirichlet_conrey_pow(dirichlet_conrey_t c, const dirichlet_group_t G, const dirichlet_conrey_t a, ulong n)
|
||||
{
|
||||
ulong k;
|
||||
for (k = 0; k < G->num ; k++)
|
|
@ -9,10 +9,10 @@
|
|||
(at your option) any later version. See <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "acb_dirichlet.h"
|
||||
#include "dirichlet.h"
|
||||
|
||||
void
|
||||
acb_dirichlet_conrey_primitive(acb_dirichlet_conrey_t y, const acb_dirichlet_group_t G, const acb_dirichlet_conrey_t x, ulong cond)
|
||||
dirichlet_conrey_primitive(dirichlet_conrey_t y, const dirichlet_group_t G, const dirichlet_conrey_t x, ulong cond)
|
||||
{
|
||||
slong k, l;
|
||||
|
|
@ -9,10 +9,10 @@
|
|||
(at your option) any later version. See <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "acb_dirichlet.h"
|
||||
#include "dirichlet.h"
|
||||
|
||||
void
|
||||
acb_dirichlet_conrey_print(const acb_dirichlet_group_t G, const acb_dirichlet_conrey_t x)
|
||||
dirichlet_conrey_print(const dirichlet_group_t G, const dirichlet_conrey_t x)
|
||||
{
|
||||
slong k;
|
||||
if (G->num)
|
|
@ -10,10 +10,10 @@
|
|||
(at your option) any later version. See <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "acb_dirichlet.h"
|
||||
#include "dirichlet.h"
|
||||
|
||||
void
|
||||
acb_dirichlet_group_clear(acb_dirichlet_group_t G)
|
||||
dirichlet_group_clear(dirichlet_group_t G)
|
||||
{
|
||||
flint_free(G->P);
|
||||
flint_free(G->generators);
|
|
@ -9,10 +9,10 @@
|
|||
(at your option) any later version. See <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "acb_dirichlet.h"
|
||||
#include "dirichlet.h"
|
||||
|
||||
void
|
||||
acb_dirichlet_prime_group_dlog_precompute(acb_dirichlet_prime_group_struct * P, ulong num)
|
||||
dirichlet_prime_group_dlog_precompute(dirichlet_prime_group_struct * P, ulong num)
|
||||
{
|
||||
P->dlog = flint_malloc(sizeof(dlog_precomp_t));
|
||||
/* even if e = 1 use modpe struct, more flexible if reused in bigger group */
|
||||
|
@ -20,18 +20,18 @@ acb_dirichlet_prime_group_dlog_precompute(acb_dirichlet_prime_group_struct * P,
|
|||
}
|
||||
|
||||
void
|
||||
acb_dirichlet_group_dlog_precompute(acb_dirichlet_group_t G, ulong num)
|
||||
dirichlet_group_dlog_precompute(dirichlet_group_t G, ulong num)
|
||||
{
|
||||
slong k;
|
||||
for (k = 0; k < G->num; k++)
|
||||
{
|
||||
if (G->P[k].dlog == NULL)
|
||||
acb_dirichlet_prime_group_dlog_precompute(&G->P[k], num);
|
||||
dirichlet_prime_group_dlog_precompute(&G->P[k], num);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
acb_dirichlet_group_dlog_clear(acb_dirichlet_group_t G)
|
||||
dirichlet_group_dlog_clear(dirichlet_group_t G)
|
||||
{
|
||||
slong k;
|
||||
for (k = 0; k < G->num; k++)
|
|
@ -11,7 +11,7 @@
|
|||
(at your option) any later version. See <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "acb_dirichlet.h"
|
||||
#include "dirichlet.h"
|
||||
|
||||
static ulong
|
||||
primitive_root_p_and_p2(ulong p)
|
||||
|
@ -34,7 +34,7 @@ primitive_root_p_and_p2(ulong p)
|
|||
}
|
||||
|
||||
void
|
||||
acb_dirichlet_prime_group_init(acb_dirichlet_prime_group_struct * P, ulong p, int e)
|
||||
dirichlet_prime_group_init(dirichlet_prime_group_struct * P, ulong p, int e)
|
||||
{
|
||||
P->p = p;
|
||||
P->e = e;
|
||||
|
@ -66,10 +66,10 @@ acb_dirichlet_prime_group_init(acb_dirichlet_prime_group_struct * P, ulong p, in
|
|||
}
|
||||
|
||||
static void
|
||||
acb_dirichlet_group_lift_generators(acb_dirichlet_group_t G)
|
||||
dirichlet_group_lift_generators(dirichlet_group_t G)
|
||||
{
|
||||
slong k;
|
||||
acb_dirichlet_prime_group_struct * P = G->P;
|
||||
dirichlet_prime_group_struct * P = G->P;
|
||||
|
||||
G->expo = G->phi_q = 1;
|
||||
if (G->neven)
|
||||
|
@ -104,7 +104,7 @@ acb_dirichlet_group_lift_generators(acb_dirichlet_group_t G)
|
|||
}
|
||||
|
||||
void
|
||||
acb_dirichlet_group_init(acb_dirichlet_group_t G, ulong q)
|
||||
dirichlet_group_init(dirichlet_group_t G, ulong q)
|
||||
{
|
||||
slong k;
|
||||
ulong e2;
|
||||
|
@ -124,15 +124,15 @@ acb_dirichlet_group_init(acb_dirichlet_group_t G, ulong q)
|
|||
n_factor(&fac, q, 1);
|
||||
|
||||
G->num = fac.num + G->neven;
|
||||
G->P = flint_malloc(G->num * sizeof(acb_dirichlet_prime_group_struct));
|
||||
G->P = flint_malloc(G->num * sizeof(dirichlet_prime_group_struct));
|
||||
G->generators = flint_malloc(G->num * sizeof(ulong));
|
||||
G->PHI = flint_malloc(G->num * sizeof(ulong));
|
||||
|
||||
/* even part */
|
||||
if (G->neven >= 1)
|
||||
acb_dirichlet_prime_group_init(&G->P[0], 2, e2);
|
||||
dirichlet_prime_group_init(&G->P[0], 2, e2);
|
||||
if (G->neven == 2)
|
||||
acb_dirichlet_prime_group_init(&G->P[1], 4, e2);
|
||||
dirichlet_prime_group_init(&G->P[1], 4, e2);
|
||||
|
||||
/* odd part */
|
||||
G->rad_q = 1;
|
||||
|
@ -142,13 +142,13 @@ acb_dirichlet_group_init(acb_dirichlet_group_t G, ulong q)
|
|||
p = fac.p[k - G->neven];
|
||||
e = fac.exp[k - G->neven];
|
||||
G->rad_q *= p;
|
||||
acb_dirichlet_prime_group_init(&G->P[k], p, e);
|
||||
dirichlet_prime_group_init(&G->P[k], p, e);
|
||||
}
|
||||
acb_dirichlet_group_lift_generators(G);
|
||||
dirichlet_group_lift_generators(G);
|
||||
}
|
||||
|
||||
void
|
||||
acb_dirichlet_subgroup_init(acb_dirichlet_group_t H, const acb_dirichlet_group_t G, ulong h)
|
||||
dirichlet_subgroup_init(dirichlet_group_t H, const dirichlet_group_t G, ulong h)
|
||||
{
|
||||
int s[15]; /* selected components */
|
||||
slong k, j, e2;
|
||||
|
@ -185,7 +185,7 @@ acb_dirichlet_subgroup_init(acb_dirichlet_group_t H, const acb_dirichlet_group_t
|
|||
}
|
||||
|
||||
H->num = j;
|
||||
H->P = flint_malloc(j * sizeof(acb_dirichlet_prime_group_struct));
|
||||
H->P = flint_malloc(j * sizeof(dirichlet_prime_group_struct));
|
||||
H->generators = flint_malloc(j * sizeof(ulong));
|
||||
H->PHI = flint_malloc(j * sizeof(ulong));
|
||||
|
||||
|
@ -218,5 +218,5 @@ acb_dirichlet_subgroup_init(acb_dirichlet_group_t H, const acb_dirichlet_group_t
|
|||
}
|
||||
}
|
||||
|
||||
acb_dirichlet_group_lift_generators(H);
|
||||
dirichlet_group_lift_generators(H);
|
||||
}
|
|
@ -23,10 +23,10 @@
|
|||
|
||||
******************************************************************************/
|
||||
|
||||
#include "acb_dirichlet.h"
|
||||
#include "dirichlet.h"
|
||||
|
||||
ulong
|
||||
acb_dirichlet_index_conrey(const acb_dirichlet_group_t G, const acb_dirichlet_conrey_t x)
|
||||
dirichlet_index_conrey(const dirichlet_group_t G, const dirichlet_conrey_t x)
|
||||
{
|
||||
slong k;
|
||||
ulong j = 0;
|
|
@ -9,10 +9,10 @@
|
|||
(at your option) any later version. See <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "acb_dirichlet.h"
|
||||
#include "dirichlet.h"
|
||||
|
||||
ulong
|
||||
acb_dirichlet_number_primitive(const acb_dirichlet_group_t G)
|
||||
dirichlet_number_primitive(const dirichlet_group_t G)
|
||||
{
|
||||
if (G->q % 4 == 2)
|
||||
return 0;
|
|
@ -10,7 +10,7 @@
|
|||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include "acb_dirichlet.h"
|
||||
#include "dirichlet.h"
|
||||
#include "profiler.h"
|
||||
|
||||
#define LOG 0
|
||||
|
@ -38,18 +38,18 @@ do_conrey(ulong q1, ulong q2)
|
|||
|
||||
for (n = 0, q = q1; q <= q2; q++)
|
||||
{
|
||||
acb_dirichlet_group_t G;
|
||||
acb_dirichlet_conrey_t x;
|
||||
dirichlet_group_t G;
|
||||
dirichlet_conrey_t x;
|
||||
|
||||
acb_dirichlet_group_init(G, q);
|
||||
acb_dirichlet_conrey_init(x, G);
|
||||
dirichlet_group_init(G, q);
|
||||
dirichlet_conrey_init(x, G);
|
||||
|
||||
acb_dirichlet_conrey_one(x, G);
|
||||
dirichlet_conrey_one(x, G);
|
||||
n++;
|
||||
|
||||
for (; acb_dirichlet_conrey_next(x, G) >= 0; n++);
|
||||
acb_dirichlet_conrey_clear(x);
|
||||
acb_dirichlet_group_clear(G);
|
||||
for (; dirichlet_conrey_next(x, G) >= 0; n++);
|
||||
dirichlet_conrey_clear(x);
|
||||
dirichlet_group_clear(G);
|
||||
}
|
||||
|
||||
return n;
|
||||
|
@ -62,18 +62,18 @@ do_chars(ulong q1, ulong q2)
|
|||
|
||||
for (n = 0, q = q1; q <= q2; q++)
|
||||
{
|
||||
acb_dirichlet_group_t G;
|
||||
acb_dirichlet_char_t chi;
|
||||
dirichlet_group_t G;
|
||||
dirichlet_char_t chi;
|
||||
|
||||
acb_dirichlet_group_init(G, q);
|
||||
acb_dirichlet_char_init(chi, G);
|
||||
dirichlet_group_init(G, q);
|
||||
dirichlet_char_init(chi, G);
|
||||
|
||||
acb_dirichlet_char_one(chi, G);
|
||||
dirichlet_char_one(chi, G);
|
||||
n++;
|
||||
for (; acb_dirichlet_char_next(chi, G) >= 0; n++);
|
||||
for (; dirichlet_char_next(chi, G) >= 0; n++);
|
||||
|
||||
acb_dirichlet_char_clear(chi);
|
||||
acb_dirichlet_group_clear(G);
|
||||
dirichlet_char_clear(chi);
|
||||
dirichlet_group_clear(G);
|
||||
}
|
||||
|
||||
return n;
|
||||
|
@ -86,8 +86,8 @@ do_gcdpluscond(ulong q1, ulong q2)
|
|||
|
||||
for (n = 0, q = q1; q <= q2; q++)
|
||||
{
|
||||
acb_dirichlet_group_t G;
|
||||
acb_dirichlet_group_init(G, q);
|
||||
dirichlet_group_t G;
|
||||
dirichlet_group_init(G, q);
|
||||
|
||||
for (k = 1; k < q; k++)
|
||||
{
|
||||
|
@ -100,11 +100,11 @@ do_gcdpluscond(ulong q1, ulong q2)
|
|||
break;
|
||||
|
||||
if (i == G->num)
|
||||
acb_dirichlet_ui_conductor(G, k);
|
||||
dirichlet_ui_conductor(G, k);
|
||||
}
|
||||
|
||||
n += G->phi_q;
|
||||
acb_dirichlet_group_clear(G);
|
||||
dirichlet_group_clear(G);
|
||||
|
||||
}
|
||||
|
||||
|
@ -118,20 +118,20 @@ do_conreypluscond(ulong q1, ulong q2)
|
|||
|
||||
for (n = 0, q = q1; q <= q2; q++)
|
||||
{
|
||||
acb_dirichlet_group_t G;
|
||||
acb_dirichlet_conrey_t x;
|
||||
dirichlet_group_t G;
|
||||
dirichlet_conrey_t x;
|
||||
|
||||
acb_dirichlet_group_init(G, q);
|
||||
acb_dirichlet_conrey_init(x, G);
|
||||
dirichlet_group_init(G, q);
|
||||
dirichlet_conrey_init(x, G);
|
||||
|
||||
acb_dirichlet_conrey_one(x, G);
|
||||
dirichlet_conrey_one(x, G);
|
||||
n++;
|
||||
|
||||
for (; acb_dirichlet_conrey_next(x, G) >= 0; n++)
|
||||
acb_dirichlet_conrey_conductor(G, x);
|
||||
for (; dirichlet_conrey_next(x, G) >= 0; n++)
|
||||
dirichlet_conrey_conductor(G, x);
|
||||
|
||||
acb_dirichlet_conrey_clear(x);
|
||||
acb_dirichlet_group_clear(G);
|
||||
dirichlet_conrey_clear(x);
|
||||
dirichlet_group_clear(G);
|
||||
|
||||
}
|
||||
|
||||
|
@ -145,20 +145,20 @@ do_conreyplusorder(ulong q1, ulong q2)
|
|||
|
||||
for (n = 0, q = q1; q <= q2; q++)
|
||||
{
|
||||
acb_dirichlet_group_t G;
|
||||
acb_dirichlet_conrey_t x;
|
||||
dirichlet_group_t G;
|
||||
dirichlet_conrey_t x;
|
||||
|
||||
acb_dirichlet_group_init(G, q);
|
||||
acb_dirichlet_conrey_init(x, G);
|
||||
dirichlet_group_init(G, q);
|
||||
dirichlet_conrey_init(x, G);
|
||||
|
||||
acb_dirichlet_conrey_one(x, G);
|
||||
dirichlet_conrey_one(x, G);
|
||||
n++;
|
||||
|
||||
for (; acb_dirichlet_conrey_next(x, G) >= 0; n++)
|
||||
acb_dirichlet_conrey_order(G, x);
|
||||
for (; dirichlet_conrey_next(x, G) >= 0; n++)
|
||||
dirichlet_conrey_order(G, x);
|
||||
|
||||
acb_dirichlet_conrey_clear(x);
|
||||
acb_dirichlet_group_clear(G);
|
||||
dirichlet_conrey_clear(x);
|
||||
dirichlet_group_clear(G);
|
||||
|
||||
}
|
||||
|
|
@ -9,7 +9,7 @@
|
|||
(at your option) any later version. See <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "acb_dirichlet.h"
|
||||
#include "dirichlet.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
|
@ -24,19 +24,19 @@ int main()
|
|||
|
||||
for (iter = 0; iter < 50; iter++)
|
||||
{
|
||||
acb_dirichlet_group_t G;
|
||||
acb_dirichlet_conrey_t x;
|
||||
acb_dirichlet_char_t chi, chi2;
|
||||
dirichlet_group_t G;
|
||||
dirichlet_conrey_t x;
|
||||
dirichlet_char_t chi, chi2;
|
||||
ulong q, iter2;
|
||||
|
||||
q = 2 + n_randint(state, 1 << bits);
|
||||
|
||||
acb_dirichlet_group_init(G, q);
|
||||
acb_dirichlet_conrey_init(x, G);
|
||||
acb_dirichlet_char_init(chi, G);
|
||||
acb_dirichlet_char_init(chi2, G);
|
||||
dirichlet_group_init(G, q);
|
||||
dirichlet_conrey_init(x, G);
|
||||
dirichlet_char_init(chi, G);
|
||||
dirichlet_char_init(chi2, G);
|
||||
|
||||
acb_dirichlet_group_dlog_precompute(G, 50);
|
||||
dirichlet_group_dlog_precompute(G, 50);
|
||||
|
||||
/* check number char properties */
|
||||
for (iter2 = 0; iter2 < 100; iter2++)
|
||||
|
@ -49,23 +49,23 @@ int main()
|
|||
m = n_randint(state, q);
|
||||
while (n_gcd(q, m) > 1);
|
||||
|
||||
acb_dirichlet_char(chi, G, m);
|
||||
acb_dirichlet_conrey_log(x, G, m);
|
||||
acb_dirichlet_char_conrey(chi2, G, x);
|
||||
dirichlet_char(chi, G, m);
|
||||
dirichlet_conrey_log(x, G, m);
|
||||
dirichlet_char_conrey(chi2, G, x);
|
||||
|
||||
if (!acb_dirichlet_char_eq_deep(G, chi, chi2))
|
||||
if (!dirichlet_char_eq_deep(G, chi, chi2))
|
||||
{
|
||||
flint_printf("FAIL: init char\n\n");
|
||||
flint_printf("q = %wu\n\n", q);
|
||||
flint_printf("m = %wu\n\n", m);
|
||||
acb_dirichlet_char_print(G, chi);
|
||||
dirichlet_char_print(G, chi);
|
||||
flint_printf("\n");
|
||||
acb_dirichlet_char_print(G, chi2);
|
||||
dirichlet_char_print(G, chi2);
|
||||
flint_printf("\n");
|
||||
abort();
|
||||
}
|
||||
|
||||
order = acb_dirichlet_ui_order(G, m);
|
||||
order = dirichlet_ui_order(G, m);
|
||||
if (order != chi->order.n)
|
||||
{
|
||||
flint_printf("FAIL: order\n\n");
|
||||
|
@ -76,7 +76,7 @@ int main()
|
|||
abort();
|
||||
}
|
||||
|
||||
cond = acb_dirichlet_ui_conductor(G, m);
|
||||
cond = dirichlet_ui_conductor(G, m);
|
||||
if (cond != chi->conductor)
|
||||
{
|
||||
flint_printf("FAIL: conductor\n\n");
|
||||
|
@ -87,17 +87,17 @@ int main()
|
|||
abort();
|
||||
}
|
||||
|
||||
par = acb_dirichlet_ui_parity(G, m);
|
||||
chim1 = acb_dirichlet_ui_chi(G, chi, q - 1);
|
||||
if (acb_dirichlet_char_parity(chi) != par || par != (chim1 != 0))
|
||||
par = dirichlet_ui_parity(G, m);
|
||||
chim1 = dirichlet_ui_chi(G, chi, q - 1);
|
||||
if (dirichlet_char_parity(chi) != par || par != (chim1 != 0))
|
||||
{
|
||||
flint_printf("FAIL: parity\n\n");
|
||||
flint_printf("q = %wu\n\n", q);
|
||||
flint_printf("m = %wu\n\n", m);
|
||||
flint_printf("chi(-1) = %wu\n\n", chim1);
|
||||
flint_printf("char_parity = %d", acb_dirichlet_char_parity(chi));
|
||||
flint_printf("char_parity = %d", dirichlet_char_parity(chi));
|
||||
flint_printf("parity_ui = %d", par);
|
||||
acb_dirichlet_char_print(G, chi);
|
||||
dirichlet_char_print(G, chi);
|
||||
abort();
|
||||
}
|
||||
|
||||
|
@ -105,10 +105,10 @@ int main()
|
|||
n = n_randint(state, q);
|
||||
while (n_gcd(q, n) > 1);
|
||||
|
||||
acb_dirichlet_char(chi2, G, n);
|
||||
pairing = acb_dirichlet_ui_pairing(G, m, n);
|
||||
cn = acb_dirichlet_ui_chi(G, chi, n) * (G->expo / chi->order.n);
|
||||
cm = acb_dirichlet_ui_chi(G, chi2, m) * (G->expo / chi2->order.n);
|
||||
dirichlet_char(chi2, G, n);
|
||||
pairing = dirichlet_ui_pairing(G, m, n);
|
||||
cn = dirichlet_ui_chi(G, chi, n) * (G->expo / chi->order.n);
|
||||
cm = dirichlet_ui_chi(G, chi2, m) * (G->expo / chi2->order.n);
|
||||
|
||||
if (pairing != cn || pairing != cm)
|
||||
{
|
||||
|
@ -122,30 +122,30 @@ int main()
|
|||
abort();
|
||||
}
|
||||
|
||||
acb_dirichlet_conrey_next(x, G);
|
||||
acb_dirichlet_char_next(chi, G);
|
||||
acb_dirichlet_char_conrey(chi2, G, x);
|
||||
dirichlet_conrey_next(x, G);
|
||||
dirichlet_char_next(chi, G);
|
||||
dirichlet_char_conrey(chi2, G, x);
|
||||
|
||||
if (!acb_dirichlet_char_eq_deep(G, chi, chi2))
|
||||
if (!dirichlet_char_eq_deep(G, chi, chi2))
|
||||
{
|
||||
flint_printf("FAIL: next char\n\n");
|
||||
flint_printf("q = %wu\n\n", q);
|
||||
flint_printf("m = %wu\n\n", m);
|
||||
acb_dirichlet_char_print(G, chi);
|
||||
dirichlet_char_print(G, chi);
|
||||
flint_printf("\n");
|
||||
acb_dirichlet_char_print(G, chi2);
|
||||
dirichlet_char_print(G, chi2);
|
||||
flint_printf("\n");
|
||||
abort();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
acb_dirichlet_group_dlog_clear(G);
|
||||
dirichlet_group_dlog_clear(G);
|
||||
|
||||
acb_dirichlet_char_clear(chi);
|
||||
acb_dirichlet_char_clear(chi2);
|
||||
acb_dirichlet_conrey_clear(x);
|
||||
acb_dirichlet_group_clear(G);
|
||||
dirichlet_char_clear(chi);
|
||||
dirichlet_char_clear(chi2);
|
||||
dirichlet_conrey_clear(x);
|
||||
dirichlet_group_clear(G);
|
||||
}
|
||||
}
|
||||
|
|
@ -9,7 +9,7 @@
|
|||
(at your option) any later version. See <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "acb_dirichlet.h"
|
||||
#include "dirichlet.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
|
@ -22,23 +22,23 @@ int main()
|
|||
|
||||
for (iter = 0; iter < 3000 * arb_test_multiplier(); iter++)
|
||||
{
|
||||
acb_dirichlet_group_t G;
|
||||
acb_dirichlet_conrey_t x, y;
|
||||
dirichlet_group_t G;
|
||||
dirichlet_conrey_t x, y;
|
||||
ulong q, n, k, sum;
|
||||
slong ref;
|
||||
|
||||
q = 1 + n_randint(state, 1000 * (1 + iter / 100));
|
||||
|
||||
acb_dirichlet_group_init(G, q);
|
||||
dirichlet_group_init(G, q);
|
||||
|
||||
acb_dirichlet_conrey_init(x, G);
|
||||
acb_dirichlet_conrey_init(y, G);
|
||||
dirichlet_conrey_init(x, G);
|
||||
dirichlet_conrey_init(y, G);
|
||||
|
||||
/* check group size and elements */
|
||||
acb_dirichlet_conrey_one(x, G);
|
||||
dirichlet_conrey_one(x, G);
|
||||
sum = 1;
|
||||
|
||||
for (n = 1; acb_dirichlet_conrey_next(x, G) >= 0; n++)
|
||||
for (n = 1; dirichlet_conrey_next(x, G) >= 0; n++)
|
||||
sum += x->n * x->n;
|
||||
|
||||
if (FLINT_BITS == 64 || q < 1024)
|
||||
|
@ -70,10 +70,10 @@ int main()
|
|||
|
||||
if (q % 4 != 2)
|
||||
{
|
||||
acb_dirichlet_conrey_first_primitive(x, G);
|
||||
for (n = 1; acb_dirichlet_conrey_next_primitive(x, G) >= 0; n++);
|
||||
dirichlet_conrey_first_primitive(x, G);
|
||||
for (n = 1; dirichlet_conrey_next_primitive(x, G) >= 0; n++);
|
||||
|
||||
ref = acb_dirichlet_number_primitive(G);
|
||||
ref = dirichlet_number_primitive(G);
|
||||
if (n != ref)
|
||||
{
|
||||
flint_printf("FAIL: number of primitive elements\n\n");
|
||||
|
@ -90,15 +90,15 @@ int main()
|
|||
ulong m;
|
||||
|
||||
for (m = 1; n_gcd(m, q) > 1; m = n_randint(state, q));
|
||||
acb_dirichlet_conrey_log(x, G, m);
|
||||
dirichlet_conrey_log(x, G, m);
|
||||
|
||||
if (m != acb_dirichlet_conrey_exp(x, G))
|
||||
if (m != dirichlet_conrey_exp(x, G))
|
||||
{
|
||||
flint_printf("FAIL: conrey log and exp\n\n");
|
||||
flint_printf("q = %wu\n\n", q);
|
||||
flint_printf("m = %wu\n\n", m);
|
||||
flint_printf("conrey = ");
|
||||
acb_dirichlet_conrey_print(G, x);
|
||||
dirichlet_conrey_print(G, x);
|
||||
flint_printf("\n\nnumber = %wu\n\n", x->n);
|
||||
abort();
|
||||
}
|
||||
|
@ -106,34 +106,34 @@ int main()
|
|||
for (k = 0; k < G->num; k++)
|
||||
x->log[k] = n_randint(state, G->P[k].phi);
|
||||
|
||||
m = acb_dirichlet_conrey_exp(x, G);
|
||||
acb_dirichlet_conrey_log(y, G, m);
|
||||
m = dirichlet_conrey_exp(x, G);
|
||||
dirichlet_conrey_log(y, G, m);
|
||||
|
||||
if (!acb_dirichlet_conrey_eq_deep(G, x, y))
|
||||
if (!dirichlet_conrey_eq_deep(G, x, y))
|
||||
{
|
||||
flint_printf("FAIL: conrey exp and log\n\n");
|
||||
flint_printf("q = %wu\n\n", q);
|
||||
flint_printf("conrey = ");
|
||||
acb_dirichlet_conrey_print(G, x);
|
||||
dirichlet_conrey_print(G, x);
|
||||
flint_printf("\n\nm = %wu\n\n", m);
|
||||
flint_printf("log = ");
|
||||
acb_dirichlet_conrey_print(G, y);
|
||||
dirichlet_conrey_print(G, y);
|
||||
flint_printf("\n\nnumber = %wu\n\n", y->n);
|
||||
abort();
|
||||
}
|
||||
|
||||
acb_dirichlet_conrey_next_primitive(x, G);
|
||||
dirichlet_conrey_next_primitive(x, G);
|
||||
m = x->n;
|
||||
|
||||
if (m != acb_dirichlet_conrey_exp(x, G))
|
||||
if (m != dirichlet_conrey_exp(x, G))
|
||||
{
|
||||
flint_printf("FAIL: conrey number next primitive\n\n");
|
||||
flint_printf("q = %wu\n\n", q);
|
||||
flint_printf("conrey = ");
|
||||
acb_dirichlet_conrey_print(G, y);
|
||||
dirichlet_conrey_print(G, y);
|
||||
flint_printf(", m = %wu\n\n", y->n);
|
||||
flint_printf("next primitive = ");
|
||||
acb_dirichlet_conrey_print(G, x);
|
||||
dirichlet_conrey_print(G, x);
|
||||
flint_printf(", m = %wu\n\n", m);
|
||||
flint_printf("exp = %wu\n\n", x->n);
|
||||
abort();
|
||||
|
@ -141,9 +141,9 @@ int main()
|
|||
}
|
||||
}
|
||||
|
||||
acb_dirichlet_conrey_clear(x);
|
||||
acb_dirichlet_conrey_clear(y);
|
||||
acb_dirichlet_group_clear(G);
|
||||
dirichlet_conrey_clear(x);
|
||||
dirichlet_conrey_clear(y);
|
||||
dirichlet_group_clear(G);
|
||||
}
|
||||
|
||||
flint_randclear(state);
|
|
@ -9,25 +9,25 @@
|
|||
(at your option) any later version. See <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "acb_dirichlet.h"
|
||||
#include "dirichlet.h"
|
||||
|
||||
ulong
|
||||
acb_dirichlet_ui_chi(const acb_dirichlet_group_t G, const acb_dirichlet_char_t chi, ulong n)
|
||||
dirichlet_ui_chi(const dirichlet_group_t G, const dirichlet_char_t chi, ulong n)
|
||||
{
|
||||
if (n_gcd(G->q, n) > 1)
|
||||
{
|
||||
return ACB_DIRICHLET_CHI_NULL;
|
||||
return DIRICHLET_CHI_NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
ulong v;
|
||||
acb_dirichlet_conrey_t x;
|
||||
acb_dirichlet_conrey_init(x, G);
|
||||
acb_dirichlet_conrey_log(x, G, n);
|
||||
dirichlet_conrey_t x;
|
||||
dirichlet_conrey_init(x, G);
|
||||
dirichlet_conrey_log(x, G, n);
|
||||
|
||||
v = acb_dirichlet_ui_chi_conrey(G, chi, x);
|
||||
v = dirichlet_ui_chi_conrey(G, chi, x);
|
||||
|
||||
acb_dirichlet_conrey_clear(x);
|
||||
dirichlet_conrey_clear(x);
|
||||
return v;
|
||||
}
|
||||
}
|
|
@ -9,10 +9,10 @@
|
|||
(at your option) any later version. See <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "acb_dirichlet.h"
|
||||
#include "dirichlet.h"
|
||||
|
||||
ulong
|
||||
acb_dirichlet_ui_chi_conrey(const acb_dirichlet_group_t G, const acb_dirichlet_char_t chi, const acb_dirichlet_conrey_t x)
|
||||
dirichlet_ui_chi_conrey(const dirichlet_group_t G, const dirichlet_char_t chi, const dirichlet_conrey_t x)
|
||||
{
|
||||
ulong v = 0, k;
|
||||
|
|
@ -9,13 +9,13 @@
|
|||
(at your option) any later version. See <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "acb_dirichlet.h"
|
||||
#include "dirichlet.h"
|
||||
|
||||
void
|
||||
acb_dirichlet_ui_chi_vec(ulong *v, const acb_dirichlet_group_t G, const acb_dirichlet_char_t chi, slong nv)
|
||||
dirichlet_ui_chi_vec(ulong *v, const dirichlet_group_t G, const dirichlet_char_t chi, slong nv)
|
||||
{
|
||||
if (2 * nv > G->q)
|
||||
acb_dirichlet_ui_chi_vec_loop(v, G, chi, nv);
|
||||
dirichlet_ui_chi_vec_loop(v, G, chi, nv);
|
||||
else
|
||||
acb_dirichlet_ui_chi_vec_primeloop(v, G, chi, nv);
|
||||
dirichlet_ui_chi_vec_primeloop(v, G, chi, nv);
|
||||
}
|
|
@ -9,25 +9,25 @@
|
|||
(at your option) any later version. See <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "acb_dirichlet.h"
|
||||
#include "dirichlet.h"
|
||||
|
||||
/* loop over whole group */
|
||||
void
|
||||
acb_dirichlet_ui_chi_vec_loop(ulong *v, const acb_dirichlet_group_t G, const acb_dirichlet_char_t chi, slong nv)
|
||||
dirichlet_ui_chi_vec_loop(ulong *v, const dirichlet_group_t G, const dirichlet_char_t chi, slong nv)
|
||||
{
|
||||
int j;
|
||||
ulong t;
|
||||
slong k;
|
||||
acb_dirichlet_conrey_t x;
|
||||
acb_dirichlet_conrey_init(x, G);
|
||||
acb_dirichlet_conrey_one(x, G);
|
||||
dirichlet_conrey_t x;
|
||||
dirichlet_conrey_init(x, G);
|
||||
dirichlet_conrey_one(x, G);
|
||||
|
||||
for (k = 0; k < nv; k++)
|
||||
v[k] = ACB_DIRICHLET_CHI_NULL;
|
||||
v[k] = DIRICHLET_CHI_NULL;
|
||||
|
||||
t = v[1] = 0;
|
||||
|
||||
while ( (j = acb_dirichlet_conrey_next(x, G)) >= 0 )
|
||||
while ( (j = dirichlet_conrey_next(x, G)) >= 0 )
|
||||
{
|
||||
/* exponents were modified up to j */
|
||||
for (k = G->num - 1; k >= j; k--)
|
||||
|
@ -38,11 +38,11 @@ acb_dirichlet_ui_chi_vec_loop(ulong *v, const acb_dirichlet_group_t G, const acb
|
|||
}
|
||||
|
||||
/* fix result outside primes */
|
||||
/* acb_dirichlet_vec_set_null(v, G, nv);*/
|
||||
/* dirichlet_vec_set_null(v, G, nv);*/
|
||||
/* copy outside modulus */
|
||||
|
||||
for (k = G->q; k < nv ; k++ )
|
||||
v[k] = v[k - G->q];
|
||||
|
||||
acb_dirichlet_conrey_clear(x);
|
||||
dirichlet_conrey_clear(x);
|
||||
}
|
|
@ -9,10 +9,10 @@
|
|||
(at your option) any later version. See <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "acb_dirichlet.h"
|
||||
#include "dirichlet.h"
|
||||
|
||||
static void
|
||||
chi_vec_evenpart(ulong *v, const acb_dirichlet_group_t G, const acb_dirichlet_char_t chi, slong nv)
|
||||
chi_vec_evenpart(ulong *v, const dirichlet_group_t G, const dirichlet_char_t chi, slong nv)
|
||||
{
|
||||
|
||||
ulong c3, c4, x;
|
||||
|
@ -47,7 +47,7 @@ chi_vec_evenpart(ulong *v, const acb_dirichlet_group_t G, const acb_dirichlet_ch
|
|||
|
||||
/* loop over primary components */
|
||||
void
|
||||
acb_dirichlet_ui_chi_vec_primeloop(ulong *v, const acb_dirichlet_group_t G, const acb_dirichlet_char_t chi, slong nv)
|
||||
dirichlet_ui_chi_vec_primeloop(ulong *v, const dirichlet_group_t G, const dirichlet_char_t chi, slong nv)
|
||||
{
|
||||
slong k, l;
|
||||
|
||||
|
@ -59,7 +59,7 @@ acb_dirichlet_ui_chi_vec_primeloop(ulong *v, const acb_dirichlet_group_t G, cons
|
|||
|
||||
for (l = G->neven; l < G->num; l++)
|
||||
{
|
||||
acb_dirichlet_prime_group_struct P = G->P[l];
|
||||
dirichlet_prime_group_struct P = G->P[l];
|
||||
|
||||
/* FIXME: there may be some precomputed dlog in P if needed */
|
||||
if (P.dlog == NULL)
|
||||
|
@ -68,5 +68,5 @@ acb_dirichlet_ui_chi_vec_primeloop(ulong *v, const acb_dirichlet_group_t G, cons
|
|||
dlog_vec_add_precomp(v, nv, P.dlog, P.g, chi->expo[l], P.pe, P.phi, chi->order);
|
||||
|
||||
}
|
||||
acb_dirichlet_ui_vec_set_null(v, G, nv);
|
||||
dirichlet_ui_vec_set_null(v, G, nv);
|
||||
}
|
|
@ -9,10 +9,10 @@
|
|||
(at your option) any later version. See <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "acb_dirichlet.h"
|
||||
#include "dirichlet.h"
|
||||
|
||||
ulong
|
||||
acb_dirichlet_ui_conductor(const acb_dirichlet_group_t G, ulong a)
|
||||
dirichlet_ui_conductor(const dirichlet_group_t G, ulong a)
|
||||
{
|
||||
slong k;
|
||||
ulong ap, cond;
|
|
@ -9,7 +9,7 @@
|
|||
(at your option) any later version. See <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "acb_dirichlet.h"
|
||||
#include "dirichlet.h"
|
||||
|
||||
/* order of an element knowing the factorization of a multiple */
|
||||
ulong
|
||||
|
@ -31,7 +31,7 @@ nmod_order_precomp(ulong a, nmod_t mod, ulong expo, n_factor_t fac)
|
|||
}
|
||||
|
||||
ulong
|
||||
acb_dirichlet_ui_order(const acb_dirichlet_group_t G, ulong a)
|
||||
dirichlet_ui_order(const dirichlet_group_t G, ulong a)
|
||||
{
|
||||
n_factor_t fac;
|
||||
|
|
@ -9,26 +9,26 @@
|
|||
(at your option) any later version. See <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "acb_dirichlet.h"
|
||||
#include "dirichlet.h"
|
||||
|
||||
ulong
|
||||
acb_dirichlet_ui_pairing(const acb_dirichlet_group_t G, ulong m, ulong n)
|
||||
dirichlet_ui_pairing(const dirichlet_group_t G, ulong m, ulong n)
|
||||
{
|
||||
ulong x;
|
||||
acb_dirichlet_conrey_t a, b;
|
||||
dirichlet_conrey_t a, b;
|
||||
|
||||
if (n_gcd(G->q, m) > 1 || n_gcd(G->q, n) > 1)
|
||||
return ACB_DIRICHLET_CHI_NULL;
|
||||
return DIRICHLET_CHI_NULL;
|
||||
|
||||
acb_dirichlet_conrey_init(a, G);
|
||||
acb_dirichlet_conrey_init(b, G);
|
||||
acb_dirichlet_conrey_log(a, G, m);
|
||||
acb_dirichlet_conrey_log(b, G, n);
|
||||
dirichlet_conrey_init(a, G);
|
||||
dirichlet_conrey_init(b, G);
|
||||
dirichlet_conrey_log(a, G, m);
|
||||
dirichlet_conrey_log(b, G, n);
|
||||
|
||||
x = acb_dirichlet_ui_pairing_conrey(G, a, b);
|
||||
x = dirichlet_ui_pairing_conrey(G, a, b);
|
||||
|
||||
acb_dirichlet_conrey_clear(a);
|
||||
acb_dirichlet_conrey_clear(b);
|
||||
dirichlet_conrey_clear(a);
|
||||
dirichlet_conrey_clear(b);
|
||||
|
||||
return x;
|
||||
}
|
|
@ -11,12 +11,12 @@
|
|||
(at your option) any later version. See <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "acb_dirichlet.h"
|
||||
#include "dirichlet.h"
|
||||
|
||||
/* todo: modular arithmetic */
|
||||
|
||||
ulong
|
||||
acb_dirichlet_ui_pairing_conrey(const acb_dirichlet_group_t G, const acb_dirichlet_conrey_t a, const acb_dirichlet_conrey_t b)
|
||||
dirichlet_ui_pairing_conrey(const dirichlet_group_t G, const dirichlet_conrey_t a, const dirichlet_conrey_t b)
|
||||
{
|
||||
ulong x, k;
|
||||
x = 0;
|
|
@ -9,10 +9,10 @@
|
|||
(at your option) any later version. See <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "acb_dirichlet.h"
|
||||
#include "dirichlet.h"
|
||||
|
||||
int
|
||||
acb_dirichlet_ui_parity(const acb_dirichlet_group_t G, ulong a)
|
||||
dirichlet_ui_parity(const dirichlet_group_t G, ulong a)
|
||||
{
|
||||
int par;
|
||||
|
|
@ -9,10 +9,10 @@
|
|||
(at your option) any later version. See <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "acb_dirichlet.h"
|
||||
#include "dirichlet.h"
|
||||
|
||||
void
|
||||
acb_dirichlet_ui_vec_set_null(ulong *v, const acb_dirichlet_group_t G, slong nv)
|
||||
dirichlet_ui_vec_set_null(ulong *v, const dirichlet_group_t G, slong nv)
|
||||
{
|
||||
slong k, l;
|
||||
if (G->q_even > 1)
|
||||
|
@ -26,6 +26,6 @@ acb_dirichlet_ui_vec_set_null(ulong *v, const acb_dirichlet_group_t G, slong nv)
|
|||
ulong p = G->P[l].p;
|
||||
|
||||
for (k = p; k < nv; k += p)
|
||||
v[k] = ACB_DIRICHLET_CHI_NULL;
|
||||
v[k] = DIRICHLET_CHI_NULL;
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue