view yetilab/signal/test/test_signal.yeti @ 254:5eb57c649de0 sparse

Using hashes is simpler, but turns out to be mostly no faster and sometimes much slower. Not one to merge back.
author Chris Cannam
date Tue, 21 May 2013 17:40:33 +0100
parents e16e42c55a20
children
line wrap: on
line source
module yetilab.signal.test.test_signal;

{ acf, acfNormalised, acfUnityNormalised } = load yetilab.signal.autocorrelation;

{ compare } = load yetilab.test.test;

[

"unnormalised": \(
    compare (acf 12 (array [1,0,0, 1,0,0, 1,0,0, 1,0,0]))
        [4,0,0, 3,0,0, 2,0,0, 1,0,0 ];
),

"normalised": \(
    compare (acfNormalised 9 (array [1,0,0, 1,0,0, 1,0,0, 1,0,0]))
        [4/12,0,0, 3/9,0,0, 2/6,0,0 ];
),

"normalisedUnity": \(
    compare (acfUnityNormalised 9 (array [1,0,0, 1,0,0, 1,0,0, 1,0,0]))
        [1,0,0, 1,0,0, 1,0,0 ];
),

] is hash<string, () -> boolean>;