Implement discrete Fourier transform

It uses the trivial O(n^2) algorithm.