Ejemplo n.º 1
0
        public void HartleyNaiveIsReversible(HartleyOptions options)
        {
            var dht = new DiscreteHartleyTransform();

            VerifyIsReversibleReal(
                0x80,
                1e-9,
                s => dht.NaiveForward(s, options),
                s => dht.NaiveInverse(s, options));
        }
Ejemplo n.º 2
0
        public void HartleyNaiveIsReversible([Values(HartleyOptions.Default, HartleyOptions.AsymmetricScaling)] HartleyOptions options)
        {
            var dht = new DiscreteHartleyTransform();

            VerifyIsReversibleReal(
                0x80,
                1e-9,
                s => dht.NaiveForward(s, options),
                s => dht.NaiveInverse(s, options));
        }
Ejemplo n.º 3
0
        public void HartleyNaiveIsReversible(HartleyOptions options)
        {
            var dht = new DiscreteHartleyTransform();

            var samples = SignalGenerator.Random(x => x, GetUniform(1), 0x80);
            var work    = new double[samples.Length];

            samples.CopyTo(work, 0);

            work = dht.NaiveForward(work, options);
            Assert.IsFalse(work.ListAlmostEqual(samples, 6));

            work = dht.NaiveInverse(work, options);
            AssertHelpers.ListAlmostEqual(samples, work, 12);
        }
        public void HartleyDefaultNaiveSatisfiesParsevalsTheorem([Values(0x40, 0x1F)] int count)
        {
            var samples = SignalGenerator.Random(x => x, _uniform, count);

            var timeSpaceEnergy = (from s in samples select s * s).Mean();

            var work = new double[samples.Length];
            samples.CopyTo(work, 0);

            // Default -> Symmetric Scaling
            var dht = new DiscreteHartleyTransform();
            work = dht.NaiveForward(work, HartleyOptions.Default);

            var frequencySpaceEnergy = (from s in work select s * s).Mean();
            Assert.AreEqual(timeSpaceEnergy, frequencySpaceEnergy, 1e-12);
        }
Ejemplo n.º 5
0
        public void NaiveMatchesDft([Values(HartleyOptions.Default, HartleyOptions.AsymmetricScaling, HartleyOptions.NoScaling)] HartleyOptions hartleyOptions, [Values(FourierOptions.Default, FourierOptions.AsymmetricScaling, FourierOptions.NoScaling)] FourierOptions fourierOptions)
        {
            var dht = new DiscreteHartleyTransform();
            var samples = SignalGenerator.Random(x => x, _uniform, 0x80);

            VerifyMatchesDft(
                samples,
                1e-5,
                false,
                s => Transform.FourierForward(s, fourierOptions),
                s => dht.NaiveForward(s, hartleyOptions));
            VerifyMatchesDft(
                samples,
                1e-5,
                true,
                s => Transform.FourierInverse(s, fourierOptions),
                s => dht.NaiveInverse(s, hartleyOptions));
        }
Ejemplo n.º 6
0
        public void NaiveMatchesDft(HartleyOptions hartleyOptions, FourierOptions fourierOptions)
        {
            var dht     = new DiscreteHartleyTransform();
            var samples = SignalGenerator.Random(x => x, GetUniform(1), 0x80);

            VerifyMatchesDft(
                samples,
                1e-5,
                false,
                s => Transform.FourierForward(s, fourierOptions),
                s => dht.NaiveForward(s, hartleyOptions));
            VerifyMatchesDft(
                samples,
                1e-5,
                true,
                s => Transform.FourierInverse(s, fourierOptions),
                s => dht.NaiveInverse(s, hartleyOptions));
        }
Ejemplo n.º 7
0
        public void NaiveMatchesDft([Values(HartleyOptions.Default, HartleyOptions.AsymmetricScaling, HartleyOptions.NoScaling)] HartleyOptions hartleyOptions, [Values(FourierOptions.Default, FourierOptions.AsymmetricScaling, FourierOptions.NoScaling)] FourierOptions fourierOptions)
        {
            var dht     = new DiscreteHartleyTransform();
            var samples = SignalGenerator.Random(x => x, _uniform, 0x80);

            VerifyMatchesDft(
                samples,
                1e-5,
                false,
                s => Transform.FourierForward(s, fourierOptions),
                s => dht.NaiveForward(s, hartleyOptions));
            VerifyMatchesDft(
                samples,
                1e-5,
                true,
                s => Transform.FourierInverse(s, fourierOptions),
                s => dht.NaiveInverse(s, hartleyOptions));
        }
Ejemplo n.º 8
0
        public void NaiveMatchesDft(HartleyOptions hartleyOptions, FourierOptions fourierOptions)
        {
            var dht = new DiscreteHartleyTransform();
            var samples = SignalGenerator.Random(x => x, GetUniform(1), 0x80);

            VerifyMatchesDft(
                samples,
                1e-5,
                false,
                s => Transform.FourierForward(s, fourierOptions),
                s => dht.NaiveForward(s, hartleyOptions));
            VerifyMatchesDft(
                samples,
                1e-5,
                true,
                s => Transform.FourierInverse(s, fourierOptions),
                s => dht.NaiveInverse(s, hartleyOptions));
        }
Ejemplo n.º 9
0
        public void HartleyDefaultNaiveSatisfiesParsevalsTheorem(int count)
        {
            var samples = SignalGenerator.Random(x => x, _uniform, count);

            var timeSpaceEnergy = (from s in samples select s * s).Mean();

            var work = new double[samples.Length];

            samples.CopyTo(work, 0);

            // Default -> Symmetric Scaling
            var dht = new DiscreteHartleyTransform();

            work = dht.NaiveForward(work, HartleyOptions.Default);

            var frequencySpaceEnergy = (from s in work select s * s).Mean();

            Assert.AreEqual(timeSpaceEnergy, frequencySpaceEnergy, 1e-12);
        }
        public void NaiveMatchesDFT(HartleyOptions hartleyOptions, FourierOptions fourierOptions)
        {
            var dht     = new DiscreteHartleyTransform();
            var samples = Sample.Random(x => x, _uniform, 0x80);

            VerifyMatchesDFT(
                samples,
                1e-10,
                false,
                s => Transform.FourierForward(s, fourierOptions),
                s => dht.NaiveForward(s, hartleyOptions));

            VerifyMatchesDFT(
                samples,
                1e-10,
                true,
                s => Transform.FourierInverse(s, fourierOptions),
                s => dht.NaiveInverse(s, hartleyOptions));
        }
        public void NaiveMatchesDFT(HartleyOptions hartleyOptions, FourierOptions fourierOptions)
        {
            var dht = new DiscreteHartleyTransform();
            var samples = Sample.Random(x => x, _uniform, 0x80);

            VerifyMatchesDFT(
                samples,
                1e-10,
                false,
                s => Transform.FourierForward(s, fourierOptions),
                s => dht.NaiveForward(s, hartleyOptions));

            VerifyMatchesDFT(
                samples,
                1e-10,
                true,
                s => Transform.FourierInverse(s, fourierOptions),
                s => dht.NaiveInverse(s, hartleyOptions));
        }
        public void HartleyNaiveIsReversible([Values(HartleyOptions.Default, HartleyOptions.AsymmetricScaling)] HartleyOptions options)
        {
            var dht = new DiscreteHartleyTransform();

            VerifyIsReversibleReal(
                0x80, 
                1e-9, 
                s => dht.NaiveForward(s, options), 
                s => dht.NaiveInverse(s, options));
        }
        public void HartleyNaiveIsReversible(HartleyOptions options)
        {
            var dht = new DiscreteHartleyTransform();

            VerifyIsReversibleReal(
                0x80,
                1e-9,
                s => dht.NaiveForward(s, options),
                s => dht.NaiveInverse(s, options));
        }