Exemplo n.º 1
0
        public void TestInverseRealFft()
        {
            float[] array      = { 1, 5, 3, 7, 2, 3, 0, 7 };
            float[] output     = new float[array.Length];
            float[] outputNorm = new float[array.Length];

            float[] re = new float[5];
            float[] im = new float[5];

            var realFft = new RealFft(8);

            realFft.Direct(array, re, im);
            realFft.Inverse(re, im, output);
            realFft.InverseNorm(re, im, outputNorm);

            Assert.Multiple(() =>
            {
                Assert.That(output, Is.EqualTo(array.Select(a => a * 8)).Within(1e-5));
                Assert.That(outputNorm, Is.EqualTo(array).Within(1e-5));
            });
        }