Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
|
|
@ -0,0 +1,17 @@
|
|||
import Data.Complex
|
||||
|
||||
-- Cooley-Tukey
|
||||
fft [] = []
|
||||
fft [x] = [x]
|
||||
fft xs = zipWith (+) ys ts ++ zipWith (-) ys ts
|
||||
where n = length xs
|
||||
ys = fft evens
|
||||
zs = fft odds
|
||||
(evens, odds) = split xs
|
||||
split [] = ([], [])
|
||||
split [x] = ([x], [])
|
||||
split (x:y:xs) = (x:xt, y:yt) where (xt, yt) = split xs
|
||||
ts = zipWith (\z k -> exp' k n * z) zs [0..]
|
||||
exp' k n = cis $ -2 * pi * (fromIntegral k) / (fromIntegral n)
|
||||
|
||||
main = mapM_ print $ fft [1,1,1,1,0,0,0,0]
|
||||
Loading…
Add table
Add a link
Reference in a new issue