Browse Source

Drop redundant SignalGenerator and Signals namespace (use Generate instead)

pull/184/head
Christoph Ruegg 13 years ago
parent
commit
b51b0c1294
  1. 1
      src/Examples/Interpolation/AkimaSpline.cs
  2. 1
      src/Examples/Interpolation/LinearBetweenPoints.cs
  3. 1
      src/Examples/Interpolation/RationalWithPoles.cs
  4. 1
      src/Examples/Interpolation/RationalWithoutPoles.cs
  5. 1
      src/Examples/Signals/Equidistant.cs
  6. 1
      src/Examples/Signals/Random.cs
  7. 3
      src/Numerics/Numerics.csproj
  8. 84
      src/Numerics/Signals/SignalGenerator.Chebyshev.cs
  9. 230
      src/Numerics/Signals/SignalGenerator.Equidistant.cs
  10. 101
      src/Numerics/Signals/SignalGenerator.Random.cs
  11. 1
      src/UnitTests/IntegralTransformsTests/HartleyTest.cs
  12. 2
      src/UnitTests/IntegralTransformsTests/InverseTransformTest.cs

1
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
{

1
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
{

1
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
{

1
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
{

1
src/Examples/Signals/Equidistant.cs

@ -26,7 +26,6 @@
using System;
using MathNet.Numerics;
using MathNet.Numerics.Signals;
namespace Examples.SignalsExamples
{

1
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
{

3
src/Numerics/Numerics.csproj

@ -407,9 +407,6 @@
<Compile Include="Random\WH2006.cs" />
<Compile Include="Random\Xorshift.cs" />
<Compile Include="Compatibility.cs" />
<Compile Include="Signals\SignalGenerator.Random.cs" />
<Compile Include="Signals\SignalGenerator.Chebyshev.cs" />
<Compile Include="Signals\SignalGenerator.Equidistant.cs" />
<Compile Include="Sorting.cs" />
<Compile Include="SpecialFunctions\Harmonic.cs" />
<Compile Include="SpecialFunctions\Beta.cs" />

84
src/Numerics/Signals/SignalGenerator.Chebyshev.cs

@ -1,84 +0,0 @@
// <copyright file="SignalGenerator.Chebyshev.cs" company="Math.NET">
// 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.
// </copyright>
namespace MathNet.Numerics.Signals
{
using System;
/// <summary>
/// Generic Function Sampling and Quantization Provider
/// </summary>
public static partial class SignalGenerator
{
/// <summary>
/// Samples a function at the roots of the Chebyshev polynomial of the first kind.
/// </summary>
/// <param name="function">The real-domain function to sample.</param>
/// <param name="intervalBegin">The real domain interval begin where to start sampling.</param>
/// <param name="intervalEnd">The real domain interval end where to stop sampling.</param>
/// <param name="sampleCount">The number of samples to generate.</param>
/// <typeparam name="T">The value type of the function to sample.</typeparam>
/// <returns>Vector of the function sampled in [a,b] at (b+a)/2+(b-1)/2*cos(pi*(2i-1)/(2n))</returns>
/// <exception cref="ArgumentNullException" />
/// <exception cref="ArgumentOutOfRangeException" />
[Obsolete]
public static T[] ChebyshevNodesFirstKind<T>(
Func<double, T> function,
double intervalBegin,
double intervalEnd,
int sampleCount)
{
var roots = FindRoots.ChebychevPolynomialFirstKind(sampleCount, intervalBegin, intervalEnd);
return Generate.Map(roots, function);
}
/// <summary>
/// Samples a function at the roots of the Chebyshev polynomial of the second kind.
/// </summary>
/// <param name="function">The real-domain function to sample.</param>
/// <param name="intervalBegin">The real domain interval begin where to start sampling.</param>
/// <param name="intervalEnd">The real domain interval end where to stop sampling.</param>
/// <param name="sampleCount">The number of samples to generate.</param>
/// <typeparam name="T">The value type of the function to sample.</typeparam>
/// <returns>Vector of the function sampled in [a,b] at (b+a)/2+(b-1)/2*cos(pi*i/(n-1))</returns>
/// <exception cref="ArgumentNullException" />
/// <exception cref="ArgumentOutOfRangeException" />
[Obsolete]
public static T[] ChebyshevNodesSecondKind<T>(
Func<double, T> function,
double intervalBegin,
double intervalEnd,
int sampleCount)
{
var roots = FindRoots.ChebychevPolynomialSecondKind(sampleCount, intervalBegin, intervalEnd);
return Generate.Map(roots, function);
}
}
}

230
src/Numerics/Signals/SignalGenerator.Equidistant.cs

@ -1,230 +0,0 @@
// <copyright file="SignalGenerator.Equidistant.cs" company="Math.NET">
// 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.
// </copyright>
namespace MathNet.Numerics.Signals
{
using System;
using System.Collections.Generic;
/// <summary>
/// Generic Function Sampling and Quantization Provider
/// </summary>
public static partial class SignalGenerator
{
/// <summary>
/// Samples a function equidistant within the provided interval.
/// </summary>
/// <param name="function">The real-domain function to sample.</param>
/// <param name="intervalBegin">The real domain interval begin where to start sampling.</param>
/// <param name="intervalEnd">The real domain interval end where to stop sampling.</param>
/// <param name="sampleCount">The number of samples to generate.</param>
/// <typeparam name="T">The value type of the function to sample.</typeparam>
/// <returns>The generated sample vector.</returns>
/// <exception cref="ArgumentNullException" />
/// <exception cref="ArgumentOutOfRangeException" />
[Obsolete]
public static T[] EquidistantInterval<T>(
Func<double, T> function,
double intervalBegin,
double intervalEnd,
int sampleCount)
{
return Generate.LinearSpacedMap(sampleCount, intervalBegin, intervalEnd, function);
}
/// <summary>
/// Samples a function equidistant within the provided interval.
/// </summary>
/// <param name="function">The real-domain function to sample.</param>
/// <param name="intervalBegin">The real domain interval begin where to start sampling.</param>
/// <param name="intervalEnd">The real domain interval end where to stop sampling.</param>
/// <param name="sampleCount">The number of samples to generate.</param>
/// <param name="samplePoints">The real domain points where the samples are taken at.</param>
/// <typeparam name="T">The value type of the function to sample.</typeparam>
/// <returns>The generated sample vector.</returns>
/// <exception cref="ArgumentNullException" />
/// <exception cref="ArgumentOutOfRangeException" />
[Obsolete]
public static T[] EquidistantInterval<T>(
Func<double, T> function,
double intervalBegin,
double intervalEnd,
int sampleCount,
out double[] samplePoints)
{
samplePoints = Generate.LinearSpaced(sampleCount, intervalBegin, intervalEnd);
return Generate.Map(samplePoints, function);
}
/// <summary>
/// Samples a periodic function equidistant within one period, but omits the last sample such that the sequence
/// can be concatenated together.
/// </summary>
/// <param name="function">The real-domain function to sample.</param>
/// <param name="periodLength">The real domain full period length.</param>
/// <param name="periodOffset">The real domain offset where to start the sampling period.</param>
/// <param name="sampleCount">The number of samples to generate.</param>
/// <typeparam name="T">The value type of the function to sample.</typeparam>
/// <returns>The generated sample vector.</returns>
/// <exception cref="ArgumentNullException" />
/// <exception cref="ArgumentOutOfRangeException"/>
[Obsolete]
public static T[] EquidistantPeriodic<T>(
Func<double, T> function,
double periodLength,
double periodOffset,
int sampleCount)
{
return Generate.PeriodicMap(sampleCount, function, sampleCount, 1.0, periodLength, periodOffset);
}
/// <summary>
/// Samples a periodic function equidistant within one period, but omits the last sample such that the sequence
/// can be concatenated together.
/// </summary>
/// <param name="function">The real-domain function to sample.</param>
/// <param name="periodLength">The real domain full period length.</param>
/// <param name="periodOffset">The real domain offset where to start the sampling period.</param>
/// <param name="sampleCount">The number of samples to generate.</param>
/// <param name="samplePoints">The real domain points where the samples are taken at.</param>
/// <typeparam name="T">The value type of the function to sample.</typeparam>
/// <returns>The generated sample vector.</returns>
/// <exception cref="ArgumentNullException" />
/// <exception cref="ArgumentOutOfRangeException"/>
[Obsolete]
public static T[] EquidistantPeriodic<T>(
Func<double, T> function,
double periodLength,
double periodOffset,
int sampleCount,
out double[] samplePoints)
{
samplePoints = Generate.Periodic(sampleCount, sampleCount, 1.0, periodLength, periodOffset);
return Generate.Map(samplePoints, function);
}
/// <summary>
/// Samples a function equidistant starting from the provided location with a fixed step length.
/// </summary>
/// <param name="function">The real-domain function to sample.</param>
/// <param name="start">The real domain location offset where to start sampling.</param>
/// <param name="step">The real domain step length between the equidistant samples.</param>
/// <param name="sampleCount">The number of samples to generate.</param>
/// <typeparam name="T">The value type of the function to sample.</typeparam>
/// <returns>The generated sample vector.</returns>
/// <exception cref="ArgumentNullException" />
/// <exception cref="ArgumentOutOfRangeException"/>
[Obsolete]
public static T[] EquidistantStartingAt<T>(
Func<double, T> function,
double start,
double step,
int sampleCount)
{
return Generate.LinearSpacedMap(sampleCount, start, start + (sampleCount - 1)*step, function);
}
/// <summary>
/// Samples a function equidistant starting from the provided location with a fixed step length.
/// </summary>
/// <param name="function">The real-domain function to sample.</param>
/// <param name="start">The real domain location offset where to start sampling.</param>
/// <param name="step">The real domain step length between the equidistant samples.</param>
/// <param name="sampleCount">The number of samples to generate.</param>
/// <param name="samplePoints">The real domain points where the samples are taken at.</param>
/// <typeparam name="T">The value type of the function to sample.</typeparam>
/// <returns>The generated sample vector.</returns>
/// <exception cref="ArgumentNullException" />
/// <exception cref="ArgumentOutOfRangeException"/>
[Obsolete]
public static T[] EquidistantStartingAt<T>(
Func<double, T> function,
double start,
double step,
int sampleCount,
out double[] samplePoints)
{
samplePoints = Generate.LinearSpaced(sampleCount, start, start + (sampleCount - 1)*step);
return Generate.Map(samplePoints, function);
}
/// <summary>
/// Samples a function equidistant continuously starting from the provided location with a fixed step length.
/// </summary>
/// <param name="function">The real-domain function to sample.</param>
/// <param name="start">The real domain location offset where to start sampling.</param>
/// <param name="step">The real domain step length between the equidistant samples.</param>
/// <typeparam name="T">The value type of the function to sample.</typeparam>
/// <returns>The generated sample enumerator.</returns>
/// <exception cref="ArgumentNullException" />
[Obsolete]
public static IEnumerable<T> EquidistantContinuous<T>(
Func<double, T> function,
double start,
double step)
{
if (ReferenceEquals(function, null))
{
throw new ArgumentNullException("function");
}
var current = start;
while (true)
{
yield return function(current);
current += step;
}
}
/// <summary>
/// Samples a function equidistant with the provided start and step length to an integer-domain function
/// </summary>
/// <param name="function">The real-domain function to sample.</param>
/// <param name="start">The real domain location where to start sampling.</param>
/// <param name="step">The real domain step length between the equidistant samples.</param>
/// <typeparam name="T">The value type of the function to sample.</typeparam>
/// <returns>The generated samples integer-domain function.</returns>
/// <exception cref="ArgumentNullException" />
[Obsolete]
public static Func<int, T> EquidistantToFunction<T>(
Func<double, T> function,
double start,
double step)
{
if (ReferenceEquals(function, null))
{
throw new ArgumentNullException("function");
}
return k => function(start + k * step);
}
}
}

101
src/Numerics/Signals/SignalGenerator.Random.cs

@ -1,101 +0,0 @@
// <copyright file="SignalGenerator.Random.cs" company="Math.NET">
// 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.
// </copyright>
namespace MathNet.Numerics.Signals
{
using System;
using Distributions;
/// <summary>
/// Generic Function Sampling and Quantization Provider
/// </summary>
public static partial class SignalGenerator
{
/// <summary>
/// Samples a function randomly with the provided distribution.
/// </summary>
/// <param name="function">The real-domain function to sample.</param>
/// <param name="distribution">Random distribution of the real domain sample points.</param>
/// <param name="sampleCount">The number of samples to generate.</param>
/// <typeparam name="T">The value type of the function to sample.</typeparam>
/// <returns>The generated sample vector.</returns>
/// <exception cref="ArgumentNullException" />
/// <exception cref="ArgumentOutOfRangeException" />
[Obsolete]
public static T[] Random<T>(
Func<double, T> function,
IContinuousDistribution distribution,
int sampleCount)
{
return Generate.RandomMap(sampleCount, distribution, function);
}
/// <summary>
/// Samples a function randomly with the provided distribution.
/// </summary>
/// <param name="function">The real-domain function to sample.</param>
/// <param name="distribution">Random distribution of the real domain sample points.</param>
/// <param name="sampleCount">The number of samples to generate.</param>
/// <param name="samplePoints">The real domain points where the samples are taken at.</param>
/// <typeparam name="T">The value type of the function to sample.</typeparam>
/// <returns>The generated sample vector.</returns>
/// <exception cref="ArgumentNullException" />
/// <exception cref="ArgumentOutOfRangeException" />
[Obsolete]
public static T[] Random<T>(
Func<double, T> function,
IContinuousDistribution distribution,
int sampleCount,
out double[] samplePoints)
{
samplePoints = Generate.Random(sampleCount, distribution);
return Generate.Map(samplePoints, function);
}
/// <summary>
/// Samples a two-domain function randomly with the provided distribution.
/// </summary>
/// <param name="function">The real-domain function to sample.</param>
/// <param name="distribution">Random distribution of the real domain sample points.</param>
/// <param name="sampleCount">The number of samples to generate.</param>
/// <typeparam name="T">The value type of the function to sample.</typeparam>
/// <returns>The generated sample vector.</returns>
/// <exception cref="ArgumentNullException" />
/// <exception cref="ArgumentOutOfRangeException" />
[Obsolete]
public static T[] Random<T>(
Func<double, double, T> function,
IContinuousDistribution distribution,
int sampleCount)
{
return Generate.RandomMap2(sampleCount, distribution, function);
}
}
}

1
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

2
src/UnitTests/IntegralTransformsTests/InverseTransformTest.cs

@ -24,11 +24,9 @@
// OTHER DEALINGS IN THE SOFTWARE.
// </copyright>
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

Loading…
Cancel
Save