int main() { slong iter; flint_rand_t state; flint_printf("evaluate2...."); fflush(stdout); flint_randinit(state); for (iter = 0; iter < 10000; iter++) { acb_poly_t f, g; acb_t x, y1, z1, y2, z2; acb_init(x); acb_init(y1); acb_init(z1); acb_init(y2); acb_init(z2); acb_poly_init(f); acb_poly_init(g); acb_randtest(x, state, 2 + n_randint(state, 1000), 5); acb_poly_randtest(f, state, 2 + n_randint(state, 100), 2 + n_randint(state, 1000), 5); acb_poly_derivative(g, f, 2 + n_randint(state, 1000)); acb_poly_evaluate2(y1, z1, f, x, 2 + n_randint(state, 1000)); acb_poly_evaluate_horner(y2, f, x, 2 + n_randint(state, 1000)); acb_poly_evaluate_horner(z2, g, x, 2 + n_randint(state, 1000)); if (!acb_overlaps(y1, y2) || !acb_overlaps(z1, z2)) { flint_printf("FAIL\n\n"); flint_printf("f = "); acb_poly_printd(f, 15); flint_printf("\n\n"); flint_printf("g = "); acb_poly_printd(g, 15); flint_printf("\n\n"); flint_printf("x = "); acb_printd(x, 15); flint_printf("\n\n"); flint_printf("y1 = "); acb_printd(y1, 15); flint_printf("\n\n"); flint_printf("z1 = "); acb_printd(z1, 15); flint_printf("\n\n"); flint_printf("y2 = "); acb_printd(y2, 15); flint_printf("\n\n"); flint_printf("z2 = "); acb_printd(z2, 15); flint_printf("\n\n"); abort(); } acb_poly_clear(f); acb_poly_clear(g); acb_clear(x); acb_clear(y1); acb_clear(z1); acb_clear(y2); acb_clear(z2); } flint_randclear(state); flint_cleanup(); flint_printf("PASS\n"); return EXIT_SUCCESS; }
int main() { slong iter; flint_rand_t state; flint_printf("l...."); fflush(stdout); flint_randinit(state); for (iter = 0; iter < 1000 * arb_test_multiplier(); iter++) { acb_t s, t, u; dirichlet_group_t G; dirichlet_char_t chi; ulong q, k; slong prec; acb_init(s); acb_init(t); acb_init(u); q = 1 + n_randint(state, 50); prec = 2 + n_randint(state, 100); k = n_randint(state, n_euler_phi(q)); dirichlet_group_init(G, q); dirichlet_char_init(chi, G); dirichlet_char_index(chi, G, k); if (n_randint(state, 2)) acb_set_si(s, n_randint(state, 50) - 25); else acb_randtest(s, state, 2 + n_randint(state, 200), 2); acb_dirichlet_l_hurwitz(t, s, NULL, G, chi, prec); acb_dirichlet_l(u, s, G, chi, prec); if (!acb_overlaps(t, u)) { flint_printf("FAIL: overlap\n\n"); flint_printf("iter = %ld q = %lu k = %lu prec = %ld\n\n", iter, q, k, prec); flint_printf("s = "); acb_printn(s, 100, 0); flint_printf("\n\n"); flint_printf("t = "); acb_printn(t, 100, 0); flint_printf("\n\n"); flint_printf("u = "); acb_printn(u, 100, 0); flint_printf("\n\n"); abort(); } dirichlet_char_clear(chi); dirichlet_group_clear(G); acb_clear(s); acb_clear(t); acb_clear(u); } flint_randclear(state); flint_cleanup(); flint_printf("PASS\n"); return EXIT_SUCCESS; }
int main() { long iter; flint_rand_t state; printf("exp...."); fflush(stdout); flint_randinit(state); /* check exp(a+b) = exp(a)*exp(b) */ for (iter = 0; iter < 10000; iter++) { acb_t a, b, c, d, e; long prec; acb_init(a); acb_init(b); acb_init(c); acb_init(d); acb_init(e); acb_randtest(a, state, 1 + n_randint(state, 200), 3); acb_randtest(b, state, 1 + n_randint(state, 200), 3); acb_randtest(c, state, 1 + n_randint(state, 200), 3); prec = 2 + n_randint(state, 200); acb_add(c, a, b, prec); acb_exp(c, c, prec); acb_exp(d, a, prec); acb_exp(e, b, prec); acb_mul(d, d, e, prec); if (!acb_overlaps(c, d)) { printf("FAIL: overlap\n\n"); printf("a = "); acb_print(a); printf("\n\n"); printf("b = "); acb_print(b); printf("\n\n"); printf("c = "); acb_print(c); printf("\n\n"); printf("d = "); acb_print(d); printf("\n\n"); abort(); } acb_clear(a); acb_clear(b); acb_clear(c); acb_clear(d); acb_clear(e); } flint_randclear(state); flint_cleanup(); printf("PASS\n"); return EXIT_SUCCESS; }
int main() { slong iter; flint_rand_t state; flint_printf("roots...."); fflush(stdout); flint_randinit(state); for (iter = 0; iter < 10000 * arb_test_multiplier(); iter++) { acb_t x, y, z; acb_dirichlet_roots_t roots; ulong n, k; slong prec; slong iter2; n = 1 + n_randint(state, 1000); prec = 2 + n_randint(state, 200); acb_init(x); acb_init(y); acb_init(z); acb_dirichlet_roots_init(roots, n, n_randtest(state), prec); acb_unit_root(y, n, prec); for (iter2 = 0; iter2 <= FLINT_MIN(n, 20); iter2++) { k = n_randint(state, 2 * n); acb_dirichlet_root(x, roots, k, prec); acb_pow_ui(z, y, k, prec); if (!acb_overlaps(x, z)) { flint_printf("FAIL: overlap\n\n"); flint_printf("iter = %wd n = %wu k = %wu prec = %wd\n\n", iter, n, k, prec); flint_printf("x = "); acb_printn(x, 30, 0); flint_printf("\n\n"); flint_printf("z = "); acb_printn(z, 30, 0); flint_printf("\n\n"); flint_abort(); } } acb_dirichlet_roots_clear(roots); acb_clear(x); acb_clear(y); acb_clear(z); } flint_randclear(state); flint_cleanup(); flint_printf("PASS\n"); return EXIT_SUCCESS; }
int main() { flint_printf("spherical_y...."); fflush(stdout); { slong i, n, m; acb_t z, w, x, y; acb_init(z); acb_init(w); acb_init(x); acb_init(y); i = 0; arb_set_str(acb_realref(x), "0.2", 64); arb_set_str(acb_imagref(x), "0.3", 64); arb_set_str(acb_realref(y), "0.3", 64); arb_set_str(acb_imagref(y), "0.4", 64); for (n = -4; n <= 4; n++) { for (m = -4; m <= 4; m++) { acb_hypgeom_spherical_y(z, n, m, x, y, 64); acb_set_d_d(w, testdata[2 * i], testdata[2 * i + 1]); mag_set_d(arb_radref(acb_realref(w)), 1e-13); mag_set_d(arb_radref(acb_imagref(w)), 1e-13); if (!acb_overlaps(z, w)) { flint_printf("FAIL: value\n\n"); flint_printf("n = %wd, m = %wd\n", n, m); flint_printf("z = "); acb_printd(z, 20); flint_printf("\n\n"); flint_printf("w = "); acb_printd(w, 20); flint_printf("\n\n"); abort(); } i++; } } acb_clear(z); acb_clear(w); acb_clear(x); acb_clear(y); } flint_cleanup(); flint_printf("PASS\n"); return EXIT_SUCCESS; }
int _acb_poly_overlaps(acb_srcptr poly1, slong len1, acb_srcptr poly2, slong len2) { slong i; for (i = 0; i < len2; i++) if (!acb_overlaps(poly1 + i, poly2 + i)) return 0; for (i = len2; i < len1; i++) if (!acb_contains_zero(poly1 + i)) return 0; return 1; }
int main() { slong iter; flint_rand_t state; flint_printf("evaluate_rectangular...."); fflush(stdout); flint_randinit(state); for (iter = 0; iter < 10000 * arb_test_multiplier(); iter++) { acb_poly_t f; acb_t x, y1, y2; acb_init(x); acb_init(y1); acb_init(y2); acb_poly_init(f); acb_randtest(x, state, 2 + n_randint(state, 1000), 5); acb_poly_randtest(f, state, 2 + n_randint(state, 100), 2 + n_randint(state, 1000), 5); acb_poly_evaluate_rectangular(y1, f, x, 2 + n_randint(state, 1000)); acb_poly_evaluate_horner(y2, f, x, 2 + n_randint(state, 1000)); if (!acb_overlaps(y1, y2)) { flint_printf("FAIL\n\n"); flint_printf("f = "); acb_poly_printd(f, 15); flint_printf("\n\n"); flint_printf("x = "); acb_printd(x, 15); flint_printf("\n\n"); flint_printf("y1 = "); acb_printd(y1, 15); flint_printf("\n\n"); flint_printf("y2 = "); acb_printd(y2, 15); flint_printf("\n\n"); abort(); } acb_poly_clear(f); acb_clear(x); acb_clear(y1); acb_clear(y2); } flint_randclear(state); flint_cleanup(); flint_printf("PASS\n"); return EXIT_SUCCESS; }
int main() { slong iter; flint_rand_t state; flint_printf("sinc...."); fflush(stdout); flint_randinit(state); for (iter = 0; iter < 10000 * arb_test_multiplier(); iter++) { acb_t a, b, c, d; acb_init(a); acb_init(b); acb_init(c); acb_init(d); acb_randtest(a, state, 1 + n_randint(state, 400), 2 + n_randint(state, 100)); acb_randtest(b, state, 1 + n_randint(state, 400), 2 + n_randint(state, 100)); acb_randtest(c, state, 1 + n_randint(state, 400), 2 + n_randint(state, 100)); acb_sinc(b, a, 2 + n_randint(state, 400)); acb_sin(c, a, 2 + n_randint(state, 400)); acb_mul(d, b, a, 2 + n_randint(state, 400)); /* check consistency */ if (!acb_overlaps(c, d)) { flint_printf("FAIL: overlap\n\n"); flint_printf("a = "); acb_printd(a, 30); flint_printf("\n\n"); flint_printf("b = "); acb_printd(b, 30); flint_printf("\n\n"); flint_printf("c = "); acb_printd(c, 30); flint_printf("\n\n"); flint_printf("d = "); acb_printd(d, 30); flint_printf("\n\n"); abort(); } acb_set(c, a); acb_sinc(c, c, 2 + n_randint(state, 400)); if (!acb_overlaps(b, c)) { flint_printf("FAIL: aliasing\n\n"); flint_printf("a = "); acb_printd(a, 30); flint_printf("\n\n"); flint_printf("b = "); acb_printd(c, 30); flint_printf("\n\n"); flint_printf("c = "); acb_printd(c, 30); flint_printf("\n\n"); abort(); } acb_clear(a); acb_clear(b); acb_clear(c); acb_clear(d); } flint_randclear(state); flint_cleanup(); flint_printf("PASS\n"); return EXIT_SUCCESS; }
int main() { slong iter; flint_rand_t state; flint_printf("asinh...."); fflush(stdout); flint_randinit(state); for (iter = 0; iter < 1000 * arb_test_multiplier(); iter++) { acb_t x, a, b; slong prec1, prec2; prec1 = 2 + n_randint(state, 1000); prec2 = prec1 + 30; acb_init(x); acb_init(a); acb_init(b); acb_randtest_special(x, state, 1 + n_randint(state, 1000), 2 + n_randint(state, 100)); acb_randtest_special(a, state, 1 + n_randint(state, 1000), 2 + n_randint(state, 100)); acb_randtest_special(b, state, 1 + n_randint(state, 1000), 2 + n_randint(state, 100)); acb_asinh(a, x, prec1); acb_asinh(b, x, prec2); /* check consistency */ if (!acb_overlaps(a, b)) { flint_printf("FAIL: overlap\n\n"); flint_printf("x = "); acb_printd(x, 15); flint_printf("\n\n"); flint_printf("a = "); acb_printd(a, 15); flint_printf("\n\n"); flint_printf("b = "); acb_printd(b, 15); flint_printf("\n\n"); abort(); } /* check sinh(asinh(x)) = x */ acb_sinh(b, b, prec1); if (!acb_contains(b, x)) { flint_printf("FAIL: functional equation\n\n"); flint_printf("x = "); acb_printd(x, 15); flint_printf("\n\n"); flint_printf("b = "); acb_printd(b, 15); flint_printf("\n\n"); abort(); } acb_asinh(x, x, prec1); if (!acb_overlaps(a, x)) { flint_printf("FAIL: aliasing\n\n"); flint_printf("a = "); acb_printd(a, 15); flint_printf("\n\n"); flint_printf("x = "); acb_printd(x, 15); flint_printf("\n\n"); abort(); } acb_clear(x); acb_clear(a); acb_clear(b); } flint_randclear(state); flint_cleanup(); flint_printf("PASS\n"); return EXIT_SUCCESS; }
void check_periods() { FILE * fp; int ip, f, in, im; int flag = 0; flint_printf("periods..."); fflush(stdout); fp = fopen("ref_periods.txt", "r"); if (fp == NULL) abort(); for (ip = 0; ip < nm; ip++) { slong prec = vp[ip]; acb_t ref; acb_init(ref); for (f = 0; f < nf; f++) { for (in = 0; in < nn; in++) { fmpz_poly_t pol; fmpz_poly_init(pol); vf[f](pol, vn[in]); for (im = 0; im < nm; im++) { slong c; abel_jacobi_t aj; abel_jacobi_init_poly(aj, vm[im], pol); abel_jacobi_compute(aj, flag, prec); /* check 4 entries of each matrix */ for (c = 0; c < nc; c++) { acb_ptr coeff; acb_get_file(ref, fp, prec); coeff = acb_mat_entry(aj->omega0, c % 2, c / 2); if (!acb_overlaps(ref, coeff)) { flint_printf("FAIL:\n\n"); flint_printf("pol = "); fmpz_poly_print(pol); flint_printf("\nn = %ld, m = %ld, prec = %ld\n", vn[in], vm[im], prec); flint_printf("\nref = "); acb_printd(ref, 20); flint_printf("\nperiod = "); acb_printd(coeff, 20); flint_printf("\n\n"); abort(); } } abel_jacobi_clear(aj); } fmpz_poly_clear(pol); } } acb_clear(ref); } fclose(fp); flint_cleanup(); printf("PASS\n"); }
int main() { slong iter; flint_rand_t state; flint_printf("pfq_sum_rs...."); fflush(stdout); flint_randinit(state); for (iter = 0; iter < 10000 * arb_test_multiplier(); iter++) { acb_ptr a, b; acb_t z, s1, s2, t1, t2; slong i, p, q, n, prec1, prec2; p = n_randint(state, 5); q = n_randint(state, 5); n = n_randint(state, 300); prec1 = 2 + n_randint(state, 500); prec2 = 2 + n_randint(state, 500); acb_init(z); acb_init(s1); acb_init(s2); acb_init(t1); acb_init(t2); acb_randtest_special(z, state, 1 + n_randint(state, 500), 1 + n_randint(state, 100)); acb_randtest_special(s1, state, 1 + n_randint(state, 500), 1 + n_randint(state, 100)); acb_randtest_special(t1, state, 1 + n_randint(state, 500), 1 + n_randint(state, 100)); acb_randtest_special(s2, state, 1 + n_randint(state, 500), 1 + n_randint(state, 100)); acb_randtest_special(t2, state, 1 + n_randint(state, 500), 1 + n_randint(state, 100)); a = _acb_vec_init(p); b = _acb_vec_init(q); for (i = 0; i < p; i++) acb_randtest(a + i, state, 1 + n_randint(state, 100), 1 + n_randint(state, 10)); for (i = 0; i < q; i++) acb_randtest(b + i, state, 1 + n_randint(state, 100), 1 + n_randint(state, 10)); acb_hypgeom_pfq_sum_forward(s1, t1, a, p, b, q, z, n, prec1); acb_hypgeom_pfq_sum_rs(s2, t2, a, p, b, q, z, n, prec2); if (!acb_overlaps(s1, s2) || !acb_overlaps(t1, t2)) { flint_printf("FAIL: overlap\n\n"); flint_printf("z = "); acb_print(a); flint_printf("\n\n"); flint_printf("s1 = "); acb_print(s1); flint_printf("\n\n"); flint_printf("s2 = "); acb_print(s2); flint_printf("\n\n"); flint_printf("t1 = "); acb_print(t1); flint_printf("\n\n"); flint_printf("t2 = "); acb_print(t2); flint_printf("\n\n"); flint_abort(); } _acb_vec_clear(a, p); _acb_vec_clear(b, q); acb_clear(z); acb_clear(s1); acb_clear(s2); acb_clear(t1); acb_clear(t2); } flint_randclear(state); flint_cleanup(); flint_printf("PASS\n"); return EXIT_SUCCESS; }
int main() { slong iter; flint_rand_t state; flint_printf("pow...."); fflush(stdout); flint_randinit(state); /* check large arguments */ for (iter = 0; iter < 20000 * arb_test_multiplier(); iter++) { acb_t a, b, c, d, e, f; slong prec1, prec2; prec1 = 2 + n_randint(state, 1000); prec2 = prec1 + 30; acb_init(a); acb_init(b); acb_init(c); acb_init(d); acb_init(e); acb_init(f); acb_randtest(a, state, 1 + n_randint(state, 1000), 1 + n_randint(state, 200)); if (n_randint(state, 4) == 0) arb_zero(acb_imagref(a)); acb_randtest(b, state, 1 + n_randint(state, 1000), 1 + n_randint(state, 200)); if (n_randint(state, 4) == 0) arb_zero(acb_imagref(b)); acb_pow(c, a, b, prec1); acb_pow(d, a, b, prec2); if (!acb_overlaps(c, d)) { flint_printf("FAIL: overlap\n\n"); flint_printf("a = "); acb_print(a); flint_printf("\n\n"); flint_printf("b = "); acb_print(b); flint_printf("\n\n"); flint_printf("c = "); acb_print(c); flint_printf("\n\n"); flint_printf("d = "); acb_print(d); flint_printf("\n\n"); flint_abort(); } acb_randtest(c, state, 1 + n_randint(state, 1000), 200); /* check a^(b+c) = a^b*a^c */ acb_add(e, b, c, prec1); acb_pow(d, a, e, prec1); acb_pow(e, a, b, prec1); acb_pow(f, a, c, prec1); acb_mul(e, e, f, prec1); if (!acb_overlaps(d, e)) { flint_printf("FAIL: functional equation\n\n"); flint_printf("a = "); acb_print(a); flint_printf("\n\n"); flint_printf("b = "); acb_print(b); flint_printf("\n\n"); flint_printf("c = "); acb_print(c); flint_printf("\n\n"); flint_printf("d = "); acb_print(d); flint_printf("\n\n"); flint_printf("e = "); acb_print(e); flint_printf("\n\n"); flint_abort(); } acb_pow(c, a, b, prec1); acb_set(d, a); acb_pow(d, d, b, prec2); if (!acb_overlaps(c, d)) { flint_printf("FAIL: aliasing 1\n\n"); flint_printf("a = "); acb_print(a); flint_printf("\n\n"); flint_printf("b = "); acb_print(b); flint_printf("\n\n"); flint_printf("c = "); acb_print(c); flint_printf("\n\n"); flint_printf("d = "); acb_print(d); flint_printf("\n\n"); flint_abort(); } acb_set(d, b); acb_pow(d, a, d, prec2); if (!acb_overlaps(c, d)) { flint_printf("FAIL: aliasing 2\n\n"); flint_printf("a = "); acb_print(a); flint_printf("\n\n"); flint_printf("b = "); acb_print(b); flint_printf("\n\n"); flint_printf("c = "); acb_print(c); flint_printf("\n\n"); flint_printf("d = "); acb_print(d); flint_printf("\n\n"); flint_abort(); } acb_clear(a); acb_clear(b); acb_clear(c); acb_clear(d); acb_clear(e); acb_clear(f); } flint_randclear(state); flint_cleanup(); flint_printf("PASS\n"); return EXIT_SUCCESS; }
int main() { slong iter; flint_rand_t state; flint_printf("legendre_p...."); fflush(stdout); flint_randinit(state); for (iter = 0; iter < 2000 * arb_test_multiplier(); iter++) { acb_t n, na, nb, m, z, res1, res2, res3, t, u; slong prec1, prec2, ebits; int type; acb_init(n); acb_init(na); acb_init(nb); acb_init(m); acb_init(z); acb_init(res1); acb_init(res2); acb_init(res3); acb_init(t); acb_init(u); prec1 = 2 + n_randint(state, 300); prec2 = 2 + n_randint(state, 300); ebits = 1 + n_randint(state, 10); if (n_randint(state, 2)) { acb_set_si(m, n_randint(state, 20) - 10); acb_set_si(n, n_randint(state, 20) - 10); } else { acb_randtest_param(n, state, 1 + n_randint(state, 400), ebits); acb_randtest_param(m, state, 1 + n_randint(state, 400), ebits); } acb_randtest_param(z, state, 1 + n_randint(state, 400), ebits); acb_sub_ui(na, n, 1, prec2); acb_add_ui(nb, n, 1, prec2); type = n_randint(state, 2); acb_hypgeom_legendre_p(res1, n, m, z, type, prec1); acb_hypgeom_legendre_p(res2, na, m, z, type, prec2); acb_hypgeom_legendre_p(res3, nb, m, z, type, prec2); acb_add(t, n, m, prec2); acb_mul(t, t, res2, prec2); acb_sub(u, n, m, prec2); acb_add_ui(u, u, 1, prec2); acb_mul(u, u, res3, prec2); acb_add(t, t, u, prec2); acb_mul_2exp_si(u, n, 1); acb_add_ui(u, u, 1, prec2); acb_mul(u, u, z, prec2); acb_mul(u, u, res1, prec2); if (!acb_overlaps(t, u)) { flint_printf("FAIL: consistency\n\n"); flint_printf("iter = %wd, prec1 = %wd, prec2 = %wd\n\n", iter, prec1, prec2); flint_printf("type = %d\n\n", type); flint_printf("n = "); acb_printd(n, 30); flint_printf("\n\n"); flint_printf("m = "); acb_printd(m, 30); flint_printf("\n\n"); flint_printf("z = "); acb_printd(z, 30); flint_printf("\n\n"); flint_printf("res1 = "); acb_printd(res1, 30); flint_printf("\n\n"); flint_printf("res2 = "); acb_printd(res2, 30); flint_printf("\n\n"); flint_printf("res3 = "); acb_printd(res3, 30); flint_printf("\n\n"); flint_printf("t = "); acb_printd(t, 30); flint_printf("\n\n"); flint_printf("u = "); acb_printd(u, 30); flint_printf("\n\n"); abort(); } acb_clear(n); acb_clear(na); acb_clear(nb); acb_clear(m); acb_clear(z); acb_clear(res1); acb_clear(res2); acb_clear(res3); acb_clear(t); acb_clear(u); } flint_randclear(state); flint_cleanup(); flint_printf("PASS\n"); return EXIT_SUCCESS; }
int main() { slong iter; flint_rand_t state; flint_printf("laguerre_l...."); fflush(stdout); flint_randinit(state); for (iter = 0; iter < 2000 * arb_test_multiplier(); iter++) { acb_t n, m, n1, m1, z, res1, res2, res3, s; slong prec; acb_init(n); acb_init(m); acb_init(n1); acb_init(m1); acb_init(z); acb_init(res1); acb_init(res2); acb_init(res3); acb_init(s); prec = 2 + n_randint(state, 200); if (n_randint(state, 2)) { acb_set_si(n, n_randint(state, 20) - 10); acb_set_si(m, n_randint(state, 20) - 10); } else { acb_randtest_param(n, state, 1 + n_randint(state, 400), 10); acb_randtest_param(m, state, 1 + n_randint(state, 400), 10); } acb_randtest_param(z, state, 1 + n_randint(state, 400), 10); acb_sub_ui(n1, n, 1, prec); acb_sub_ui(m1, m, 1, prec); acb_hypgeom_laguerre_l(res1, n, m, z, prec); acb_hypgeom_laguerre_l(res2, n1, m, z, 2 + n_randint(state, 200)); acb_hypgeom_laguerre_l(res3, n, m1, z, 2 + n_randint(state, 200)); acb_add(s, res2, res3, prec); if (acb_is_finite(res1) && acb_is_finite(s) && !acb_overlaps(res1, s)) { flint_printf("FAIL: consistency\n\n"); flint_printf("iter = %wd\n\n", iter); flint_printf("n = "); acb_printd(n, 30); flint_printf("\n\n"); flint_printf("m = "); acb_printd(m, 30); flint_printf("\n\n"); flint_printf("z = "); acb_printd(z, 30); flint_printf("\n\n"); flint_printf("res1 = "); acb_printd(res1, 30); flint_printf("\n\n"); flint_printf("res2 = "); acb_printd(res2, 30); flint_printf("\n\n"); flint_printf("res3 = "); acb_printd(res3, 30); flint_printf("\n\n"); flint_printf("s = "); acb_printd(s, 30); flint_printf("\n\n"); abort(); } acb_clear(n); acb_clear(m); acb_clear(n1); acb_clear(m1); acb_clear(z); acb_clear(res1); acb_clear(res2); acb_clear(res3); acb_clear(s); } flint_randclear(state); flint_cleanup(); flint_printf("PASS\n"); return EXIT_SUCCESS; }
int main() { long iter; flint_rand_t state; printf("u...."); fflush(stdout); flint_randinit(state); for (iter = 0; iter < 2000; iter++) { acb_t a0, a1, a2, b, z, w0, w1, w2, t, u; long prec0, prec1, prec2; acb_init(a0); acb_init(a1); acb_init(a2); acb_init(b); acb_init(z); acb_init(w0); acb_init(w1); acb_init(w2); acb_init(t); acb_init(u); prec0 = 2 + n_randint(state, 700); prec1 = 2 + n_randint(state, 700); prec2 = 2 + n_randint(state, 700); acb_randtest_maybe_half_int(a0, state, 1 + n_randint(state, 1000), 1 + n_randint(state, 100)); acb_randtest_maybe_half_int(b, state, 1 + n_randint(state, 1000), 1 + n_randint(state, 100)); acb_randtest(z, state, 1 + n_randint(state, 1000), 1 + n_randint(state, 100)); acb_randtest(w0, state, 1 + n_randint(state, 1000), 1 + n_randint(state, 100)); acb_randtest(w1, state, 1 + n_randint(state, 1000), 1 + n_randint(state, 100)); acb_randtest(w2, state, 1 + n_randint(state, 1000), 1 + n_randint(state, 100)); acb_add_ui(a1, a0, 1, prec0); acb_add_ui(a2, a0, 2, prec0); switch (n_randint(state, 3)) { case 0: acb_hypgeom_u_asymp_proper(w0, a0, b, z, prec0); break; case 1: acb_hypgeom_u_1f1(w0, a0, b, z, prec0); break; default: acb_hypgeom_u(w0, a0, b, z, prec0); } switch (n_randint(state, 3)) { case 0: acb_hypgeom_u_asymp_proper(w1, a0, b, z, prec1); break; case 1: acb_hypgeom_u_1f1(w1, a0, b, z, prec1); break; default: acb_hypgeom_u(w1, a0, b, z, prec1); } if (!acb_overlaps(w0, w1)) { printf("FAIL: consistency\n\n"); printf("a = "); acb_printd(a0, 30); printf("\n\n"); printf("b = "); acb_printd(b, 30); printf("\n\n"); printf("z = "); acb_printd(z, 30); printf("\n\n"); printf("w0 = "); acb_printd(w0, 30); printf("\n\n"); printf("w1 = "); acb_printd(w1, 30); printf("\n\n"); abort(); } switch (n_randint(state, 3)) { case 0: acb_hypgeom_u_asymp_proper(w1, a1, b, z, prec1); break; case 1: acb_hypgeom_u_1f1(w1, a1, b, z, prec1); break; default: acb_hypgeom_u(w1, a1, b, z, prec1); } switch (n_randint(state, 3)) { case 0: acb_hypgeom_u_asymp_proper(w2, a2, b, z, prec2); break; case 1: acb_hypgeom_u_1f1(w2, a2, b, z, prec2); break; default: acb_hypgeom_u(w2, a2, b, z, prec2); } acb_set(t, w0); acb_mul_2exp_si(u, a0, 1); acb_sub(u, u, b, prec0); acb_add(u, u, z, prec0); acb_add_ui(u, u, 2, prec0); acb_submul(t, w1, u, prec0); acb_sub(u, a2, b, prec0); acb_mul(u, u, a1, prec0); acb_addmul(t, w2, u, prec0); if (!acb_contains_zero(t)) { printf("FAIL: contiguous relation\n\n"); printf("a = "); acb_printd(a0, 30); printf("\n\n"); printf("b = "); acb_printd(b, 30); printf("\n\n"); printf("z = "); acb_printd(z, 30); printf("\n\n"); printf("w0 = "); acb_printd(w0, 30); printf("\n\n"); printf("w1 = "); acb_printd(w1, 30); printf("\n\n"); printf("w2 = "); acb_printd(w2, 30); printf("\n\n"); printf("t = "); acb_printd(t, 30); printf("\n\n"); abort(); } acb_clear(a0); acb_clear(a1); acb_clear(a2); acb_clear(b); acb_clear(z); acb_clear(w0); acb_clear(w1); acb_clear(w2); acb_clear(t); acb_clear(u); } flint_randclear(state); flint_cleanup(); printf("PASS\n"); return EXIT_SUCCESS; }
int main() { long iter; flint_rand_t state; printf("rising_ui_rs...."); fflush(stdout); flint_randinit(state); /* check functional equation */ for (iter = 0; iter < 1000; iter++) { acb_t x, xn, y, z; ulong n, m, step1, step2, step3; acb_init(x); acb_init(xn); acb_init(y); acb_init(z); acb_randtest(x, state, 1 + n_randint(state, 4000), 10); n = n_randint(state, 80); m = n_randint(state, 40); acb_add_ui(xn, x, n, 1 + n_randint(state, 4000)); step1 = n_randint(state, 20); step2 = n_randint(state, 20); step3 = n_randint(state, 20); acb_rising_ui_rs(y, x, n, step1, 2 + n_randint(state, 4000)); acb_rising_ui_rs(z, xn, m, step2, 2 + n_randint(state, 4000)); acb_mul(y, y, z, 2 + n_randint(state, 4000)); acb_rising_ui_rs(z, x, n + m, step3, 2 + n_randint(state, 4000)); if (!acb_overlaps(y, z)) { printf("FAIL: overlap\n\n"); printf("n = %lu\n", n); printf("m = %lu\n", m); printf("x = "); acb_print(x); printf("\n\n"); printf("xn = "); acb_print(xn); printf("\n\n"); printf("y = "); acb_print(y); printf("\n\n"); printf("z = "); acb_print(z); printf("\n\n"); abort(); } acb_clear(x); acb_clear(xn); acb_clear(y); acb_clear(z); } /* aliasing of y and x */ for (iter = 0; iter < 1000; iter++) { acb_t x, y; ulong n; long prec; ulong step; acb_init(x); acb_init(y); acb_randtest(x, state, 1 + n_randint(state, 200), 10); acb_randtest(y, state, 1 + n_randint(state, 200), 10); n = n_randint(state, 100); step = n_randint(state, 20); prec = 2 + n_randint(state, 4000); acb_rising_ui_rs(y, x, n, step, prec); acb_rising_ui_rs(x, x, n, step, prec); if (!acb_equal(x, y)) { printf("FAIL: aliasing\n\n"); printf("x = "); acb_print(x); printf("\n\n"); printf("y = "); acb_print(y); printf("\n\n"); printf("n = %lu\n", n); abort(); } acb_clear(x); acb_clear(y); } flint_randclear(state); flint_cleanup(); printf("PASS\n"); return EXIT_SUCCESS; }
int main() { slong iter; flint_rand_t state; flint_printf("div...."); fflush(stdout); flint_randinit(state); /* test aliasing of c and a */ for (iter = 0; iter < 100000; iter++) { acb_t a, b, c; slong prec; acb_init(a); acb_init(b); acb_init(c); acb_randtest(a, state, 1 + n_randint(state, 200), 10); acb_randtest(b, state, 1 + n_randint(state, 200), 10); acb_randtest(c, state, 1 + n_randint(state, 200), 10); prec = 2 + n_randint(state, 200); acb_div(c, a, b, prec); acb_div(a, a, b, prec); if (!acb_equal(a, c)) { flint_printf("FAIL: aliasing c, a\n\n"); flint_printf("a = "); acb_print(a); flint_printf("\n\n"); flint_printf("b = "); acb_print(b); flint_printf("\n\n"); flint_printf("c = "); acb_print(c); flint_printf("\n\n"); abort(); } acb_clear(a); acb_clear(b); acb_clear(c); } /* test aliasing of c and b */ for (iter = 0; iter < 100000; iter++) { acb_t a, b, c; slong prec; acb_init(a); acb_init(b); acb_init(c); acb_randtest(a, state, 1 + n_randint(state, 200), 10); acb_randtest(b, state, 1 + n_randint(state, 200), 10); acb_randtest(c, state, 1 + n_randint(state, 200), 10); prec = 2 + n_randint(state, 200); acb_div(c, a, b, prec); acb_div(b, a, b, prec); if (!acb_equal(b, c)) { flint_printf("FAIL: aliasing c, b\n\n"); flint_printf("a = "); acb_print(a); flint_printf("\n\n"); flint_printf("b = "); acb_print(b); flint_printf("\n\n"); flint_printf("c = "); acb_print(c); flint_printf("\n\n"); abort(); } acb_clear(a); acb_clear(b); acb_clear(c); } /* test aliasing a, a */ for (iter = 0; iter < 100000; iter++) { acb_t a, b, c, d; slong prec; acb_init(a); acb_init(b); acb_init(c); acb_init(d); acb_randtest(a, state, 1 + n_randint(state, 200), 10); acb_randtest(b, state, 1 + n_randint(state, 200), 10); acb_randtest(c, state, 1 + n_randint(state, 200), 10); prec = 2 + n_randint(state, 200); acb_set(b, a); acb_div(c, a, a, prec); acb_div(d, a, b, prec); if (!acb_overlaps(c, d)) { flint_printf("FAIL: aliasing a, a\n\n"); flint_printf("a = "); acb_print(a); flint_printf("\n\n"); flint_printf("b = "); acb_print(b); flint_printf("\n\n"); flint_printf("c = "); acb_print(c); flint_printf("\n\n"); flint_printf("d = "); acb_print(d); flint_printf("\n\n"); abort(); } acb_clear(a); acb_clear(b); acb_clear(c); acb_clear(d); } /* test aliasing a, a, a */ for (iter = 0; iter < 100000; iter++) { acb_t a, b, c; slong prec; acb_init(a); acb_init(b); acb_init(c); acb_randtest(a, state, 1 + n_randint(state, 200), 10); acb_randtest(b, state, 1 + n_randint(state, 200), 10); acb_randtest(c, state, 1 + n_randint(state, 200), 10); prec = 2 + n_randint(state, 200); acb_set(b, a); acb_div(c, a, b, prec); acb_div(a, a, a, prec); if (!acb_overlaps(a, c)) { flint_printf("FAIL: aliasing a, a, a\n\n"); flint_printf("a = "); acb_print(a); flint_printf("\n\n"); flint_printf("b = "); acb_print(b); flint_printf("\n\n"); flint_printf("c = "); acb_print(c); flint_printf("\n\n"); abort(); } acb_clear(a); acb_clear(b); acb_clear(c); } /* test (a+b)/c = a/c + b/c */ for (iter = 0; iter < 100000; iter++) { acb_t a, b, c, d, e, f; acb_init(a); acb_init(b); acb_init(c); acb_init(d); acb_init(e); acb_init(f); acb_randtest(a, state, 1 + n_randint(state, 200), 10); acb_randtest(b, state, 1 + n_randint(state, 200), 10); acb_randtest(c, state, 1 + n_randint(state, 200), 10); acb_add(d, a, b, 2 + n_randint(state, 200)); acb_div(e, d, c, 2 + n_randint(state, 200)); acb_div(d, a, c, 2 + n_randint(state, 200)); acb_div(f, b, c, 2 + n_randint(state, 200)); acb_add(f, d, f, 2 + n_randint(state, 200)); if (!acb_overlaps(e, f)) { flint_printf("FAIL: (a+b)/c = a/c + b/c\n\n"); flint_printf("a = "); acb_print(a); flint_printf("\n\n"); flint_printf("b = "); acb_print(b); flint_printf("\n\n"); flint_printf("c = "); acb_print(c); flint_printf("\n\n"); flint_printf("e = "); acb_print(e); flint_printf("\n\n"); flint_printf("f = "); acb_print(f); flint_printf("\n\n"); abort(); } acb_clear(a); acb_clear(b); acb_clear(c); acb_clear(d); acb_clear(e); acb_clear(f); } flint_randclear(state); flint_cleanup(); flint_printf("PASS\n"); return EXIT_SUCCESS; }
int main() { long iter; flint_rand_t state; printf("lambda...."); fflush(stdout); flint_randinit(state); for (iter = 0; iter < 10000; iter++) { acb_t tau1, tau2, z1, z2, z3, t; long e0, prec0, prec1, prec2, step; acb_init(tau1); acb_init(tau2); acb_init(z1); acb_init(z2); acb_init(z3); acb_init(t); e0 = 1 + n_randint(state, 100); prec0 = 2 + n_randint(state, 1000); prec1 = 2 + n_randint(state, 1000); prec2 = 2 + n_randint(state, 1000); acb_randtest(tau1, state, prec0, e0); acb_randtest(tau2, state, prec0, e0); acb_randtest(z1, state, prec0, e0); acb_randtest(z2, state, prec0, e0); acb_set(tau2, tau1); step = n_randint(state, 10); /* Test invariance */ while (step --> 0) { if (n_randint(state, 2)) { acb_add_ui(tau2, tau2, 2, prec0); } else { acb_mul_si(z1, tau2, -2, prec0); acb_add_ui(z1, z1, 1, prec0); acb_div(tau2, tau2, z1, prec0); } } acb_modular_lambda(z1, tau1, prec1); acb_modular_lambda(z2, tau2, prec2); /* Compare with eta */ acb_mul_2exp_si(tau1, tau1, -1); acb_modular_eta(z3, tau1, prec2); acb_mul_2exp_si(tau1, tau1, 2); acb_modular_eta(t, tau1, prec2); acb_mul(t, t, t, prec2); acb_mul(z3, z3, t, prec2); acb_mul_2exp_si(tau1, tau1, -1); acb_modular_eta(t, tau1, prec2); acb_pow_ui(t, t, 3, prec2); acb_div(z3, z3, t, prec2); acb_pow_ui(z3, z3, 8, prec2); acb_mul_2exp_si(z3, z3, 4); if (!acb_overlaps(z1, z2) || !acb_overlaps(z1, z3)) { printf("FAIL (overlap)\n"); printf("tau1 = "); acb_printd(tau1, 15); printf("\n\n"); printf("tau2 = "); acb_printd(tau2, 15); printf("\n\n"); printf("z1 = "); acb_printd(z1, 15); printf("\n\n"); printf("z2 = "); acb_printd(z2, 15); printf("\n\n"); printf("z3 = "); acb_printd(z3, 15); printf("\n\n"); abort(); } acb_modular_lambda(tau1, tau1, prec2); if (!acb_overlaps(z1, tau1)) { printf("FAIL (aliasing)\n"); printf("tau1 = "); acb_printd(tau1, 15); printf("\n\n"); printf("tau2 = "); acb_printd(tau2, 15); printf("\n\n"); printf("z1 = "); acb_printd(z1, 15); printf("\n\n"); printf("z2 = "); acb_printd(z2, 15); printf("\n\n"); abort(); } acb_clear(tau1); acb_clear(tau2); acb_clear(z1); acb_clear(z2); acb_clear(z3); acb_clear(t); } flint_randclear(state); flint_cleanup(); printf("PASS\n"); return EXIT_SUCCESS; }
int main() { slong iter; flint_rand_t state; flint_printf("jacobi_p...."); fflush(stdout); flint_randinit(state); for (iter = 0; iter < 1000; iter++) { acb_t n, a, b, n1, a1, b1, z, res1, res2, res3, s; slong prec; acb_init(n); acb_init(a); acb_init(b); acb_init(n1); acb_init(a1); acb_init(b1); acb_init(z); acb_init(res1); acb_init(res2); acb_init(res3); acb_init(s); prec = 2 + n_randint(state, 300); if (n_randint(state, 2)) { acb_set_si(n, n_randint(state, 20) - 10); acb_set_si(a, n_randint(state, 20) - 10); acb_set_si(b, n_randint(state, 20) - 10); } else { acb_randtest_param(n, state, 1 + n_randint(state, 400), 10); acb_randtest_param(a, state, 1 + n_randint(state, 400), 10); acb_randtest_param(b, state, 1 + n_randint(state, 400), 10); } acb_randtest_param(z, state, 1 + n_randint(state, 400), 10); acb_sub_ui(n1, n, 1, prec); acb_sub_ui(a1, a, 1, prec); acb_sub_ui(b1, b, 1, prec); acb_hypgeom_jacobi_p(res1, n, a, b1, z, prec); acb_hypgeom_jacobi_p(res2, n, a1, b, z, 2 + n_randint(state, 300)); acb_hypgeom_jacobi_p(res3, n1, a, b, z, 2 + n_randint(state, 300)); acb_sub(s, res1, res2, prec); if (!acb_overlaps(s, res3)) { flint_printf("FAIL: consistency\n\n"); flint_printf("iter = %wd\n\n", iter); flint_printf("n = "); acb_printd(n, 30); flint_printf("\n\n"); flint_printf("a = "); acb_printd(a, 30); flint_printf("\n\n"); flint_printf("b = "); acb_printd(b, 30); flint_printf("\n\n"); flint_printf("z = "); acb_printd(z, 30); flint_printf("\n\n"); flint_printf("res1 = "); acb_printd(res1, 30); flint_printf("\n\n"); flint_printf("res2 = "); acb_printd(res2, 30); flint_printf("\n\n"); flint_printf("res3 = "); acb_printd(res3, 30); flint_printf("\n\n"); flint_printf("s = "); acb_printd(s, 30); flint_printf("\n\n"); abort(); } acb_clear(n); acb_clear(a); acb_clear(b); acb_clear(n1); acb_clear(a1); acb_clear(b1); acb_clear(z); acb_clear(res1); acb_clear(res2); acb_clear(res3); acb_clear(s); } flint_randclear(state); flint_cleanup(); flint_printf("PASS\n"); return EXIT_SUCCESS; }
slong _acb_poly_validate_roots(acb_ptr roots, acb_srcptr poly, slong len, slong prec) { slong i, j, deg; slong isolated, nonisolated, total_isolated; acb_ptr deriv; acb_ptr tmp; int *overlap; deg = len - 1; deriv = _acb_vec_init(deg); overlap = flint_calloc(deg, sizeof(int)); tmp = flint_malloc(sizeof(acb_struct) * deg); _acb_poly_derivative(deriv, poly, len, prec); /* compute an inclusion interval for each point */ for (i = 0; i < deg; i++) { _acb_poly_root_inclusion(roots + i, roots + i, poly, deriv, len, prec); } /* find which points do not overlap with any other points */ for (i = 0; i < deg; i++) { for (j = i + 1; j < deg; j++) { if (acb_overlaps(roots + i, roots + j)) { overlap[i] = overlap[j] = 1; } } } /* count and move all isolated roots to the front of the array */ total_isolated = 0; for (i = 0; i < deg; i++) total_isolated += (overlap[i] == 0); for (i = 0; i < deg; i++) tmp[i] = roots[i]; isolated = 0; nonisolated = 0; for (i = 0; i < deg; i++) { if (overlap[i] == 0) { roots[isolated] = tmp[i]; isolated++; } else { roots[total_isolated + nonisolated] = tmp[i]; nonisolated++; } } _acb_vec_clear(deriv, deg); flint_free(tmp); flint_free(overlap); return isolated; }
int main() { slong iter; flint_rand_t state; flint_printf("rising2_ui...."); fflush(stdout); flint_randinit(state); for (iter = 0; iter < 1000; iter++) { acb_t a, u, v, u2, v2; fmpz *f; acb_ptr g; ulong n; slong i, prec; acb_init(a); acb_init(u); acb_init(v); acb_init(u2); acb_init(v2); acb_randtest(a, state, 1 + n_randint(state, 4000), 10); acb_randtest(u, state, 1 + n_randint(state, 4000), 10); acb_randtest(v, state, 1 + n_randint(state, 4000), 10); n = n_randint(state, 120); f = _fmpz_vec_init(n + 1); g = _acb_vec_init(n + 1); prec = 2 + n_randint(state, 4000); acb_rising2_ui(u, v, a, n, prec); arith_stirling_number_1u_vec(f, n, n + 1); for (i = 0; i <= n; i++) acb_set_fmpz(g + i, f + i); _acb_poly_evaluate(u2, g, n + 1, a, prec); _acb_poly_derivative(g, g, n + 1, prec); _acb_poly_evaluate(v2, g, n, a, prec); if (!acb_overlaps(u, u2) || !acb_overlaps(v, v2)) { flint_printf("FAIL: overlap\n\n"); flint_printf("n = %wu\n", n); flint_printf("a = "); acb_printd(a, 15); flint_printf("\n\n"); flint_printf("u = "); acb_printd(u, 15); flint_printf("\n\n"); flint_printf("u2 = "); acb_printd(u2, 15); flint_printf("\n\n"); flint_printf("v = "); acb_printd(v, 15); flint_printf("\n\n"); flint_printf("v2 = "); acb_printd(v2, 15); flint_printf("\n\n"); abort(); } acb_set(u2, a); acb_rising2_ui(u2, v, u2, n, prec); if (!acb_equal(u2, u)) { flint_printf("FAIL: aliasing 1\n\n"); flint_printf("a = "); acb_printd(a, 15); flint_printf("\n\n"); flint_printf("u = "); acb_printd(u, 15); flint_printf("\n\n"); flint_printf("u2 = "); acb_printd(u2, 15); flint_printf("\n\n"); flint_printf("n = %wu\n", n); abort(); } acb_set(v2, a); acb_rising2_ui(u, v2, v2, n, prec); if (!acb_equal(v2, v)) { flint_printf("FAIL: aliasing 2\n\n"); flint_printf("a = "); acb_printd(a, 15); flint_printf("\n\n"); flint_printf("v = "); acb_printd(v, 15); flint_printf("\n\n"); flint_printf("v2 = "); acb_printd(v2, 15); flint_printf("\n\n"); flint_printf("n = %wu\n", n); abort(); } acb_clear(a); acb_clear(u); acb_clear(v); acb_clear(u2); acb_clear(v2); _fmpz_vec_clear(f, n + 1); _acb_vec_clear(g, n + 1); } flint_randclear(state); flint_cleanup(); flint_printf("PASS\n"); return EXIT_SUCCESS; }
int main() { slong iter; flint_rand_t state; flint_printf("agm1...."); fflush(stdout); flint_randinit(state); /* check particular values against table */ { acb_t z, t; acb_ptr w1; slong i, j, prec, cnj; acb_init(z); acb_init(t); w1 = _acb_vec_init(NUM_DERIVS); for (prec = 32; prec <= 512; prec *= 4) { for (i = 0; i < NUM_TESTS; i++) { for (cnj = 0; cnj < 2; cnj++) { if (cnj == 1 && agm_testdata[i][0] < 0 && agm_testdata[i][1] == 0) continue; acb_zero(z); arf_set_d(arb_midref(acb_realref(z)), agm_testdata[i][0]); arf_set_d(arb_midref(acb_imagref(z)), cnj ? -agm_testdata[i][1] : agm_testdata[i][1]); acb_agm1_cpx(w1, z, NUM_DERIVS, prec); for (j = 0; j < NUM_DERIVS; j++) { arf_set_d(arb_midref(acb_realref(t)), agm_testdata[i][2+2*j]); mag_set_d(arb_radref(acb_realref(t)), fabs(agm_testdata[i][2+2*j]) * EPS); arf_set_d(arb_midref(acb_imagref(t)), cnj ? -agm_testdata[i][2+2*j+1] : agm_testdata[i][2+2*j+1]); mag_set_d(arb_radref(acb_imagref(t)), fabs(agm_testdata[i][2+2*j+1]) * EPS); if (!acb_overlaps(w1 + j, t)) { flint_printf("FAIL\n\n"); flint_printf("j = %wd\n\n", j); flint_printf("z = "); acb_printd(z, 15); flint_printf("\n\n"); flint_printf("t = "); acb_printd(t, 15); flint_printf("\n\n"); flint_printf("w1 = "); acb_printd(w1 + j, 15); flint_printf("\n\n"); abort(); } } } } } _acb_vec_clear(w1, NUM_DERIVS); acb_clear(z); acb_clear(t); } /* self-consistency test */ for (iter = 0; iter < 1000 * arb_test_multiplier(); iter++) { acb_ptr m1, m2; acb_t z1, z2, t; slong i, len1, len2, prec1, prec2; len1 = n_randint(state, 10); len2 = n_randint(state, 10); prec1 = 2 + n_randint(state, 2000); prec2 = 2 + n_randint(state, 2000); m1 = _acb_vec_init(len1); m2 = _acb_vec_init(len2); acb_init(z1); acb_init(z2); acb_init(t); acb_randtest(z1, state, prec1, 1 + n_randint(state, 100)); if (n_randint(state, 2)) { acb_set(z2, z1); } else { acb_randtest(t, state, prec2, 1 + n_randint(state, 100)); acb_add(z2, z1, t, prec2); acb_sub(z2, z2, t, prec2); } acb_agm1_cpx(m1, z1, len1, prec1); acb_agm1_cpx(m2, z2, len2, prec2); for (i = 0; i < FLINT_MIN(len1, len2); i++) { if (!acb_overlaps(m1 + i, m2 + i)) { flint_printf("FAIL (overlap)\n\n"); flint_printf("iter = %wd, i = %wd, len1 = %wd, len2 = %wd, prec1 = %wd, prec2 = %wd\n\n", iter, i, len1, len2, prec1, prec2); flint_printf("z1 = "); acb_printd(z1, 30); flint_printf("\n\n"); flint_printf("z2 = "); acb_printd(z2, 30); flint_printf("\n\n"); flint_printf("m1 = "); acb_printd(m1, 30); flint_printf("\n\n"); flint_printf("m2 = "); acb_printd(m2, 30); flint_printf("\n\n"); abort(); } } _acb_vec_clear(m1, len1); _acb_vec_clear(m2, len2); acb_clear(z1); acb_clear(z2); acb_clear(t); } flint_randclear(state); flint_cleanup(); flint_printf("PASS\n"); return EXIT_SUCCESS; }
int main() { long iter; flint_rand_t state; printf("bessel_j...."); fflush(stdout); flint_randinit(state); for (iter = 0; iter < 2000; iter++) { acb_t nu0, nu1, nu2, z, w0, w1, w2, t, u; long prec0, prec1, prec2; acb_init(nu0); acb_init(nu1); acb_init(nu2); acb_init(z); acb_init(w0); acb_init(w1); acb_init(w2); acb_init(t); acb_init(u); prec0 = 2 + n_randint(state, 1000); prec1 = 2 + n_randint(state, 1000); prec2 = 2 + n_randint(state, 1000); acb_randtest_param(nu0, state, 1 + n_randint(state, 1000), 1 + n_randint(state, 100)); acb_randtest(z, state, 1 + n_randint(state, 1000), 1 + n_randint(state, 100)); acb_randtest(w0, state, 1 + n_randint(state, 1000), 1 + n_randint(state, 100)); acb_randtest(w1, state, 1 + n_randint(state, 1000), 1 + n_randint(state, 100)); acb_randtest(w2, state, 1 + n_randint(state, 1000), 1 + n_randint(state, 100)); acb_sub_ui(nu1, nu0, 1, prec0); acb_sub_ui(nu2, nu0, 2, prec0); switch (n_randint(state, 3)) { case 0: acb_hypgeom_bessel_j_asymp(w0, nu0, z, prec0); break; case 1: acb_hypgeom_bessel_j_0f1(w0, nu0, z, prec0); break; default: acb_hypgeom_bessel_j(w0, nu0, z, prec0); } switch (n_randint(state, 3)) { case 0: acb_hypgeom_bessel_j_asymp(w1, nu0, z, prec1); break; case 1: acb_hypgeom_bessel_j_0f1(w1, nu0, z, prec1); break; default: acb_hypgeom_bessel_j(w1, nu0, z, prec1); } if (!acb_overlaps(w0, w1)) { printf("FAIL: consistency\n\n"); printf("nu = "); acb_printd(nu0, 30); printf("\n\n"); printf("z = "); acb_printd(z, 30); printf("\n\n"); printf("w0 = "); acb_printd(w0, 30); printf("\n\n"); printf("w1 = "); acb_printd(w1, 30); printf("\n\n"); abort(); } switch (n_randint(state, 3)) { case 0: acb_hypgeom_bessel_j_asymp(w1, nu1, z, prec1); break; case 1: acb_hypgeom_bessel_j_0f1(w1, nu1, z, prec1); break; default: acb_hypgeom_bessel_j(w1, nu1, z, prec1); } switch (n_randint(state, 3)) { case 0: acb_hypgeom_bessel_j_asymp(w2, nu2, z, prec2); break; case 1: acb_hypgeom_bessel_j_0f1(w2, nu2, z, prec2); break; default: acb_hypgeom_bessel_j(w2, nu2, z, prec2); } acb_mul(t, w1, nu1, prec0); acb_mul_2exp_si(t, t, 1); acb_submul(t, w2, z, prec0); acb_submul(t, w0, z, prec0); if (!acb_contains_zero(t)) { printf("FAIL: contiguous relation\n\n"); printf("nu = "); acb_printd(nu0, 30); printf("\n\n"); printf("z = "); acb_printd(z, 30); printf("\n\n"); printf("w0 = "); acb_printd(w0, 30); printf("\n\n"); printf("w1 = "); acb_printd(w1, 30); printf("\n\n"); printf("w2 = "); acb_printd(w2, 30); printf("\n\n"); printf("t = "); acb_printd(t, 30); printf("\n\n"); abort(); } acb_neg(t, nu0); switch (n_randint(state, 3)) { case 0: acb_hypgeom_bessel_j_asymp(w2, t, z, prec2); break; case 1: acb_hypgeom_bessel_j_0f1(w2, t, z, prec2); break; default: acb_hypgeom_bessel_j(w2, t, z, prec2); } acb_mul(w1, w1, w2, prec2); acb_neg(t, nu1); switch (n_randint(state, 3)) { case 0: acb_hypgeom_bessel_j_asymp(w2, t, z, prec2); break; case 1: acb_hypgeom_bessel_j_0f1(w2, t, z, prec2); break; default: acb_hypgeom_bessel_j(w2, t, z, prec2); } acb_mul(w0, w0, w2, prec2); acb_add(w0, w0, w1, prec2); acb_sin_pi(t, nu0, prec2); acb_const_pi(u, prec2); acb_mul(u, u, z, prec2); acb_div(t, t, u, prec2); acb_mul_2exp_si(t, t, 1); if (!acb_overlaps(w0, t)) { printf("FAIL: wronskian\n\n"); printf("nu = "); acb_printd(nu0, 30); printf("\n\n"); printf("z = "); acb_printd(z, 30); printf("\n\n"); printf("w0 = "); acb_printd(w0, 30); printf("\n\n"); printf("t = "); acb_printd(t, 30); printf("\n\n"); abort(); } acb_clear(nu0); acb_clear(nu1); acb_clear(nu2); acb_clear(z); acb_clear(w0); acb_clear(w1); acb_clear(w2); acb_clear(t); acb_clear(u); } flint_randclear(state); flint_cleanup(); printf("PASS\n"); return EXIT_SUCCESS; }
int main() { slong iter; flint_rand_t state; flint_printf("zeta_cpx_series...."); fflush(stdout); flint_randinit(state); for (iter = 0; iter < 1000 * arb_test_multiplier(); iter++) { acb_t s, a; acb_ptr z1, z2; slong i, len, prec1, prec2; int deflate; acb_init(s); acb_init(a); if (n_randint(state, 2)) { acb_randtest(s, state, 1 + n_randint(state, 300), 3); } else { arb_set_ui(acb_realref(s), 1); arb_mul_2exp_si(acb_realref(s), acb_realref(s), -1); arb_randtest(acb_imagref(s), state, 1 + n_randint(state, 300), 4); } switch (n_randint(state, 3)) { case 0: acb_randtest(a, state, 1 + n_randint(state, 300), 3); break; case 1: arb_randtest(acb_realref(a), state, 1 + n_randint(state, 300), 3); break; case 2: acb_one(a); break; } prec1 = 2 + n_randint(state, 300); prec2 = prec1 + 30; len = 1 + n_randint(state, 20); deflate = n_randint(state, 2); z1 = _acb_vec_init(len); z2 = _acb_vec_init(len); _acb_poly_zeta_cpx_series(z1, s, a, deflate, len, prec1); _acb_poly_zeta_cpx_series(z2, s, a, deflate, len, prec2); for (i = 0; i < len; i++) { if (!acb_overlaps(z1 + i, z2 + i)) { flint_printf("FAIL: overlap\n\n"); flint_printf("iter = %wd\n", iter); flint_printf("deflate = %d, len = %wd, i = %wd\n\n", deflate, len, i); flint_printf("s = "); acb_printd(s, prec1 / 3.33); flint_printf("\n\n"); flint_printf("a = "); acb_printd(a, prec1 / 3.33); flint_printf("\n\n"); flint_printf("z1 = "); acb_printd(z1 + i, prec1 / 3.33); flint_printf("\n\n"); flint_printf("z2 = "); acb_printd(z2 + i, prec2 / 3.33); flint_printf("\n\n"); abort(); } } acb_clear(a); acb_clear(s); _acb_vec_clear(z1, len); _acb_vec_clear(z2, len); } flint_randclear(state); flint_cleanup(); flint_printf("PASS\n"); return EXIT_SUCCESS; }
int main() { slong iter; flint_rand_t state; flint_printf("eisenstein...."); fflush(stdout); flint_randinit(state); /* Test functional equation */ for (iter = 0; iter < 10000 * arb_test_multiplier(); iter++) { acb_t tau1, tau2, t; acb_ptr r1, r2; slong e0, prec0, prec1, prec2, len1, len2, i; psl2z_t g; psl2z_init(g); acb_init(tau1); acb_init(tau2); acb_init(t); e0 = 1 + n_randint(state, 200); prec0 = 2 + n_randint(state, 2000); prec1 = 2 + n_randint(state, 2000); prec2 = 2 + n_randint(state, 2000); len1 = n_randint(state, 20); len2 = n_randint(state, 20); r1 = _acb_vec_init(len1); r2 = _acb_vec_init(len2); acb_randtest(tau1, state, prec0, e0); acb_randtest(tau2, state, prec0, e0); psl2z_randtest(g, state, 1 + n_randint(state, 200)); acb_modular_transform(tau2, g, tau1, prec0); acb_modular_eisenstein(r1, tau1, len1, prec1); acb_modular_eisenstein(r2, tau2, len2, prec2); for (i = 0; i < FLINT_MIN(len1, len2); i++) { acb_mul_fmpz(t, tau1, &g->c, prec1); acb_add_fmpz(t, t, &g->d, prec1); acb_pow_ui(t, t, 2 * i + 4, prec1); acb_mul(t, t, r1 + i, prec1); if (!acb_overlaps(t, r2 + i)) { flint_printf("FAIL (overlap)\n"); flint_printf("tau1 = "); acb_printd(tau1, 15); flint_printf("\n\n"); flint_printf("tau2 = "); acb_printd(tau2, 15); flint_printf("\n\n"); flint_printf("g = "); psl2z_print(g); flint_printf("\n\n"); flint_printf("r1 = "); acb_printd(r1 + i, 15); flint_printf("\n\n"); flint_printf("r2 = "); acb_printd(r2 + i, 15); flint_printf("\n\n"); flint_printf("t = "); acb_printd(t, 15); flint_printf("\n\n"); flint_abort(); } } acb_clear(tau1); acb_clear(tau2); acb_clear(t); _acb_vec_clear(r1, len1); _acb_vec_clear(r2, len2); psl2z_clear(g); } flint_randclear(state); flint_cleanup(); flint_printf("PASS\n"); return EXIT_SUCCESS; }
int main() { long iter; flint_rand_t state; printf("gamma_upper...."); fflush(stdout); flint_randinit(state); for (iter = 0; iter < 2000; iter++) { acb_t a0, a1, b, z, w0, w1, t, u; long prec0, prec1; int modified; acb_init(a0); acb_init(a1); acb_init(b); acb_init(z); acb_init(w0); acb_init(w1); acb_init(t); acb_init(u); modified = n_randint(state, 2); prec0 = 2 + n_randint(state, 1000); prec1 = 2 + n_randint(state, 1000); acb_randtest_maybe_half_int(a0, state, 1 + n_randint(state, 1000), 1 + n_randint(state, 100)); acb_randtest(z, state, 1 + n_randint(state, 1000), 1 + n_randint(state, 100)); acb_randtest(w0, state, 1 + n_randint(state, 1000), 1 + n_randint(state, 100)); acb_randtest(w1, state, 1 + n_randint(state, 1000), 1 + n_randint(state, 100)); acb_add_ui(a1, a0, 1, prec0); switch (n_randint(state, 4)) { case 0: acb_hypgeom_gamma_upper_asymp(w0, a0, z, modified, prec0); break; case 1: acb_hypgeom_gamma_upper_1f1a(w0, a0, z, modified, prec0); break; case 2: acb_hypgeom_gamma_upper_1f1b(w0, a0, z, modified, prec0); break; default: acb_hypgeom_gamma_upper(w0, a0, z, modified, prec0); } switch (n_randint(state, 4)) { case 0: acb_hypgeom_gamma_upper_asymp(w1, a0, z, modified, prec1); break; case 1: acb_hypgeom_gamma_upper_1f1a(w1, a0, z, modified, prec1); break; case 2: acb_hypgeom_gamma_upper_1f1b(w1, a0, z, modified, prec1); break; default: acb_hypgeom_gamma_upper(w1, a0, z, modified, prec1); } if (!acb_overlaps(w0, w1)) { printf("FAIL: consistency\n\n"); printf("nu = "); acb_printd(a0, 30); printf("\n\n"); printf("z = "); acb_printd(z, 30); printf("\n\n"); printf("w0 = "); acb_printd(w0, 30); printf("\n\n"); printf("w1 = "); acb_printd(w1, 30); printf("\n\n"); abort(); } switch (n_randint(state, 4)) { case 0: acb_hypgeom_gamma_upper_asymp(w1, a1, z, modified, prec1); break; case 1: acb_hypgeom_gamma_upper_1f1a(w1, a1, z, modified, prec1); break; case 2: acb_hypgeom_gamma_upper_1f1b(w1, a1, z, modified, prec1); break; default: acb_hypgeom_gamma_upper(w1, a1, z, modified, prec1); } /* a Gamma(a,z) + exp(-z) z^a = Gamma(a+1,z) */ if (modified) acb_one(t); else acb_pow(t, z, a0, prec0); acb_neg(u, z); acb_exp(u, u, prec0); acb_mul(t, t, u, prec0); if (modified) { acb_mul(b, w1, z, prec0); acb_addmul(t, a0, w0, prec0); acb_sub(t, t, b, prec0); } else { acb_addmul(t, a0, w0, prec0); acb_sub(t, t, w1, prec0); } if (!acb_contains_zero(t)) { printf("FAIL: contiguous relation\n\n"); printf("nu = "); acb_printd(a0, 30); printf("\n\n"); printf("z = "); acb_printd(z, 30); printf("\n\n"); printf("w0 = "); acb_printd(w0, 30); printf("\n\n"); printf("w1 = "); acb_printd(w1, 30); printf("\n\n"); printf("t = "); acb_printd(t, 30); printf("\n\n"); abort(); } acb_clear(a0); acb_clear(a1); acb_clear(b); acb_clear(z); acb_clear(w0); acb_clear(w1); acb_clear(t); acb_clear(u); } flint_randclear(state); flint_cleanup(); printf("PASS\n"); return EXIT_SUCCESS; }
int main() { slong iter; flint_rand_t state; flint_printf("2f1...."); fflush(stdout); flint_randinit(state); for (iter = 0; iter < 3000; iter++) { acb_t a, b, c, z, w1, w2, t; slong prec1, prec2; int reg1, reg2, ebits; int alg1, alg2; acb_init(a); acb_init(b); acb_init(c); acb_init(z); acb_init(w1); acb_init(w2); acb_init(t); prec1 = 2 + n_randint(state, 300); prec2 = 2 + n_randint(state, 300); if (n_randint(state, 20) == 0) ebits = 30; else ebits = 5; switch (n_randint(state, 3)) { case 0: acb_set_si(a, n_randint(state, 500)); acb_set_si(b, n_randint(state, 500)); acb_set_si(c, n_randint(state, 10)); break; case 1: acb_set_si(a, n_randint(state, 200) - 100); acb_set_si(b, n_randint(state, 200) - 100); acb_set_si(c, n_randint(state, 200) - 100); break; default: acb_randtest_param(a, state, 1 + n_randint(state, 400), 1 + n_randint(state, ebits)); acb_randtest_param(b, state, 1 + n_randint(state, 400), 1 + n_randint(state, ebits)); acb_randtest_param(c, state, 1 + n_randint(state, 400), 1 + n_randint(state, ebits)); } acb_randtest_param(z, state, 1 + n_randint(state, 400), 1 + n_randint(state, ebits)); acb_randtest(w1, state, 1 + n_randint(state, 400), 1 + n_randint(state, ebits)); acb_randtest(w2, state, 1 + n_randint(state, 400), 1 + n_randint(state, ebits)); reg1 = n_randint(state, 2); reg2 = n_randint(state, 2); alg1 = n_randint(state, 10); alg2 = n_randint(state, 10); switch (alg1) { case 0: acb_hypgeom_2f1_direct(w1, a, b, c, z, reg1, prec1); break; case 1: case 2: case 3: case 4: case 5: acb_hypgeom_2f1_transform(w1, a, b, c, z, reg1, alg1, prec1); break; case 6: acb_hypgeom_2f1_corner(w1, a, b, c, z, reg1, prec1); break; default: acb_hypgeom_2f1(w1, a, b, c, z, reg1, prec1); } switch (alg2) { case 0: acb_hypgeom_2f1_direct(w2, a, b, c, z, reg2, prec2); break; case 1: case 2: case 3: case 4: case 5: acb_hypgeom_2f1_transform(w2, a, b, c, z, reg2, alg2, prec2); break; case 6: acb_hypgeom_2f1_corner(w2, a, b, c, z, reg2, prec2); break; default: acb_hypgeom_2f1(w2, a, b, c, z, reg2, prec2); } if (reg1 != reg2) { acb_rgamma(t, c, prec2); if (reg1) acb_mul(w2, w2, t, prec2); else acb_mul(w1, w1, t, prec2); } if (!acb_overlaps(w1, w2)) { flint_printf("FAIL: consistency\n\n"); flint_printf("iter = %wd, prec1 = %wd, prec2 = %wd\n\n", iter, prec1, prec2); flint_printf("alg1 = %d, alg2 = %d\n\n", alg1, alg2); flint_printf("reg1 = %d, reg2 = %d\n\n", reg1, reg2); flint_printf("a = "); acb_printd(a, 30); flint_printf("\n\n"); flint_printf("b = "); acb_printd(b, 30); flint_printf("\n\n"); flint_printf("c = "); acb_printd(c, 30); 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"); abort(); } acb_clear(a); acb_clear(b); acb_clear(c); acb_clear(z); acb_clear(w1); acb_clear(w2); acb_clear(t); } flint_randclear(state); flint_cleanup(); flint_printf("PASS\n"); return EXIT_SUCCESS; }
int main() { slong iter; flint_rand_t state; flint_printf("fundamental_domain_approx...."); fflush(stdout); flint_randinit(state); for (iter = 0; iter < 10000 * arb_test_multiplier(); iter++) { fmpq_t x, y; psl2z_t g; arf_t one_minus_eps, tol; acb_t z, w, w2; arb_t t; slong prec; fmpq_init(x); fmpq_init(y); psl2z_init(g); acb_init(z); acb_init(w); acb_init(w2); arf_init(one_minus_eps); arf_init(tol); arb_init(t); /* pick an exact point in the upper half plane */ fmpq_randtest(x, state, 1 + n_randint(state, 500)); do { fmpq_randtest(y, state, 1 + n_randint(state, 500)); } while (fmpz_sgn(fmpq_numref(y)) <= 0); /* pick a tolerance */ arf_set_ui_2exp_si(tol, 1, -(slong) n_randint(state, 500)); /* now increase the precision until convergence */ for (prec = 32; ; prec *= 2) { if (prec > 16384) { flint_printf("FAIL (no convergence)\n"); flint_printf("x = "); fmpq_print(x); flint_printf("\n\n"); flint_printf("y = "); fmpq_print(y); flint_printf("\n\n"); flint_printf("z = "); acb_printd(z, 50); flint_printf("\n\n"); flint_printf("w = "); acb_printd(w, 50); flint_printf("\n\n"); flint_printf("w2 = "); acb_printd(w2, 50); flint_printf("\n\n"); flint_printf("g = "); psl2z_print(g); flint_printf("\n\n"); abort(); } arb_set_fmpq(acb_realref(z), x, prec); arb_set_fmpq(acb_imagref(z), y, prec); arf_set_ui_2exp_si(one_minus_eps, 1, -prec / 4); arf_sub_ui(one_minus_eps, one_minus_eps, 1, prec, ARF_RND_DOWN); arf_neg(one_minus_eps, one_minus_eps); acb_modular_fundamental_domain_approx(w, g, z, one_minus_eps, prec); acb_modular_transform(w2, g, z, prec); if (!psl2z_is_correct(g) || !acb_overlaps(w, w2)) { flint_printf("FAIL (incorrect transformation)\n"); flint_printf("x = "); fmpq_print(x); flint_printf("\n\n"); flint_printf("y = "); fmpq_print(y); flint_printf("\n\n"); flint_printf("z = "); acb_printd(z, 50); flint_printf("\n\n"); flint_printf("w = "); acb_printd(w, 50); flint_printf("\n\n"); flint_printf("w2 = "); acb_printd(w2, 50); flint_printf("\n\n"); flint_printf("g = "); psl2z_print(g); flint_printf("\n\n"); abort(); } /* success */ if (acb_modular_is_in_fundamental_domain(w, tol, prec)) break; } /* check that g^(-1) * w contains x+yi */ psl2z_inv(g, g); acb_modular_transform(w2, g, w, 2 + n_randint(state, 1000)); if (!arb_contains_fmpq(acb_realref(w2), x) || !arb_contains_fmpq(acb_imagref(w2), y)) { flint_printf("FAIL (inverse containment)\n"); flint_printf("x = "); fmpq_print(x); flint_printf("\n\n"); flint_printf("y = "); fmpq_print(y); flint_printf("\n\n"); flint_printf("z = "); acb_printd(z, 50); flint_printf("\n\n"); flint_printf("w = "); acb_printd(w, 50); flint_printf("\n\n"); flint_printf("w2 = "); acb_printd(w2, 50); flint_printf("\n\n"); flint_printf("g = "); psl2z_print(g); flint_printf("\n\n"); abort(); } fmpq_clear(x); fmpq_clear(y); psl2z_clear(g); acb_clear(z); acb_clear(w); acb_clear(w2); arf_clear(one_minus_eps); arf_clear(tol); arb_clear(t); } flint_randclear(state); flint_cleanup(); flint_printf("PASS\n"); return EXIT_SUCCESS; }
int main() { slong iter; flint_rand_t state; flint_printf("si...."); fflush(stdout); flint_randinit(state); for (iter = 0; iter < 10000 * arb_test_multiplier(); iter++) { acb_t z0, z1, w0, w1; slong prec0, prec1; acb_init(z0); acb_init(z1); acb_init(w0); acb_init(w1); prec0 = 2 + n_randint(state, 1000); prec1 = 2 + n_randint(state, 1000); acb_randtest(z0, state, 1 + n_randint(state, 1000), 1 + n_randint(state, 100)); acb_randtest(w0, state, 1 + n_randint(state, 1000), 1 + n_randint(state, 100)); acb_randtest(w1, state, 1 + n_randint(state, 1000), 1 + n_randint(state, 100)); acb_set(z1, z0); if (n_randint(state, 2)) { acb_add(z1, z1, w0, prec0); acb_sub(z1, z1, w0, prec0); } switch (n_randint(state, 3)) { case 0: acb_hypgeom_si_1f2(w0, z0, prec0); break; case 1: acb_hypgeom_si_asymp(w0, z0, prec0); break; default: acb_hypgeom_si(w0, z0, prec0); } switch (n_randint(state, 3)) { case 0: acb_hypgeom_si_1f2(w1, z1, prec1); break; case 1: acb_hypgeom_si_asymp(w1, z1, prec1); break; default: acb_hypgeom_si(w1, z1, prec1); } if (!acb_overlaps(w0, w1)) { flint_printf("FAIL: consistency\n\n"); flint_printf("z0 = "); acb_printd(z0, 30); flint_printf("\n\n"); flint_printf("z1 = "); acb_printd(z1, 30); flint_printf("\n\n"); flint_printf("w0 = "); acb_printd(w0, 30); flint_printf("\n\n"); flint_printf("w1 = "); acb_printd(w1, 30); flint_printf("\n\n"); abort(); } acb_clear(z0); acb_clear(z1); acb_clear(w0); acb_clear(w1); } flint_randclear(state); flint_cleanup(); flint_printf("PASS\n"); return EXIT_SUCCESS; }
int main() { slong iter; flint_rand_t state; flint_printf("theta_sum...."); fflush(stdout); flint_randinit(state); /* Very weak test, just testing the error bounds and not that we compute the right functions */ for (iter = 0; iter < 10000; iter++) { acb_ptr t1a, t1b, t2a, t2b, t3a, t3b, t4a, t4b; acb_t w, q; int w_is_unit; slong prec0, e0, prec1, prec2, len1, len2, i; acb_init(w); acb_init(q); e0 = 1 + n_randint(state, 100); prec0 = 2 + n_randint(state, 3000); prec1 = 2 + n_randint(state, 3000); prec2 = 2 + n_randint(state, 3000); len1 = 1 + n_randint(state, 30); len2 = 1 + n_randint(state, 30); t1a = _acb_vec_init(len1); t2a = _acb_vec_init(len1); t3a = _acb_vec_init(len1); t4a = _acb_vec_init(len1); t1b = _acb_vec_init(len2); t2b = _acb_vec_init(len2); t3b = _acb_vec_init(len2); t4b = _acb_vec_init(len2); if (n_randint(state, 2)) { arb_randtest(acb_realref(q), state, prec0, e0); arb_zero(acb_imagref(q)); acb_exp_pi_i(w, q, prec0); w_is_unit = n_randint(state, 2); } else { acb_randtest(w, state, prec0, e0); w_is_unit = 0; } acb_randtest(q, state, prec0, e0); for (i = 0; i < len1; i++) { acb_randtest(t1a + i, state, prec0, e0); acb_randtest(t2a + i, state, prec0, e0); acb_randtest(t3a + i, state, prec0, e0); acb_randtest(t4a + i, state, prec0, e0); } for (i = 0; i < len2; i++) { acb_randtest(t1b + i, state, prec0, e0); acb_randtest(t2b + i, state, prec0, e0); acb_randtest(t3b + i, state, prec0, e0); acb_randtest(t4b + i, state, prec0, e0); } acb_modular_theta_sum(t1a, t2a, t3a, t4a, w, w_is_unit, q, len1, prec1); acb_modular_theta_sum(t1b, t2b, t3b, t4b, w, w_is_unit & n_randint(state, 2), q, len2, prec2); for (i = 0; i < FLINT_MIN(len1, len2); i++) { if (!acb_overlaps(t1a + i, t1b + i) || !acb_overlaps(t2a + i, t2b + i) || !acb_overlaps(t3a + i, t3b + i) || !acb_overlaps(t4a + i, t4b + i)) { flint_printf("FAIL (overlap) iter = %wd\n", iter); flint_printf("len1 = %wd, len2 = %wd, prec1 = %wd, prec2 = %wd\n\n", len1, len2, prec1, prec2); flint_printf("i = %wd\n\n", i); flint_printf("q = "); acb_printd(q, 50); flint_printf("\n\n"); flint_printf("w = "); acb_printd(w, 50); flint_printf("\n\n"); flint_printf("t1a = "); acb_printd(t1a + i, 50); flint_printf("\n\n"); flint_printf("t1b = "); acb_printd(t1b + i, 50); flint_printf("\n\n"); flint_printf("t2a = "); acb_printd(t2a + i, 50); flint_printf("\n\n"); flint_printf("t2b = "); acb_printd(t2b + i, 50); flint_printf("\n\n"); flint_printf("t3a = "); acb_printd(t3a + i, 50); flint_printf("\n\n"); flint_printf("t3b = "); acb_printd(t3b + i, 50); flint_printf("\n\n"); flint_printf("t4a = "); acb_printd(t4a + i, 50); flint_printf("\n\n"); flint_printf("t4b = "); acb_printd(t4b + i, 50); flint_printf("\n\n"); abort(); } } _acb_vec_clear(t1a, len1); _acb_vec_clear(t2a, len1); _acb_vec_clear(t3a, len1); _acb_vec_clear(t4a, len1); _acb_vec_clear(t1b, len2); _acb_vec_clear(t2b, len2); _acb_vec_clear(t3b, len2); _acb_vec_clear(t4b, len2); acb_clear(w); acb_clear(q); } flint_randclear(state); flint_cleanup(); flint_printf("PASS\n"); return EXIT_SUCCESS; }