mirror of
https://github.com/vale981/arb
synced 2025-03-06 01:41:39 -05:00
74 lines
1.8 KiB
C
74 lines
1.8 KiB
C
/*
|
|
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"
|
|
|
|
static ulong
|
|
vec_diff(ulong * v, ulong * ref, ulong nv)
|
|
{
|
|
ulong k;
|
|
for (k = 1; k < nv; k++)
|
|
if (ref[k] != v[k])
|
|
return k;
|
|
return 0;
|
|
}
|
|
|
|
int main()
|
|
{
|
|
ulong q;
|
|
|
|
flint_printf("vec....");
|
|
fflush(stdout);
|
|
|
|
for (q = 2; q < 600; q ++)
|
|
{
|
|
acb_dirichlet_group_t G;
|
|
acb_dirichlet_conrey_t x;
|
|
acb_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);
|
|
|
|
nv = 100;
|
|
v1 = flint_malloc(nv * sizeof(ulong));
|
|
v2 = flint_malloc(nv * sizeof(ulong));
|
|
|
|
acb_dirichlet_conrey_one(x, G);
|
|
|
|
do {
|
|
|
|
acb_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);
|
|
|
|
if ((k = vec_diff(v1, v2, nv)))
|
|
{
|
|
flint_printf("FAIL: chi(%wu,%wu) = %wu != chi(%wu,%wu) = %wu mod %wu (modulus = %wu)\n",
|
|
chi->x->n, k, v1[k], chi->x->n, k, v2[k], chi->order, q);
|
|
abort();
|
|
}
|
|
|
|
} while (acb_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);
|
|
}
|
|
|
|
flint_cleanup();
|
|
flint_printf("PASS\n");
|
|
return EXIT_SUCCESS;
|
|
}
|