/* Copyright (C) 2009, 2011 William Hart This file is part of FLINT. FLINT 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 . */ #include #include #include #include "flint.h" #include "ulong_extras.h" #include "fft.h" int main(void) { flint_bitcnt_t depth, w; FLINT_TEST_INIT(state); flint_printf("mul_fft_main...."); fflush(stdout); _flint_rand_init_gmp(state); for (depth = 6; depth <= 12; depth++) { for (w = 1; w <= 3 - (depth >= 12); w++) { int iter = 1 + 200*(depth <= 8) + 80*(depth <= 9) + 10*(depth <= 10), i; for (i = 0; i < iter; i++) { mp_size_t n = (UWORD(1)<= b2 */ { mp_size_t t = n1; flint_bitcnt_t tb = b1; n1 = n2; b1 = b2; n2 = t; b2 = tb; } i1 = flint_malloc(3*(n1 + n2)*sizeof(mp_limb_t)); i2 = i1 + n1; r1 = i2 + n2; r2 = r1 + n1 + n2; flint_mpn_urandomb(i1, state->gmp_state, b1); flint_mpn_urandomb(i2, state->gmp_state, b2); mpn_mul(r2, i1, n1, i2, n2); flint_mpn_mul_fft_main(r1, i1, n1, i2, n2); for (j = 0; j < n1 + n2; j++) { if (r1[j] != r2[j]) { flint_printf("error in limb %wd, %wx != %wx\n", j, r1[j], r2[j]); abort(); } } flint_free(i1); } } } FLINT_TEST_CLEANUP(state); flint_printf("PASS\n"); return 0; }