In [1]:
import Diagrams.Prelude
import Control.Monad
import Data.Bits (xor)
In [2]:
k = round $ logBase 2 16
n = 2^k

DFT

In [3]:
diagram $ mconcat [ fromVertices [p2 (0,y₀), p2 (n,y₁)]
                  | [y₀,y₁] <- replicateM 2 [0..n-1] ]

FFT

In [4]:
diagram $ hsep 0 [ mconcat [
            fromVertices [p2 (0,fromIntegral y₀), p2 (4, fromIntegral y₁)]
           | y₀ <- [0..n-1], y₁ <- [y₀, y₀`xor`2^o] ] | o <- [0..k-1] ]
In [ ]: