This commit is contained in:
Pascal 2016-06-15 14:04:27 +02:00
parent 249f123f6b
commit 03198b4881
5 changed files with 51 additions and 3 deletions

View file

@ -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);
*/

View file

@ -34,4 +34,3 @@ acb_dirichlet_eta(acb_t res, const acb_t s, slong prec)
acb_clear(t);
}
}

46
acb_dirichlet/parity_ui.c Normal file
View file

@ -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;
}

View file

@ -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();
}