arb/acb_modular/test/t-transform.c
Tommy Hofmann 6bf072eb59 Replace abort with flint_abort.
This will allow us to not loose the julia session on error.
See also https://github.com/wbhart/flint2/pull/243
2017-02-28 16:52:57 +01:00

75 lines
2 KiB
C

/*
Copyright (C) 2014 Fredrik Johansson
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_modular.h"
int main()
{
slong iter;
flint_rand_t state;
flint_printf("transform....");
fflush(stdout);
flint_randinit(state);
for (iter = 0; iter < 10000 * arb_test_multiplier(); iter++)
{
psl2z_t g;
acb_t z, w1, w2, t;
slong prec;
psl2z_init(g);
acb_init(z);
acb_init(w1);
acb_init(w2);
acb_init(t);
psl2z_randtest(g, state, n_randint(state, 20));
acb_randtest(z, state, 1 + n_randint(state, 200), 1 + n_randint(state, 20));
acb_randtest(w1, state, 1 + n_randint(state, 200), 1 + n_randint(state, 20));
acb_randtest(w2, state, 1 + n_randint(state, 200), 1 + n_randint(state, 20));
acb_modular_transform(w1, g, z, 2 + n_randint(state, 200));
prec = 2 + n_randint(state, 200);
acb_mul_fmpz(t, z, &g->a, prec);
acb_add_fmpz(t, t, &g->b, prec);
acb_mul_fmpz(w2, z, &g->c, prec);
acb_add_fmpz(w2, w2, &g->d, prec);
acb_div(w2, t, w2, prec);
if (!acb_overlaps(w1, w2))
{
flint_printf("FAIL\n");
flint_printf("g = "); psl2z_print(g); flint_printf("\n\n");
flint_printf("z = "); acb_printd(z, 30); flint_printf("\n\n");
flint_printf("w1 = "); acb_printd(w1, 30); flint_printf("\n\n");
flint_printf("w2 = "); acb_printd(w2, 30); flint_printf("\n\n");
flint_abort();
}
psl2z_clear(g);
acb_clear(z);
acb_clear(w1);
acb_clear(w2);
acb_clear(t);
}
flint_randclear(state);
flint_cleanup();
flint_printf("PASS\n");
return EXIT_SUCCESS;
}