From b51b0c1294e4868c98a3418144734c8de75e7947 Mon Sep 17 00:00:00 2001 From: Christoph Ruegg Date: Mon, 16 Dec 2013 14:31:45 +0100 Subject: [PATCH] Drop redundant SignalGenerator and Signals namespace (use Generate instead) --- src/Examples/Interpolation/AkimaSpline.cs | 1 - .../Interpolation/LinearBetweenPoints.cs | 1 - .../Interpolation/RationalWithPoles.cs | 1 - .../Interpolation/RationalWithoutPoles.cs | 1 - src/Examples/Signals/Equidistant.cs | 1 - src/Examples/Signals/Random.cs | 1 - src/Numerics/Numerics.csproj | 3 - .../Signals/SignalGenerator.Chebyshev.cs | 84 ------- .../Signals/SignalGenerator.Equidistant.cs | 230 ------------------ .../Signals/SignalGenerator.Random.cs | 101 -------- .../IntegralTransformsTests/HartleyTest.cs | 1 - .../InverseTransformTest.cs | 2 - 12 files changed, 427 deletions(-) delete mode 100644 src/Numerics/Signals/SignalGenerator.Chebyshev.cs delete mode 100644 src/Numerics/Signals/SignalGenerator.Equidistant.cs delete mode 100644 src/Numerics/Signals/SignalGenerator.Random.cs diff --git a/src/Examples/Interpolation/AkimaSpline.cs b/src/Examples/Interpolation/AkimaSpline.cs index ac7d3f35..8789d7ee 100644 --- a/src/Examples/Interpolation/AkimaSpline.cs +++ b/src/Examples/Interpolation/AkimaSpline.cs @@ -28,7 +28,6 @@ using System; using MathNet.Numerics; using MathNet.Numerics.Interpolation; using MathNet.Numerics.Random; -using MathNet.Numerics.Signals; namespace Examples.InterpolationExamples { diff --git a/src/Examples/Interpolation/LinearBetweenPoints.cs b/src/Examples/Interpolation/LinearBetweenPoints.cs index 1d8c9a6a..a5a6d2b8 100644 --- a/src/Examples/Interpolation/LinearBetweenPoints.cs +++ b/src/Examples/Interpolation/LinearBetweenPoints.cs @@ -27,7 +27,6 @@ using System; using MathNet.Numerics; using MathNet.Numerics.Random; -using MathNet.Numerics.Signals; namespace Examples.InterpolationExamples { diff --git a/src/Examples/Interpolation/RationalWithPoles.cs b/src/Examples/Interpolation/RationalWithPoles.cs index d1438b93..9342fffd 100644 --- a/src/Examples/Interpolation/RationalWithPoles.cs +++ b/src/Examples/Interpolation/RationalWithPoles.cs @@ -27,7 +27,6 @@ using System; using MathNet.Numerics; using MathNet.Numerics.Random; -using MathNet.Numerics.Signals; namespace Examples.InterpolationExamples { diff --git a/src/Examples/Interpolation/RationalWithoutPoles.cs b/src/Examples/Interpolation/RationalWithoutPoles.cs index 961fb299..fb5c71d7 100644 --- a/src/Examples/Interpolation/RationalWithoutPoles.cs +++ b/src/Examples/Interpolation/RationalWithoutPoles.cs @@ -27,7 +27,6 @@ using System; using MathNet.Numerics; using MathNet.Numerics.Random; -using MathNet.Numerics.Signals; namespace Examples.InterpolationExamples { diff --git a/src/Examples/Signals/Equidistant.cs b/src/Examples/Signals/Equidistant.cs index 7c738f37..013aee22 100644 --- a/src/Examples/Signals/Equidistant.cs +++ b/src/Examples/Signals/Equidistant.cs @@ -26,7 +26,6 @@ using System; using MathNet.Numerics; -using MathNet.Numerics.Signals; namespace Examples.SignalsExamples { diff --git a/src/Examples/Signals/Random.cs b/src/Examples/Signals/Random.cs index 617cb297..fa017a14 100644 --- a/src/Examples/Signals/Random.cs +++ b/src/Examples/Signals/Random.cs @@ -27,7 +27,6 @@ using System; using MathNet.Numerics; using MathNet.Numerics.Distributions; -using MathNet.Numerics.Signals; namespace Examples.SignalsExamples { diff --git a/src/Numerics/Numerics.csproj b/src/Numerics/Numerics.csproj index 47162196..6b6fad24 100644 --- a/src/Numerics/Numerics.csproj +++ b/src/Numerics/Numerics.csproj @@ -407,9 +407,6 @@ - - - diff --git a/src/Numerics/Signals/SignalGenerator.Chebyshev.cs b/src/Numerics/Signals/SignalGenerator.Chebyshev.cs deleted file mode 100644 index e87e8a94..00000000 --- a/src/Numerics/Signals/SignalGenerator.Chebyshev.cs +++ /dev/null @@ -1,84 +0,0 @@ -// -// Math.NET Numerics, part of the Math.NET Project -// http://numerics.mathdotnet.com -// http://github.com/mathnet/mathnet-numerics -// http://mathnetnumerics.codeplex.com -// -// Copyright (c) 2009-2010 Math.NET -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the "Software"), to deal in the Software without -// restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the -// Software is furnished to do so, subject to the following -// conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -// OTHER DEALINGS IN THE SOFTWARE. -// - -namespace MathNet.Numerics.Signals -{ - using System; - - /// - /// Generic Function Sampling and Quantization Provider - /// - public static partial class SignalGenerator - { - /// - /// Samples a function at the roots of the Chebyshev polynomial of the first kind. - /// - /// The real-domain function to sample. - /// The real domain interval begin where to start sampling. - /// The real domain interval end where to stop sampling. - /// The number of samples to generate. - /// The value type of the function to sample. - /// Vector of the function sampled in [a,b] at (b+a)/2+(b-1)/2*cos(pi*(2i-1)/(2n)) - /// - /// - [Obsolete] - public static T[] ChebyshevNodesFirstKind( - Func function, - double intervalBegin, - double intervalEnd, - int sampleCount) - { - var roots = FindRoots.ChebychevPolynomialFirstKind(sampleCount, intervalBegin, intervalEnd); - return Generate.Map(roots, function); - } - - /// - /// Samples a function at the roots of the Chebyshev polynomial of the second kind. - /// - /// The real-domain function to sample. - /// The real domain interval begin where to start sampling. - /// The real domain interval end where to stop sampling. - /// The number of samples to generate. - /// The value type of the function to sample. - /// Vector of the function sampled in [a,b] at (b+a)/2+(b-1)/2*cos(pi*i/(n-1)) - /// - /// - [Obsolete] - public static T[] ChebyshevNodesSecondKind( - Func function, - double intervalBegin, - double intervalEnd, - int sampleCount) - { - var roots = FindRoots.ChebychevPolynomialSecondKind(sampleCount, intervalBegin, intervalEnd); - return Generate.Map(roots, function); - } - } -} \ No newline at end of file diff --git a/src/Numerics/Signals/SignalGenerator.Equidistant.cs b/src/Numerics/Signals/SignalGenerator.Equidistant.cs deleted file mode 100644 index 0d260022..00000000 --- a/src/Numerics/Signals/SignalGenerator.Equidistant.cs +++ /dev/null @@ -1,230 +0,0 @@ -// -// Math.NET Numerics, part of the Math.NET Project -// http://numerics.mathdotnet.com -// http://github.com/mathnet/mathnet-numerics -// http://mathnetnumerics.codeplex.com -// -// Copyright (c) 2009-2010 Math.NET -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the "Software"), to deal in the Software without -// restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the -// Software is furnished to do so, subject to the following -// conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -// OTHER DEALINGS IN THE SOFTWARE. -// - -namespace MathNet.Numerics.Signals -{ - using System; - using System.Collections.Generic; - - /// - /// Generic Function Sampling and Quantization Provider - /// - public static partial class SignalGenerator - { - /// - /// Samples a function equidistant within the provided interval. - /// - /// The real-domain function to sample. - /// The real domain interval begin where to start sampling. - /// The real domain interval end where to stop sampling. - /// The number of samples to generate. - /// The value type of the function to sample. - /// The generated sample vector. - /// - /// - [Obsolete] - public static T[] EquidistantInterval( - Func function, - double intervalBegin, - double intervalEnd, - int sampleCount) - { - return Generate.LinearSpacedMap(sampleCount, intervalBegin, intervalEnd, function); - } - - /// - /// Samples a function equidistant within the provided interval. - /// - /// The real-domain function to sample. - /// The real domain interval begin where to start sampling. - /// The real domain interval end where to stop sampling. - /// The number of samples to generate. - /// The real domain points where the samples are taken at. - /// The value type of the function to sample. - /// The generated sample vector. - /// - /// - [Obsolete] - public static T[] EquidistantInterval( - Func function, - double intervalBegin, - double intervalEnd, - int sampleCount, - out double[] samplePoints) - { - samplePoints = Generate.LinearSpaced(sampleCount, intervalBegin, intervalEnd); - return Generate.Map(samplePoints, function); - } - - /// - /// Samples a periodic function equidistant within one period, but omits the last sample such that the sequence - /// can be concatenated together. - /// - /// The real-domain function to sample. - /// The real domain full period length. - /// The real domain offset where to start the sampling period. - /// The number of samples to generate. - /// The value type of the function to sample. - /// The generated sample vector. - /// - /// - [Obsolete] - public static T[] EquidistantPeriodic( - Func function, - double periodLength, - double periodOffset, - int sampleCount) - { - return Generate.PeriodicMap(sampleCount, function, sampleCount, 1.0, periodLength, periodOffset); - } - - /// - /// Samples a periodic function equidistant within one period, but omits the last sample such that the sequence - /// can be concatenated together. - /// - /// The real-domain function to sample. - /// The real domain full period length. - /// The real domain offset where to start the sampling period. - /// The number of samples to generate. - /// The real domain points where the samples are taken at. - /// The value type of the function to sample. - /// The generated sample vector. - /// - /// - [Obsolete] - public static T[] EquidistantPeriodic( - Func function, - double periodLength, - double periodOffset, - int sampleCount, - out double[] samplePoints) - { - samplePoints = Generate.Periodic(sampleCount, sampleCount, 1.0, periodLength, periodOffset); - return Generate.Map(samplePoints, function); - } - - /// - /// Samples a function equidistant starting from the provided location with a fixed step length. - /// - /// The real-domain function to sample. - /// The real domain location offset where to start sampling. - /// The real domain step length between the equidistant samples. - /// The number of samples to generate. - /// The value type of the function to sample. - /// The generated sample vector. - /// - /// - [Obsolete] - public static T[] EquidistantStartingAt( - Func function, - double start, - double step, - int sampleCount) - { - return Generate.LinearSpacedMap(sampleCount, start, start + (sampleCount - 1)*step, function); - } - - /// - /// Samples a function equidistant starting from the provided location with a fixed step length. - /// - /// The real-domain function to sample. - /// The real domain location offset where to start sampling. - /// The real domain step length between the equidistant samples. - /// The number of samples to generate. - /// The real domain points where the samples are taken at. - /// The value type of the function to sample. - /// The generated sample vector. - /// - /// - [Obsolete] - public static T[] EquidistantStartingAt( - Func function, - double start, - double step, - int sampleCount, - out double[] samplePoints) - { - samplePoints = Generate.LinearSpaced(sampleCount, start, start + (sampleCount - 1)*step); - return Generate.Map(samplePoints, function); - } - - /// - /// Samples a function equidistant continuously starting from the provided location with a fixed step length. - /// - /// The real-domain function to sample. - /// The real domain location offset where to start sampling. - /// The real domain step length between the equidistant samples. - /// The value type of the function to sample. - /// The generated sample enumerator. - /// - [Obsolete] - public static IEnumerable EquidistantContinuous( - Func function, - double start, - double step) - { - if (ReferenceEquals(function, null)) - { - throw new ArgumentNullException("function"); - } - - var current = start; - - while (true) - { - yield return function(current); - current += step; - } - } - - /// - /// Samples a function equidistant with the provided start and step length to an integer-domain function - /// - /// The real-domain function to sample. - /// The real domain location where to start sampling. - /// The real domain step length between the equidistant samples. - /// The value type of the function to sample. - /// The generated samples integer-domain function. - /// - [Obsolete] - public static Func EquidistantToFunction( - Func function, - double start, - double step) - { - if (ReferenceEquals(function, null)) - { - throw new ArgumentNullException("function"); - } - - return k => function(start + k * step); - } - } -} \ No newline at end of file diff --git a/src/Numerics/Signals/SignalGenerator.Random.cs b/src/Numerics/Signals/SignalGenerator.Random.cs deleted file mode 100644 index eb40dfb8..00000000 --- a/src/Numerics/Signals/SignalGenerator.Random.cs +++ /dev/null @@ -1,101 +0,0 @@ -// -// Math.NET Numerics, part of the Math.NET Project -// http://numerics.mathdotnet.com -// http://github.com/mathnet/mathnet-numerics -// http://mathnetnumerics.codeplex.com -// -// Copyright (c) 2009-2010 Math.NET -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the "Software"), to deal in the Software without -// restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the -// Software is furnished to do so, subject to the following -// conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -// OTHER DEALINGS IN THE SOFTWARE. -// - -namespace MathNet.Numerics.Signals -{ - using System; - using Distributions; - - /// - /// Generic Function Sampling and Quantization Provider - /// - public static partial class SignalGenerator - { - /// - /// Samples a function randomly with the provided distribution. - /// - /// The real-domain function to sample. - /// Random distribution of the real domain sample points. - /// The number of samples to generate. - /// The value type of the function to sample. - /// The generated sample vector. - /// - /// - [Obsolete] - public static T[] Random( - Func function, - IContinuousDistribution distribution, - int sampleCount) - { - return Generate.RandomMap(sampleCount, distribution, function); - } - - /// - /// Samples a function randomly with the provided distribution. - /// - /// The real-domain function to sample. - /// Random distribution of the real domain sample points. - /// The number of samples to generate. - /// The real domain points where the samples are taken at. - /// The value type of the function to sample. - /// The generated sample vector. - /// - /// - [Obsolete] - public static T[] Random( - Func function, - IContinuousDistribution distribution, - int sampleCount, - out double[] samplePoints) - { - samplePoints = Generate.Random(sampleCount, distribution); - return Generate.Map(samplePoints, function); - } - - /// - /// Samples a two-domain function randomly with the provided distribution. - /// - /// The real-domain function to sample. - /// Random distribution of the real domain sample points. - /// The number of samples to generate. - /// The value type of the function to sample. - /// The generated sample vector. - /// - /// - [Obsolete] - public static T[] Random( - Func function, - IContinuousDistribution distribution, - int sampleCount) - { - return Generate.RandomMap2(sampleCount, distribution, function); - } - } -} diff --git a/src/UnitTests/IntegralTransformsTests/HartleyTest.cs b/src/UnitTests/IntegralTransformsTests/HartleyTest.cs index fe01a524..1374e670 100644 --- a/src/UnitTests/IntegralTransformsTests/HartleyTest.cs +++ b/src/UnitTests/IntegralTransformsTests/HartleyTest.cs @@ -28,7 +28,6 @@ using System; using MathNet.Numerics.Distributions; using MathNet.Numerics.IntegralTransforms; using MathNet.Numerics.IntegralTransforms.Algorithms; -using MathNet.Numerics.Signals; using NUnit.Framework; namespace MathNet.Numerics.UnitTests.IntegralTransformsTests diff --git a/src/UnitTests/IntegralTransformsTests/InverseTransformTest.cs b/src/UnitTests/IntegralTransformsTests/InverseTransformTest.cs index 8b49c10e..0da1f5ae 100644 --- a/src/UnitTests/IntegralTransformsTests/InverseTransformTest.cs +++ b/src/UnitTests/IntegralTransformsTests/InverseTransformTest.cs @@ -24,11 +24,9 @@ // OTHER DEALINGS IN THE SOFTWARE. // -using System; using MathNet.Numerics.Distributions; using MathNet.Numerics.IntegralTransforms; using MathNet.Numerics.IntegralTransforms.Algorithms; -using MathNet.Numerics.Signals; using NUnit.Framework; namespace MathNet.Numerics.UnitTests.IntegralTransformsTests