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