repa-algorithms-3.1.3.1: Algorithms using the Repa array library.

Data.Array.Repa.Algorithms.DFT

Description

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

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

The dft and idft functions also compute the roots of unity needed. If you need to transform several arrays with the same extent then it is faster to compute the roots once using calcRootsOfUnity or calcInverseRootsOfUnity, then call dftWithRoots directly.

You can also compute single values of the transform using dftWithRootsSingle.

Synopsis

Documentation

dftP :: (Shape sh, Monad m) => Array U (sh :. Int) Complex -> m (Array U (sh :. Int) Complex)Source

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

idftP :: (Shape sh, Monad m) => Array U (sh :. Int) Complex -> m (Array U (sh :. Int) Complex)Source

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

Arguments

 :: (Shape sh, Monad m) => Array U (sh :. Int) Complex Roots of unity. -> Array U (sh :. Int) Complex Input array. -> m (Array U (sh :. Int) Complex)

Generic function for computation of forward or inverse DFT. This function is also useful if you transform many arrays with the same extent, and don't want to recompute the roots for each one. The extent of the given roots must match that of the input array, else error.

Arguments

 :: Shape sh => Array U (sh :. Int) Complex Roots of unity. -> Array U (sh :. Int) Complex Input array. -> (sh :. Int) Index of the value we want. -> Complex

Compute a single value of the DFT. The extent of the given roots must match that of the input array, else error.