| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
#include "test_helpers.h" |
| 13 |
#include "arb_poly.h" |
| 14 |
|
| 15 |
TEST_FUNCTION_START(arb_poly_riemann_siegel_theta_series, state) |
| 16 |
{ |
| 17 |
slong iter; |
| 18 |
|
| 19 |
for (iter = 0; iter < 300 * 0.1 * flint_test_multiplier(); iter++) |
| 20 |
{ |
| 21 |
slong m, n1, n2, rbits1, rbits2, rbits3; |
| 22 |
arb_poly_t a, b, c, d; |
| 23 |
|
| 24 |
rbits1 = 2 + n_randint(state, 150); |
| 25 |
rbits2 = 2 + n_randint(state, 150); |
| 26 |
rbits3 = 2 + n_randint(state, 150); |
| 27 |
|
| 28 |
m = 1 + n_randint(state, 15); |
| 29 |
n1 = 1 + n_randint(state, 15); |
| 30 |
n2 = 1 + n_randint(state, 15); |
| 31 |
|
| 32 |
arb_poly_init(a); |
| 33 |
arb_poly_init(b); |
| 34 |
arb_poly_init(c); |
| 35 |
arb_poly_init(d); |
| 36 |
|
| 37 |
arb_poly_randtest(a, state, m, rbits1, 10); |
| 38 |
|
| 39 |
|
| 40 |
arb_poly_randtest(b, state, m, rbits1, 10); |
| 41 |
arb_poly_randtest(c, state, m, rbits1, 10); |
| 42 |
|
| 43 |
arb_poly_riemann_siegel_theta_series(b, a, n1, rbits2); |
| 44 |
arb_poly_riemann_siegel_theta_series(c, a, n2, rbits3); |
| 45 |
|
| 46 |
arb_poly_set(d, b); |
| 47 |
arb_poly_truncate(d, FLINT_MIN(n1, n2)); |
| 48 |
arb_poly_truncate(c, FLINT_MIN(n1, n2)); |
| 49 |
|
| 50 |
if (!arb_poly_overlaps(c, d)) |
| 51 |
{ |
| 52 |
flint_printf("FAIL\n\n"); |
| 53 |
flint_printf("n1 = %wd, n2 = %wd, bits2 = %wd, bits3 = %wd\n", n1, n2, rbits2, rbits3); |
| 54 |
|
| 55 |
flint_printf("a = "); arb_poly_printd(a, 15); flint_printf("\n\n"); |
| 56 |
flint_printf("b = "); arb_poly_printd(b, 15); flint_printf("\n\n"); |
| 57 |
flint_printf("c = "); arb_poly_printd(c, 15); flint_printf("\n\n"); |
| 58 |
|
| 59 |
flint_abort(); |
| 60 |
} |
| 61 |
|
| 62 |
|
| 63 |
arb_poly_neg(d, a); |
| 64 |
arb_poly_riemann_siegel_theta_series(c, d, n1, rbits2); |
| 65 |
arb_poly_neg(c, c); |
| 66 |
|
| 67 |
if (!arb_poly_overlaps(b, c)) |
| 68 |
{ |
| 69 |
flint_printf("FAIL (symmetry, n1 = %wd)\n\n", n1); |
| 70 |
|
| 71 |
flint_printf("a = "); arb_poly_printd(a, 15); flint_printf("\n\n"); |
| 72 |
flint_printf("b = "); arb_poly_printd(b, 15); flint_printf("\n\n"); |
| 73 |
flint_printf("c = "); arb_poly_printd(c, 15); flint_printf("\n\n"); |
| 74 |
flint_printf("d = "); arb_poly_printd(d, 15); flint_printf("\n\n"); |
| 75 |
|
| 76 |
flint_abort(); |
| 77 |
} |
| 78 |
|
| 79 |
arb_poly_riemann_siegel_theta_series(a, a, n1, rbits2); |
| 80 |
if (!arb_poly_overlaps(a, b)) |
| 81 |
{ |
| 82 |
flint_printf("FAIL (aliasing)\n\n"); |
| 83 |
flint_abort(); |
| 84 |
} |
| 85 |
|
| 86 |
arb_poly_clear(a); |
| 87 |
arb_poly_clear(b); |
| 88 |
arb_poly_clear(c); |
| 89 |
arb_poly_clear(d); |
| 90 |
} |
| 91 |
|
| 92 |
TEST_FUNCTION_END(state); |
| 93 |
} |