view yetilab/transform/test/test_fft.yeti @ 178:032c4986b6b0

Implement and test matrix concat
author Chris Cannam
date Thu, 02 May 2013 21:58:58 +0100
parents d0abc9afe608
children 26111c11d8e4
line wrap: on
line source

module yetilab.transform.test.test_fft;

{ realForward, realInverse } = load yetilab.transform.fft;
{ list, fromList } = load yetilab.block.block;
{ complex } = load yetilab.block.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 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>;