consistency passing G as input for char properties; fix is_real for q=1

This commit is contained in:
Fredrik Johansson 2016-10-10 20:50:11 +02:00
parent 1af0028bb2
commit 35f55ca1ff
3 changed files with 4 additions and 4 deletions

View file

@ -27,7 +27,7 @@ acb_dirichlet_l_hurwitz(acb_t res, const acb_t s,
deflate = 0; deflate = 0;
if (acb_is_one(s)) if (acb_is_one(s))
{ {
if (dirichlet_char_is_principal(chi)) if (dirichlet_char_is_principal(G, chi))
{ {
acb_indeterminate(res); acb_indeterminate(res);
return; return;

View file

@ -133,7 +133,7 @@ ulong dirichlet_pairing(const dirichlet_group_t G, ulong m, ulong n);
ulong dirichlet_pairing_char(const dirichlet_group_t G, const dirichlet_char_t a, const dirichlet_char_t b); ulong dirichlet_pairing_char(const dirichlet_group_t G, const dirichlet_char_t a, const dirichlet_char_t b);
DIRICHLET_INLINE int DIRICHLET_INLINE int
dirichlet_char_is_principal(const dirichlet_char_t chi) dirichlet_char_is_principal(const dirichlet_group_t G, const dirichlet_char_t chi)
{ {
return (chi->n == 1); return (chi->n == 1);
} }
@ -141,7 +141,7 @@ dirichlet_char_is_principal(const dirichlet_char_t chi)
DIRICHLET_INLINE int DIRICHLET_INLINE int
dirichlet_char_is_real(const dirichlet_group_t G, const dirichlet_char_t chi) dirichlet_char_is_real(const dirichlet_group_t G, const dirichlet_char_t chi)
{ {
return (nmod_mul(chi->n, chi->n, G->mod) == 1); return G->q <= 4 || (nmod_mul(chi->n, chi->n, G->mod) == 1);
} }
ulong dirichlet_chi(const dirichlet_group_t G, const dirichlet_char_t chi, ulong n); ulong dirichlet_chi(const dirichlet_group_t G, const dirichlet_char_t chi, ulong n);

View file

@ -216,7 +216,7 @@ level of *number* and *char* object. Both case require no discrete log computati
Returns the order of `\chi_q(a,\cdot)` which is the order of `a\bmod q`. Returns the order of `\chi_q(a,\cdot)` which is the order of `a\bmod q`.
.. function:: int dirichlet_char_is_real(const dirichlet_char_t chi) .. function:: int dirichlet_char_is_real(const dirichlet_group_t G, const dirichlet_char_t chi)
Returns 1 if *chi* is a real character (iff it has order `\leq 2`). Returns 1 if *chi* is a real character (iff it has order `\leq 2`).