2016-04-26 17:20:05 +02:00
|
|
|
/*
|
2014-10-07 19:28:06 +02:00
|
|
|
Copyright (C) 2014 Fredrik Johansson
|
|
|
|
|
2016-04-26 17:20:05 +02:00
|
|
|
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/>.
|
|
|
|
*/
|
2014-10-07 19:28:06 +02:00
|
|
|
|
|
|
|
#include "acb_modular.h"
|
2016-03-03 15:42:23 +01:00
|
|
|
#include "flint/arith.h"
|
2014-10-07 19:28:06 +02:00
|
|
|
|
|
|
|
static void
|
|
|
|
acb_modular_epsilon_arg_naive(fmpq_t arg, const psl2z_t g)
|
|
|
|
{
|
|
|
|
#define a (&g->a)
|
|
|
|
#define b (&g->b)
|
|
|
|
#define c (&g->c)
|
|
|
|
#define d (&g->d)
|
|
|
|
|
|
|
|
if (fmpz_is_zero(c))
|
|
|
|
{
|
|
|
|
fmpz_set(fmpq_numref(arg), b);
|
|
|
|
fmpz_set_ui(fmpq_denref(arg), 12);
|
|
|
|
fmpq_canonicalise(arg);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
fmpq_t t;
|
|
|
|
fmpq_init(t);
|
|
|
|
|
|
|
|
fmpz_add(fmpq_numref(arg), a, d);
|
|
|
|
fmpz_submul_ui(fmpq_numref(arg), c, 3);
|
|
|
|
fmpz_mul_ui(fmpq_denref(arg), c, 12);
|
|
|
|
fmpq_canonicalise(arg);
|
|
|
|
|
2015-02-19 23:10:33 +01:00
|
|
|
arith_dedekind_sum(t, d, c);
|
2014-10-07 19:28:06 +02:00
|
|
|
fmpq_sub(arg, arg, t);
|
|
|
|
|
|
|
|
fmpq_clear(t);
|
|
|
|
}
|
|
|
|
#undef a
|
|
|
|
#undef b
|
|
|
|
#undef c
|
|
|
|
#undef d
|
|
|
|
}
|
|
|
|
|
|
|
|
int main()
|
|
|
|
{
|
2015-11-05 17:49:06 +00:00
|
|
|
slong iter;
|
2014-10-07 19:28:06 +02:00
|
|
|
flint_rand_t state;
|
|
|
|
|
2015-11-06 16:17:27 +00:00
|
|
|
flint_printf("eta_epsilon_arg....");
|
2014-10-07 19:28:06 +02:00
|
|
|
fflush(stdout);
|
|
|
|
|
|
|
|
flint_randinit(state);
|
|
|
|
|
2016-04-10 17:24:58 +02:00
|
|
|
for (iter = 0; iter < 10000 * arb_test_multiplier(); iter++)
|
2014-10-07 19:28:06 +02:00
|
|
|
{
|
|
|
|
psl2z_t g;
|
|
|
|
fmpq_t x, y;
|
|
|
|
acb_t a, b;
|
|
|
|
|
|
|
|
psl2z_init(g);
|
|
|
|
fmpq_init(x);
|
|
|
|
fmpq_init(y);
|
|
|
|
acb_init(a);
|
|
|
|
acb_init(b);
|
|
|
|
|
|
|
|
psl2z_randtest(g, state, n_randint(state, 200));
|
|
|
|
fmpq_randtest(x, state, 100);
|
|
|
|
fmpq_randtest(y, state, 100);
|
|
|
|
|
2014-10-14 16:23:46 +02:00
|
|
|
fmpq_set_si(x, acb_modular_epsilon_arg(g), 12);
|
2014-10-07 19:28:06 +02:00
|
|
|
acb_modular_epsilon_arg_naive(y, g);
|
|
|
|
|
|
|
|
arb_sin_cos_pi_fmpq(acb_imagref(a), acb_realref(a), x, 200);
|
|
|
|
arb_sin_cos_pi_fmpq(acb_imagref(b), acb_realref(b), x, 200);
|
|
|
|
|
|
|
|
if (!acb_overlaps(a, b))
|
|
|
|
{
|
2015-11-06 16:17:27 +00:00
|
|
|
flint_printf("FAIL\n");
|
|
|
|
flint_printf("g = "); psl2z_print(g); flint_printf("\n");
|
|
|
|
flint_printf("x = "); fmpq_print(x); flint_printf("\n");
|
|
|
|
flint_printf("y = "); fmpq_print(y); flint_printf("\n");
|
2017-02-28 16:50:03 +01:00
|
|
|
flint_abort();
|
2014-10-07 19:28:06 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
psl2z_clear(g);
|
|
|
|
fmpq_clear(x);
|
|
|
|
fmpq_clear(y);
|
|
|
|
acb_clear(a);
|
|
|
|
acb_clear(b);
|
|
|
|
}
|
|
|
|
|
|
|
|
flint_randclear(state);
|
|
|
|
flint_cleanup();
|
2015-11-06 16:17:27 +00:00
|
|
|
flint_printf("PASS\n");
|
2014-10-07 19:28:06 +02:00
|
|
|
return EXIT_SUCCESS;
|
|
|
|
}
|
|
|
|
|