Mercurial > hg > may
view yetilab/transform/test/test_fft.yeti @ 288:16a9ee99efcf
Window overlap scale factor
author | Chris Cannam |
---|---|
date | Thu, 30 May 2013 20:27:54 +0100 |
parents | 197d23954a4e |
children |
line wrap: on
line source
module yetilab.transform.test.test_fft; { realForward, realInverse } = load yetilab.transform.fft; { list, fromList } = load yetilab.vector; { complex } = load yetilab.complex; { compare } = load yetilab.test.test; testFFT orig reals imags = (out = realForward (length orig) (fromList orig); back = realInverse (length orig) out; compare out (array (map2 complex reals imags)) and compare (list back) orig); [ "dc": \( testFFT [1,1,1,1] [4,0,0] [0,0,0]; ), "sine": \( testFFT [0,1,0,-1] [0,0,0] [0,-2,0]; ), "cosine": \( testFFT [1,0,-1,0] [0,2,0] [0,0,0]; ), "sineCosine": \( testFFT [0.5,1,-0.5,-1] [0,1,0] [0,-2,0]; ), "nyquist": \( testFFT [1,-1,1,-1] [0,0,4] [0,0,0]; ), "dirac": \( testFFT [1,0,0,0] [1,1,1] [0,0,0] and testFFT [0,1,0,0] [1,0,-1] [0,-1,0] and testFFT [0,0,1,0] [1,-1,1] [0,0,0] and testFFT [0,0,0,1] [1,0,-1] [0,1,0]; ), ] is hash<string, () -> boolean>;