示例#1
0
        /// <summary>
        /// Verify if matches DFT.
        /// </summary>
        static void VerifyMatchesDft(
            double[] samples,
            int maximumErrorDecimalPlaces,
            bool inverse,
            Action<Complex[]> dft,
            Func<double[], double[]> hartley)
        {
            var hartleyReal = hartley(samples);

            var fourierComplex = ArrayHelpers.ConvertAll(samples, s => new Complex(s, inverse ? -s : s));
            dft(fourierComplex);
            var fourierReal = ArrayHelpers.ConvertAll(fourierComplex, s => s.Real);

            AssertHelpers.AlmostEqual(fourierReal, hartleyReal, maximumErrorDecimalPlaces);
        }