accelerate-fft-0.13.0.0: FFT using the Accelerate library

Portability non-portable (GHC extensions) experimental Manuel M T Chakravarty None

Data.Array.Accelerate.Math.DFT

Description

Compute the Discrete Fourier Transform (DFT) along the lower order dimension of an array.

This uses a naïve algorithm which takes O(n^2) time. However, you can transform an array with an arbitrary extent, unlike with FFT which requires each dimension to be a power of two.

The `dft` and `idft` functions compute the roots of unity as needed. If you need to transform several arrays with the same extent than it is faster to compute the roots once using `rootsOfUnity` or `inverseRootsOfUnity` respectively, then call `dftG` directly.

You can also compute single values of the transform using `dftGS`

Synopsis

# Documentation

dft :: (Shape sh, Slice sh, Elt e, IsFloating e) => Acc (Array (sh :. Int) (Complex e)) -> Acc (Array (sh :. Int) (Complex e))Source

Compute the DFT along the low order dimension of an array

idft :: (Shape sh, Slice sh, Elt e, IsFloating e) => Acc (Array (sh :. Int) (Complex e)) -> Acc (Array (sh :. Int) (Complex e))Source

Compute the inverse DFT along the low order dimension of an array

Arguments

 :: forall sh e . (Shape sh, Slice sh, Elt e, IsFloating e) => Acc (Array (sh :. Int) (Complex e)) roots of unity -> Acc (Array (sh :. Int) (Complex e)) input array -> Acc (Array (sh :. Int) (Complex e))

Generic function for computation of forward and inverse DFT. This function is also useful if you transform many arrays of the same extent, and don't want to recompute the roots for each one.

The extent of the input and roots must match.

Arguments

 :: forall sh e . (Shape sh, Slice sh, Elt e, IsFloating e) => Exp (sh :. Int) index of the value we want -> Acc (Array (sh :. Int) (Complex e)) roots of unity -> Acc (Array (sh :. Int) (Complex e)) input array -> Acc (Scalar (Complex e))

Compute a single value of the DFT.