This commit is contained in:
Pascal 2017-10-20 15:21:20 +02:00
parent c4b2b0968f
commit 50548c194e
3 changed files with 35 additions and 30 deletions

View file

@ -75,7 +75,7 @@ acb_dft_naive(acb_ptr w, acb_srcptr v, slong len, slong prec)
_acb_vec_clear(z, len);
}
void
void
_acb_dft_naive_init(acb_dft_naive_t pol, slong dv, acb_ptr z, slong dz, slong len, slong prec)
{
pol->n = len;

View file

@ -142,38 +142,18 @@ acb_dft(acb_ptr w, acb_srcptr v, slong len, slong prec)
void
acb_dft_inverse_precomp(acb_ptr w, acb_srcptr v, const acb_dft_pre_t pre, slong prec)
{
#if 0
acb_ptr v2;
v2 = _acb_vec_init(pre->n);
/* divide before to keep v const */
_acb_vec_scalar_div_ui(v2, v, pre->n, pre->n, prec);
acb_vec_swap_ri(v2, pre->n);
acb_dft_precomp(w, v2, pre, prec);
acb_vec_swap_ri(w, pre->n);
#else
slong k;
acb_dft_precomp(w, v, pre, prec);
for (k = 1; 2 * k < pre->n; k++)
acb_swap(w + k, w + pre->n - k);
_acb_vec_scalar_div_ui(w, w, pre->n, pre->n, prec);
#endif
}
void
acb_dft_inverse(acb_ptr w, acb_srcptr v, slong len, slong prec)
{
#if 0
acb_ptr v2;
v2 = _acb_vec_init(len);
/* divide before to keep v const */
_acb_vec_scalar_div_ui(v2, v, len, len, prec);
acb_vec_swap_ri(v2, len);
acb_dft(w, v2, len, prec);
acb_vec_swap_ri(w, len);
#else
slong k;
acb_dft(w, v, len, prec);
for (k = 1; 2 * k < len; k++)
acb_swap(w + k, w + len - k);
_acb_vec_scalar_div_ui(w, w, len, len, prec);
#endif
}

View file

@ -6,6 +6,9 @@
*Warning: the interfaces in this module are experimental and may change
without notice.*
Discrete Fourier Transform
-------------------------------------------------------------------------------
Let *G* be a finite abelian group, and `\chi` a character of *G*.
For any map `f:G\to\mathbb C`, the discrete fourier transform
`\hat f:\hat G\to \mathbb C` is defined by
@ -14,6 +17,14 @@ For any map `f:G\to\mathbb C`, the discrete fourier transform
\hat f(\chi) = \sum_{x\in G}\overline{\chi(x)}f(x)
Note that by inversion formula
.. math::
\widehat{\hat f}(\chi) = \#G\times f(\chi^{-1})
it is straightforward to recover `f` from its DFT `\hat f`.
Fast Fourier Transform techniques allow to compute efficiently
all values `\hat f(\chi)` by reusing common computations.
@ -31,14 +42,6 @@ each restriction `\chi_{H}`.
This decomposition can be done recursively.
Note that by inversion formula
.. math::
\widehat{\hat f}(\chi) = \#G\times f(\chi^{-1})
it is straightforward to recover `f` from its DFT `\hat f`.
DFT on Z/nZ
-------------------------------------------------------------------------------
@ -71,6 +74,24 @@ If `G=\mathbb Z/n\mathbb Z`, we compute the DFT according to the usual conventio
The default version uses an automatic choice of algorithm (in most cases *crt*).
.. function:: void acb_dft_inverse(acb_ptr w, acb_srcptr v, slong n, slong prec)
Compute the inverse DFT of *v* into *w*.
.. function:: void acb_dft_rad2(acb_ptr w, acb_srcptr v, int e, slong prec)
.. function:: void acb_dft_rad2_inplace(acb_ptr w, int e, slong prec)
Computes the DFT of *v* into *w*, where *v* and *w* have size $2^e$,
using a radix 2 FFT. The ``inplace`` version corresponds to *v=w*.
.. function:: void acb_dft_inverse_rad2(acb_ptr w, acb_srcptr v, int e, slong prec)
.. function:: void acb_dft_inverse_rad2_inplace(acb_ptr w, int e, slong prec)
Computes the inverse DFT of *v* into *w*, where *v* and *w* have size $2^e$,
using a radix 2 FFT. The ``inplace`` version corresponds to *v=w*.
DFT on products
-------------------------------------------------------------------------------
@ -128,6 +149,10 @@ should be reused.
Computes the DFT of the sequence *v* into *w* by applying the precomputed scheme
*pre*. Both *v* and *w* must have length *pre->n*.
.. function:: void acb_dft_inverse_precomp(acb_ptr w, acb_srcptr v, const acb_dft_pre_t pre, slong prec)
Compute the inverse DFT of *v* into *w*.
Convolution
-------------------------------------------------------------------------------
@ -157,4 +182,4 @@ For functions `f` and `g` on `G` we consider the convolution
to compute it using three radix 2 FFT.
The default version uses radix 2 FFT unless *len* is a product of small
primes where a non padded fft is faster.
primes where a non padded FFT is faster.