mirror of
https://github.com/vale981/arb
synced 2025-03-05 09:21:38 -05:00
add parity in char (simpler to have on logs)
This commit is contained in:
parent
06d7cce20a
commit
0d96be37f8
4 changed files with 29 additions and 6 deletions
|
@ -1,6 +1,7 @@
|
|||
/*
|
||||
Copyright (C) 2015 Jonathan Bober
|
||||
Copyright (C) 2016 Fredrik Johansson
|
||||
Copyright (C) 2016 Pascal Molin
|
||||
|
||||
This file is part of Arb.
|
||||
|
||||
|
@ -13,6 +14,12 @@
|
|||
#ifndef ACB_DIRICHLET_H
|
||||
#define ACB_DIRICHLET_H
|
||||
|
||||
#ifdef ACB_INLINES_C
|
||||
#define ACB_INLINE
|
||||
#else
|
||||
#define ACB_INLINE static __inline__
|
||||
#endif
|
||||
|
||||
#include "acb.h"
|
||||
#include "dlog.h"
|
||||
|
||||
|
@ -59,11 +66,14 @@ void acb_dirichlet_eta(acb_t res, const acb_t s, slong prec);
|
|||
|
||||
void acb_dirichlet_group_init(acb_dirichlet_group_t G, ulong q);
|
||||
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_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);
|
||||
|
||||
int acb_dirichlet_conrey_parity(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);
|
||||
|
||||
void acb_dirichlet_conrey_one(acb_dirichlet_conrey_t x, const acb_dirichlet_group_t G);
|
||||
|
@ -89,11 +99,24 @@ typedef struct
|
|||
ulong n; /* number */
|
||||
ulong order; /* order */
|
||||
ulong * expo; /* reduced exponents ( order * log[k] / gcd( ) ) */
|
||||
int parity; /* 0 for even char, 1 for odd */
|
||||
}
|
||||
acb_dirichlet_char_struct;
|
||||
|
||||
typedef acb_dirichlet_char_struct acb_dirichlet_char_t[1];
|
||||
|
||||
ACB_INLINE int
|
||||
acb_dirichlet_char_order(const acb_dirichlet_char_t chi)
|
||||
{
|
||||
return chi->order;
|
||||
}
|
||||
|
||||
ACB_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);
|
||||
|
@ -129,4 +152,3 @@ void acb_dirichlet_arb_quadratic_powers(arb_ptr v, slong nv, const arb_t x, slon
|
|||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -33,9 +33,10 @@ acb_dirichlet_char_conrey(acb_dirichlet_char_t chi, const acb_dirichlet_group_t
|
|||
ulong k;
|
||||
chi->q = G->q;
|
||||
chi->n = x->n;
|
||||
chi->parity = acb_dirichlet_conrey_parity(G, x);
|
||||
|
||||
for (k = 0; k < G->num; k++)
|
||||
chi->expo[k] = (x->log[k] * G->PHI[k]) % G->expo;
|
||||
chi->expo[k] = (x->log[k] * G->PHI[k]) % G->expo;
|
||||
|
||||
/* optional: divide by gcd to obtain true order */
|
||||
acb_dirichlet_char_normalize(chi, G);
|
||||
|
|
|
@ -26,14 +26,14 @@
|
|||
#include "acb_dirichlet.h"
|
||||
|
||||
int
|
||||
acb_dirichlet_char_is_odd(const acb_dirichlet_group_t G, const acb_dirichlet_char_t chi)
|
||||
acb_dirichlet_conrey_parity(const acb_dirichlet_group_t G, const acb_dirichlet_conrey_t x)
|
||||
{
|
||||
slong k, odd = 0;
|
||||
int k, odd = 0;
|
||||
for (k = 0; k < G->num; k++)
|
||||
{
|
||||
if (k == 1 && G->neven == 2)
|
||||
continue;
|
||||
if (chi->expo[k] % 2 == 1)
|
||||
if (x->log[k] % 2)
|
||||
odd = 1 - odd;
|
||||
}
|
||||
return odd;
|
|
@ -100,7 +100,7 @@ int main()
|
|||
/*
|
||||
flint_printf("Theta(chi_%wu(%wu)) (m=%wu)\n", q, chi->n, m);
|
||||
*/
|
||||
tt = acb_dirichlet_char_is_odd(G, chi) ? kt : t;
|
||||
tt = acb_dirichlet_char_parity(chi) ? kt : t;
|
||||
for (k = 1; k < nv; k++)
|
||||
if (v[k] != CHI_NULL)
|
||||
acb_addmul_arb(sum, z + (v[k] * m), tt + k, prec);
|
||||
|
|
Loading…
Add table
Reference in a new issue