diff --git a/acb_dft.h b/acb_dft.h index 01f5ddaa..a1cbc18b 100644 --- a/acb_dft.h +++ b/acb_dft.h @@ -37,6 +37,7 @@ void acb_dft_prod(acb_ptr w, acb_srcptr v, slong * cyc, slong num, slong prec); void acb_dft_convol_naive(acb_ptr w, acb_srcptr f, acb_srcptr g, slong len, slong prec); void acb_dft_convol_dft(acb_ptr w, acb_srcptr f, acb_srcptr g, slong len, slong prec); void acb_dft_convol_rad2(acb_ptr w, acb_srcptr f, acb_srcptr g, slong len, slong prec); +void acb_dft_convol_mullow(acb_ptr w, acb_srcptr f, acb_srcptr g, slong len, slong prec); void acb_dft_convol(acb_ptr w, acb_srcptr f, acb_srcptr g, slong len, slong prec); #define CRT_MAX 15 diff --git a/acb_dft/convol_mullow.c b/acb_dft/convol_mullow.c new file mode 100644 index 00000000..73686e43 --- /dev/null +++ b/acb_dft/convol_mullow.c @@ -0,0 +1,31 @@ +/* + Copyright (C) 2016 Pascal Molin + + 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 . +*/ + +#include "acb_dft.h" +#include "acb_poly.h" + +void +acb_dft_convol_mullow(acb_ptr w, acb_srcptr f, acb_srcptr g, slong len, slong prec) +{ + /* TODO: should probably use (acb_struct *) arrays */ + acb_ptr gg, ww; + if (len == 0) + return; + gg = _acb_vec_init(2 * len - 1); + ww = _acb_vec_init(2 * len - 1); + _acb_vec_set(gg, g, len); + _acb_vec_set(gg + len, g, len - 1); + _acb_poly_mullow(ww, f, len, gg, 2 * len - 1, 2 * len - 1, prec); + _acb_vec_set(w, ww + len, len - 1); + acb_set(w + len - 1, ww + len - 1); + _acb_vec_clear(gg, 2 * len - 1); + _acb_vec_clear(ww, 2 * len - 1); +} diff --git a/acb_dft/profile/p-convol.c b/acb_dft/profile/p-convol.c index 83eec83a..f8231ae5 100644 --- a/acb_dft/profile/p-convol.c +++ b/acb_dft/profile/p-convol.c @@ -26,17 +26,19 @@ int main(int argc, char *argv[]) flint_rand_t state; slong r, nr; - int l, nf = 4; - do_f func[4] = { + int l, nf = 5; + do_f func[5] = { acb_dft_convol_naive, acb_dft_convol_dft, acb_dft_convol_rad2, + acb_dft_convol_mullow, acb_dft_convol, }; - char * name[4] = { + char * name[5] = { "naive", "dft", "rad2", + "mullow", "default" }; diff --git a/acb_dft/test/t-convol.c b/acb_dft/test/t-convol.c index e81bae4e..fded6ce2 100644 --- a/acb_dft/test/t-convol.c +++ b/acb_dft/test/t-convol.c @@ -60,9 +60,9 @@ int main() ulong nr = 5; flint_rand_t state; - slong f, nf = 3; - do_f func[3] = { acb_dft_convol_naive, acb_dft_convol_rad2, acb_dft_convol_dft }; - char * name[3] = { "naive", "rad2", "dft" }; + slong f, nf = 4; + do_f func[4] = { acb_dft_convol_naive, acb_dft_convol_rad2, acb_dft_convol_dft, acb_dft_convol_mullow }; + char * name[4] = { "naive", "rad2", "dft", "mullow" }; flint_printf("convol...."); fflush(stdout);