add dft_convol_mullow

This commit is contained in:
Pascal 2017-10-29 00:52:56 +02:00
parent aa61f5bfed
commit a08e24d04e
4 changed files with 40 additions and 6 deletions

View file

@ -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

31
acb_dft/convol_mullow.c Normal file
View file

@ -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 <http://www.gnu.org/licenses/>.
*/
#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);
}

View file

@ -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"
};

View file

@ -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);