view yetilab/transform/test/test_fft.yeti @ 92:77d3292bbf12

Reorganise files
author Chris Cannam
date Wed, 20 Mar 2013 09:57:54 +0000
parents test/test_fft.yeti@d037211bf5d7
children d0abc9afe608
line wrap: on
line source

module test.test_fft;

{ realForward, realInverse } = load fft;
{ list, fromList } = load block;
{ complex } = load complex;

{ compare } = load 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 orig (list back));

[

"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>;