gboduljak / dft

A quick and dirty implementation of Discrete Fourier transform (DFT) in Haskell. Tested on Polynomial Multiplication.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

📉 Discrete Fourier Transform (DFT)

Implementation

A quick and dirty implementation of Discrete Fourier transform (DFT) in Haskell. The algorithm is implemented using the simplified version of Cooley–Tukey FFT algorithm. The implementation is here.

Testing

DFT, Inverse DFT and underlying FFT algorithm are tested by simply checking whether the composition of inverse dft and dft produces the same result as the provided input. The test implementation is here. Polynomial Multiplication Algorithm was also used to test underlying DFT algorithm here.

Application to O(n log n) Polynomial Multiplication

DFT algorithm can be conveniently applied to polynomial multiplication. The result is O(n log n) polynomial multiplication algorithm. The implementation is here. This application was also used to test the FFT implementation, and test cases are here.

Build & Dependencies

In order to build dft from the source, you will need a Haskell stack.

Build:

  1. Clone the project
  2. Run stack build in the root of the repository
    • This should automatically pull dependencies, compile and build

Run in interactive mode: Run stack ghci in the app folder of the repository

Test: Run stack test in the root of the repository

About

A quick and dirty implementation of Discrete Fourier transform (DFT) in Haskell. Tested on Polynomial Multiplication.

License:BSD 3-Clause "New" or "Revised" License


Languages

Language:Haskell 100.0%