diff --git a/acb_dirichlet.h b/acb_dirichlet.h index 9a498b60..73398507 100644 --- a/acb_dirichlet.h +++ b/acb_dirichlet.h @@ -63,8 +63,8 @@ void acb_dirichlet_group_dlog_precompute(acb_dirichlet_group_t G, ulong num); ulong acb_dirichlet_number_primitive(const acb_dirichlet_group_t G); ulong acb_dirichlet_conductor_ui(const acb_dirichlet_group_t G, ulong a); +int acb_dirichlet_parity_ui(const acb_dirichlet_group_t G, ulong a); /* -ulong acb_dirichlet_parity_ui(const acb_dirichlet_groupt_t G, ulong a); ulong acb_dirichlet_order_ui(const acb_dirichlet_groupt_t G, ulong a); */ diff --git a/acb_dirichlet/eta.c b/acb_dirichlet/eta.c index 4c7f0d4e..d64b8dca 100644 --- a/acb_dirichlet/eta.c +++ b/acb_dirichlet/eta.c @@ -34,4 +34,3 @@ acb_dirichlet_eta(acb_t res, const acb_t s, slong prec) acb_clear(t); } } - diff --git a/acb_dirichlet/parity_ui.c b/acb_dirichlet/parity_ui.c new file mode 100644 index 00000000..634eb030 --- /dev/null +++ b/acb_dirichlet/parity_ui.c @@ -0,0 +1,46 @@ +/*============================================================================= + + This file is part of ARB. + + ARB is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + ARB is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with ARB; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +=============================================================================*/ +/****************************************************************************** + + Copyright (C) 2016 Pascal Molin + +******************************************************************************/ + +#include "acb_dirichlet.h" + +int +acb_dirichlet_parity_ui(const acb_dirichlet_group_t G, ulong a) +{ + slong k; + int par; + + par = 0; + + if (G->neven && a % 4 == 3) + par++; + + for (k = G->neven; k < G->num; k++) + { + if (n_jacobi_unsigned(a, G->primes[k]) == -1) + par++; + } + + return par % 2; +} diff --git a/acb_dirichlet/test/t-chars.c b/acb_dirichlet/test/t-chars.c index 61ca894c..6fdbae1f 100644 --- a/acb_dirichlet/test/t-chars.c +++ b/acb_dirichlet/test/t-chars.c @@ -77,6 +77,7 @@ int main() /* check number char properties */ for (iter2 = 0; iter2 < 50; iter2++) { + int par; ulong m, n; ulong order, chim1, pairing, cond; @@ -108,14 +109,16 @@ int main() abort(); } + par = acb_dirichlet_parity_ui(G, m); chim1 = acb_dirichlet_ui_chi(G, chi, q - 1); - if (acb_dirichlet_char_parity(chi) != (chim1 != 0)) + if (acb_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("parity_ui = %d", par); acb_dirichlet_char_print(G, chi); abort(); } diff --git a/acb_dirichlet/ui_pairng_conrey.c b/acb_dirichlet/ui_pairing_conrey.c similarity index 100% rename from acb_dirichlet/ui_pairng_conrey.c rename to acb_dirichlet/ui_pairing_conrey.c