Browse Source

Cleanup: remove obsolete code that has been scheduled for removal in v4 (breaking)

build
Christoph Ruegg 9 years ago
parent
commit
017a192d94
  1. 18
      src/Numerics/Control.cs
  2. 48
      src/Numerics/Distributions/Erlang.cs
  3. 6
      src/Numerics/Financial/AbsoluteReturnMeasures.cs
  4. 54
      src/Numerics/Generate.cs
  5. 6
      src/Numerics/Interpolate.cs
  6. 48
      src/Numerics/LinearAlgebra/Matrix.cs
  7. 3
      src/Numerics/LinearAlgebra/Options.cs
  8. 26
      src/Numerics/LinearAlgebra/Vector.cs
  9. 68
      src/Numerics/Providers/LinearAlgebra/Mkl/MklLinearAlgebraProvider.cs

18
src/Numerics/Control.cs

@ -103,24 +103,6 @@ namespace MathNet.Numerics
FourierTransformControl.UseNativeMKL(); FourierTransformControl.UseNativeMKL();
} }
/// <summary>
/// Use the Intel MKL native provider for linear algebra, with the specified configuration parameters.
/// Throws if it is not available or failed to initialize, in which case the previous provider is still active.
/// </summary>
[CLSCompliant(false)]
[Obsolete("Will be removed in the next major version. Use the enums in the Common namespace instead.")]
public static void UseNativeMKL(
Providers.LinearAlgebra.Mkl.MklConsistency consistency = Providers.LinearAlgebra.Mkl.MklConsistency.Auto,
Providers.LinearAlgebra.Mkl.MklPrecision precision = Providers.LinearAlgebra.Mkl.MklPrecision.Double,
Providers.LinearAlgebra.Mkl.MklAccuracy accuracy = Providers.LinearAlgebra.Mkl.MklAccuracy.High)
{
LinearAlgebraControl.UseNativeMKL(
(Providers.Common.Mkl.MklConsistency)consistency,
(Providers.Common.Mkl.MklPrecision)precision,
(Providers.Common.Mkl.MklAccuracy)accuracy);
FourierTransformControl.UseNativeMKL();
}
/// <summary> /// <summary>
/// Use the Intel MKL native provider for linear algebra, with the specified configuration parameters. /// Use the Intel MKL native provider for linear algebra, with the specified configuration parameters.
/// Throws if it is not available or failed to initialize, in which case the previous provider is still active. /// Throws if it is not available or failed to initialize, in which case the previous provider is still active.

48
src/Numerics/Distributions/Erlang.cs

@ -125,12 +125,6 @@ namespace MathNet.Numerics.Distributions
return shape >= 0 && rate >= 0.0; return shape >= 0 && rate >= 0.0;
} }
[Obsolete("Use the variant that expects an int shape, or use Gamma instead. Will be dropped in v4.")]
public static bool IsValidParameterSet(double shape, double rate)
{
return IsValidParameterSet((int)shape, rate);
}
/// <summary> /// <summary>
/// Gets the shape (k) of the Erlang distribution. Range: k ≥ 0. /// Gets the shape (k) of the Erlang distribution. Range: k ≥ 0.
/// </summary> /// </summary>
@ -419,12 +413,6 @@ namespace MathNet.Numerics.Distributions
return Math.Pow(rate, shape)*Math.Pow(x, shape - 1.0)*Math.Exp(-rate*x)/SpecialFunctions.Gamma(shape); return Math.Pow(rate, shape)*Math.Pow(x, shape - 1.0)*Math.Exp(-rate*x)/SpecialFunctions.Gamma(shape);
} }
[Obsolete("Use the variant that expects an int shape, or use Gamma instead. Will be dropped in v4.")]
public static double PDF(double shape, double rate, double x)
{
return PDF((int)shape, rate, x);
}
/// <summary> /// <summary>
/// Computes the log probability density of the distribution (lnPDF) at x, i.e. ln(∂P(X ≤ x)/∂x). /// Computes the log probability density of the distribution (lnPDF) at x, i.e. ln(∂P(X ≤ x)/∂x).
/// </summary> /// </summary>
@ -458,12 +446,6 @@ namespace MathNet.Numerics.Distributions
return (shape*Math.Log(rate)) + ((shape - 1.0)*Math.Log(x)) - (rate*x) - SpecialFunctions.GammaLn(shape); return (shape*Math.Log(rate)) + ((shape - 1.0)*Math.Log(x)) - (rate*x) - SpecialFunctions.GammaLn(shape);
} }
[Obsolete("Use the variant that expects an int shape, or use Gamma instead. Will be dropped in v4.")]
public static double PDFLn(double shape, double rate, double x)
{
return PDFLn((int)shape, rate, x);
}
/// <summary> /// <summary>
/// Computes the cumulative distribution (CDF) of the distribution at x, i.e. P(X ≤ x). /// Computes the cumulative distribution (CDF) of the distribution at x, i.e. P(X ≤ x).
/// </summary> /// </summary>
@ -492,12 +474,6 @@ namespace MathNet.Numerics.Distributions
return SpecialFunctions.GammaLowerRegularized(shape, x*rate); return SpecialFunctions.GammaLowerRegularized(shape, x*rate);
} }
[Obsolete("Use the variant that expects an int shape, or use Gamma instead. Will be dropped in v4.")]
public static double CDF(double shape, double rate, double x)
{
return CDF((int)shape, rate, x);
}
/// <summary> /// <summary>
/// Generates a sample from the distribution. /// Generates a sample from the distribution.
/// </summary> /// </summary>
@ -510,12 +486,6 @@ namespace MathNet.Numerics.Distributions
return Gamma.Sample(rnd, shape, rate); return Gamma.Sample(rnd, shape, rate);
} }
[Obsolete("Use the variant that expects an int shape, or use Gamma instead. Will be dropped in v4.")]
public static double Sample(System.Random rnd, double shape, double rate)
{
return Sample(rnd, (int)shape, rate);
}
/// <summary> /// <summary>
/// Generates a sequence of samples from the distribution. /// Generates a sequence of samples from the distribution.
/// </summary> /// </summary>
@ -528,12 +498,6 @@ namespace MathNet.Numerics.Distributions
return Gamma.Samples(rnd, shape, rate); return Gamma.Samples(rnd, shape, rate);
} }
[Obsolete("Use the variant that expects an int shape, or use Gamma instead. Will be dropped in v4.")]
public static IEnumerable<double> Samples(System.Random rnd, double shape, double rate)
{
return Samples(rnd, (int)shape, rate);
}
/// <summary> /// <summary>
/// Fills an array with samples generated from the distribution. /// Fills an array with samples generated from the distribution.
/// </summary> /// </summary>
@ -558,12 +522,6 @@ namespace MathNet.Numerics.Distributions
return Gamma.Sample(shape, rate); return Gamma.Sample(shape, rate);
} }
[Obsolete("Use the variant that expects an int shape, or use Gamma instead. Will be dropped in v4.")]
public static double Sample(double shape, double rate)
{
return Sample((int)shape, rate);
}
/// <summary> /// <summary>
/// Generates a sequence of samples from the distribution. /// Generates a sequence of samples from the distribution.
/// </summary> /// </summary>
@ -575,12 +533,6 @@ namespace MathNet.Numerics.Distributions
return Gamma.Samples(shape, rate); return Gamma.Samples(shape, rate);
} }
[Obsolete("Use the variant that expects an int shape, or use Gamma instead. Will be dropped in v4.")]
public static IEnumerable<double> Samples(double shape, double rate)
{
return Samples((int)shape, rate);
}
/// <summary> /// <summary>
/// Fills an array with samples generated from the distribution. /// Fills an array with samples generated from the distribution.
/// </summary> /// </summary>

6
src/Numerics/Financial/AbsoluteReturnMeasures.cs

@ -36,12 +36,6 @@ namespace MathNet.Numerics.Financial
{ {
public static class AbsoluteReturnMeasures public static class AbsoluteReturnMeasures
{ {
[Obsolete("Use CompoundReturn instead, will be removed in v4.0")]
public static double CompoundMonthlyReturn(this IEnumerable<double> data)
{
return CompoundReturn(data);
}
/// <summary> /// <summary>
/// Compound Monthly Return or Geometric Return or Annualized Return /// Compound Monthly Return or Geometric Return or Annualized Return
/// </summary> /// </summary>

54
src/Numerics/Generate.cs

@ -970,58 +970,6 @@ namespace MathNet.Numerics
return Distributions.Normal.Samples(SystemRandomSource.Default, mean, standardDeviation); return Distributions.Normal.Samples(SystemRandomSource.Default, mean, standardDeviation);
} }
/// <summary>
/// Create samples with independent amplitudes of normal distribution and a flat spectral density.
/// </summary>
[Obsolete("Use Normal instead. Will be removed in v4.")]
public static double[] Gaussian(int length, double mean, double standardDeviation)
{
return Normal(length, mean, standardDeviation);
}
/// <summary>
/// Create an infinite sample sequence with independent amplitudes of normal distribution and a flat spectral density.
/// </summary>
[Obsolete("Use NormalSequence instead. Will be removed in v4.")]
public static IEnumerable<double> GaussianSequence(double mean, double standardDeviation)
{
return NormalSequence(mean, standardDeviation);
}
/// <summary>
/// Create skew alpha stable samples.
/// </summary>
/// <param name="length">The number of samples to generate.</param>
/// <param name="alpha">Stability alpha-parameter of the stable distribution</param>
/// <param name="beta">Skewness beta-parameter of the stable distribution</param>
/// <param name="scale">Scale c-parameter of the stable distribution</param>
/// <param name="location">Location mu-parameter of the stable distribution</param>
[Obsolete("Will be removed in v4.")]
public static double[] Stable(int length, double alpha, double beta, double scale, double location)
{
if (length < 0)
{
throw new ArgumentOutOfRangeException("length");
}
var samples = new double[length];
Distributions.Stable.Samples(SystemRandomSource.Default, samples, alpha, beta, scale, location);
return samples;
}
/// <summary>
/// Create skew alpha stable samples.
/// </summary>
/// <param name="alpha">Stability alpha-parameter of the stable distribution</param>
/// <param name="beta">Skewness beta-parameter of the stable distribution</param>
/// <param name="scale">Scale c-parameter of the stable distribution</param>
/// <param name="location">Location mu-parameter of the stable distribution</param>
[Obsolete("Will be removed in v4.")]
public static IEnumerable<double> StableSequence(double alpha, double beta, double scale, double location)
{
return Distributions.Stable.Samples(SystemRandomSource.Default, alpha, beta, scale, location);
}
/// <summary> /// <summary>
/// Create random samples. /// Create random samples.
/// </summary> /// </summary>
@ -1147,7 +1095,5 @@ namespace MathNet.Numerics
{ {
return distribution.Samples().Zip(distribution.Samples(), map); return distribution.Samples().Zip(distribution.Samples(), map);
} }
} }
} }

6
src/Numerics/Interpolate.cs

@ -180,12 +180,6 @@ namespace MathNet.Numerics
return Interpolation.LogLinear.Interpolate(points, values); return Interpolation.LogLinear.Interpolate(points, values);
} }
[Obsolete("Use Linear instead. Will be removed in the next major version.")]
public static IInterpolation LinearSpline(IEnumerable<double> points, IEnumerable<double> values)
{
return Interpolation.LinearSpline.Interpolate(points, values);
}
/// <summary> /// <summary>
/// Create an piecewise natural cubic spline interpolation based on arbitrary points, /// Create an piecewise natural cubic spline interpolation based on arbitrary points,
/// with zero secondary derivatives at the boundaries. /// with zero secondary derivatives at the boundaries.

48
src/Numerics/LinearAlgebra/Matrix.cs

@ -1282,15 +1282,6 @@ namespace MathNet.Numerics.LinearAlgebra
/// </summary> /// </summary>
public abstract bool IsHermitian(); public abstract bool IsHermitian();
/// <summary>
/// Evaluates whether this matrix is conjugate symmetric.
/// </summary>
[Obsolete("Use IsHermitian instead. Will be removed in v4.")]
public bool IsConjugateSymmetric()
{
return IsHermitian();
}
/// <summary> /// <summary>
/// Returns this matrix as a multidimensional array. /// Returns this matrix as a multidimensional array.
/// The returned array will be independent from this matrix. /// The returned array will be independent from this matrix.
@ -1320,12 +1311,6 @@ namespace MathNet.Numerics.LinearAlgebra
return Storage.ToColumnMajorArray(); return Storage.ToColumnMajorArray();
} }
[Obsolete("Use ToColumnMajorArray instead. Will be removed in v4.")]
public T[] ToColumnWiseArray()
{
return ToColumnMajorArray();
}
/// <summary> /// <summary>
/// Returns the matrix's elements as an array with the data laid row by row (row major). /// Returns the matrix's elements as an array with the data laid row by row (row major).
/// The returned array will be independent from this matrix. /// The returned array will be independent from this matrix.
@ -1344,13 +1329,6 @@ namespace MathNet.Numerics.LinearAlgebra
return Storage.ToRowMajorArray(); return Storage.ToRowMajorArray();
} }
[Obsolete("Use ToRowMajorArray instead. Will be removed in v4.")]
public T[] ToRowWiseArray()
{
return ToRowMajorArray();
}
/// <summary> /// <summary>
/// Returns this matrix as array of row arrays. /// Returns this matrix as array of row arrays.
/// The returned arrays will be independent from this matrix. /// The returned arrays will be independent from this matrix.
@ -1499,32 +1477,6 @@ namespace MathNet.Numerics.LinearAlgebra
} }
} }
/// <summary>
/// Returns an IEnumerable that can be used to iterate through all non-zero values of the matrix.
/// </summary>
/// <remarks>
/// The enumerator will skip all elements with a zero value.
/// </remarks>
[Obsolete("Use Enumerate(Zeros.AllowSkip) instead. Will be removed in v4.")]
public IEnumerable<T> EnumerateNonZero()
{
return Storage.EnumerateNonZero();
}
/// <summary>
/// Returns an IEnumerable that can be used to iterate through all non-zero values of the matrix and their index.
/// </summary>
/// <remarks>
/// The enumerator returns a Tuple with the first two values being the row and column index
/// and the third value being the value of the element at that index.
/// The enumerator will skip all elements with a zero value.
/// </remarks>
[Obsolete("Use EnumerateIndexed(Zeros.AllowSkip) instead. Will be removed in v4.")]
public IEnumerable<Tuple<int, int, T>> EnumerateNonZeroIndexed()
{
return Storage.EnumerateNonZeroIndexed();
}
/// <summary> /// <summary>
/// Returns an IEnumerable that can be used to iterate through all columns of the matrix. /// Returns an IEnumerable that can be used to iterate through all columns of the matrix.
/// </summary> /// </summary>

3
src/Numerics/LinearAlgebra/Options.cs

@ -77,9 +77,6 @@ namespace MathNet.Numerics.LinearAlgebra
/// </summary> /// </summary>
Hermitian = 2, Hermitian = 2,
[Obsolete("Use Hermitian instead. Will be removed in v4.")]
ConjugateSymmetric = 2,
/// <summary> /// <summary>
/// A matrix is not symmetric /// A matrix is not symmetric
/// </summary> /// </summary>

26
src/Numerics/LinearAlgebra/Vector.cs

@ -343,32 +343,6 @@ namespace MathNet.Numerics.LinearAlgebra
} }
} }
/// <summary>
/// Returns an IEnumerable that can be used to iterate through all non-zero values of the vector.
/// </summary>
/// <remarks>
/// The enumerator will skip all elements with a zero value.
/// </remarks>
[Obsolete("Use Enumerate(Zeros.AllowSkip) instead. Will be removed in v4.")]
public IEnumerable<T> EnumerateNonZero()
{
return Storage.EnumerateNonZero();
}
/// <summary>
/// Returns an IEnumerable that can be used to iterate through all non-zero values of the vector and their index.
/// </summary>
/// <remarks>
/// The enumerator returns a Tuple with the first value being the element index
/// and the second value being the value of the element at that index.
/// The enumerator will skip all elements with a zero value.
/// </remarks>
[Obsolete("Use EnumerateIndexed(Zeros.AllowSkip) instead. Will be removed in v4.")]
public IEnumerable<Tuple<int, T>> EnumerateNonZeroIndexed()
{
return Storage.EnumerateNonZeroIndexed();
}
/// <summary> /// <summary>
/// Applies a function to each value of this vector and replaces the value with its result. /// Applies a function to each value of this vector and replaces the value with its result.
/// If forceMapZero is not set to true, zero values may or may not be skipped depending /// If forceMapZero is not set to true, zero values may or may not be skipped depending

68
src/Numerics/Providers/LinearAlgebra/Mkl/MklLinearAlgebraProvider.cs

@ -37,7 +37,7 @@ namespace MathNet.Numerics.Providers.LinearAlgebra.Mkl
/// <summary> /// <summary>
/// Error codes return from the MKL provider. /// Error codes return from the MKL provider.
/// </summary> /// </summary>
public enum MklError : int internal enum MklError : int
{ {
/// <summary> /// <summary>
/// Unable to allocate memory. /// Unable to allocate memory.
@ -45,50 +45,14 @@ namespace MathNet.Numerics.Providers.LinearAlgebra.Mkl
MemoryAllocation = -999999 MemoryAllocation = -999999
} }
/// <summary>
/// Consistency vs. performance trade-off between runs on different machines.
/// </summary>
[Obsolete("Will be removed in the next major version. Use the enums in the Common namespace instead.")]
public enum MklConsistency : int
{
/// <summary>Consistent on the same CPU only (maximum performance)</summary>
Auto = 2,
/// <summary>Consistent on Intel and compatible CPUs with SSE2 support (maximum compatibility)</summary>
Compatible = 3,
/// <summary>Consistent on Intel CPUs supporting SSE2 or later</summary>
SSE2 = 4,
/// <summary>Consistent on Intel CPUs supporting SSE4.2 or later</summary>
SSE4_2 = 8,
/// <summary>Consistent on Intel CPUs supporting AVX or later</summary>
AVX = 9,
/// <summary>Consistent on Intel CPUs supporting AVX2 or later</summary>
AVX2 = 10
}
[CLSCompliant(false)]
[Obsolete("Will be removed in the next major version. Use the enums in the Common namespace instead.")]
public enum MklAccuracy : uint
{
Low = 0x1,
High = 0x2
}
[CLSCompliant(false)]
[Obsolete("Will be removed in the next major version. Use the enums in the Common namespace instead.")]
public enum MklPrecision : uint
{
Single = 0x10,
Double = 0x20
}
/// <summary> /// <summary>
/// Intel's Math Kernel Library (MKL) linear algebra provider. /// Intel's Math Kernel Library (MKL) linear algebra provider.
/// </summary> /// </summary>
public partial class MklLinearAlgebraProvider : ManagedLinearAlgebraProvider public partial class MklLinearAlgebraProvider : ManagedLinearAlgebraProvider
{ {
readonly Common.Mkl.MklConsistency _consistency; readonly MklConsistency _consistency;
readonly Common.Mkl.MklPrecision _precision; readonly MklPrecision _precision;
readonly Common.Mkl.MklAccuracy _accuracy; readonly MklAccuracy _accuracy;
int _linearAlgebraMajor; int _linearAlgebraMajor;
int _linearAlgebraMinor; int _linearAlgebraMinor;
@ -102,28 +66,10 @@ namespace MathNet.Numerics.Providers.LinearAlgebra.Mkl
/// <param name="precision">VML optimal precision and rounding.</param> /// <param name="precision">VML optimal precision and rounding.</param>
/// <param name="accuracy">VML accuracy mode.</param> /// <param name="accuracy">VML accuracy mode.</param>
[CLSCompliant(false)] [CLSCompliant(false)]
[Obsolete("Will be removed in the next major version. Use the enums in the Common namespace instead.")]
public MklLinearAlgebraProvider( public MklLinearAlgebraProvider(
MklConsistency consistency = MklConsistency.Auto, MklConsistency consistency = MklConsistency.Auto,
MklPrecision precision = MklPrecision.Double, MklPrecision precision = MklPrecision.Double,
MklAccuracy accuracy = MklAccuracy.High) MklAccuracy accuracy = MklAccuracy.High)
{
_consistency = (Common.Mkl.MklConsistency)consistency;
_precision = (Common.Mkl.MklPrecision)precision;
_accuracy = (Common.Mkl.MklAccuracy)accuracy;
}
/// <param name="consistency">
/// Sets the desired bit consistency on repeated identical computations on varying CPU architectures,
/// as a trade-off with performance.
/// </param>
/// <param name="precision">VML optimal precision and rounding.</param>
/// <param name="accuracy">VML accuracy mode.</param>
[CLSCompliant(false)]
public MklLinearAlgebraProvider(
Common.Mkl.MklConsistency consistency = Common.Mkl.MklConsistency.Auto,
Common.Mkl.MklPrecision precision = Common.Mkl.MklPrecision.Double,
Common.Mkl.MklAccuracy accuracy = Common.Mkl.MklAccuracy.High)
{ {
_consistency = consistency; _consistency = consistency;
_precision = precision; _precision = precision;
@ -132,9 +78,9 @@ namespace MathNet.Numerics.Providers.LinearAlgebra.Mkl
public MklLinearAlgebraProvider() public MklLinearAlgebraProvider()
{ {
_consistency = Common.Mkl.MklConsistency.Auto; _consistency = MklConsistency.Auto;
_precision = Common.Mkl.MklPrecision.Double; _precision = MklPrecision.Double;
_accuracy = Common.Mkl.MklAccuracy.High; _accuracy = MklAccuracy.High;
} }
/// <summary> /// <summary>

Loading…
Cancel
Save