Safe Haskell | None |
---|

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`

.

- dft :: forall sh. Shape sh => Array U (sh :. Int) Complex -> Array U (sh :. Int) Complex
- idft :: forall sh. Shape sh => Array U (sh :. Int) Complex -> Array U (sh :. Int) Complex
- dftWithRoots :: forall sh. Shape sh => Array U (sh :. Int) Complex -> Array U (sh :. Int) Complex -> Array U (sh :. Int) Complex
- dftWithRootsSingle :: forall sh. Shape sh => Array U (sh :. Int) Complex -> Array U (sh :. Int) Complex -> (sh :. Int) -> Complex

# Documentation

dft :: forall sh. Shape sh => Array U (sh :. Int) Complex -> Array U (sh :. Int) ComplexSource

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

idft :: forall sh. Shape sh => Array U (sh :. Int) Complex -> Array U (sh :. Int) ComplexSource

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

:: forall sh . Shape sh | |

=> Array U (sh :. Int) Complex | Roots of unity. |

-> Array U (sh :. Int) Complex | Input array. |

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

.