Safe Haskell | None |
---|---|

Language | Haskell98 |

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

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

# 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.

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

.