Browse Source

Drop obsolete code

optimization-1
Christoph Ruegg 13 years ago
parent
commit
01b54a5168
  1. 7
      src/FSharp/LinearAlgebra.Double.Matrix.fs
  2. 12
      src/FSharp/LinearAlgebra.Double.Vector.fs
  3. 57
      src/Numerics/Complex32.cs
  4. 20
      src/Numerics/Complex64.cs
  5. 26
      src/Numerics/Distributions/Discrete/Categorical.cs
  6. 44
      src/Numerics/LinearAlgebra/Complex/DenseMatrix.cs
  7. 34
      src/Numerics/LinearAlgebra/Complex/DenseVector.cs
  8. 24
      src/Numerics/LinearAlgebra/Complex/DiagonalMatrix.cs
  9. 47
      src/Numerics/LinearAlgebra/Complex/SparseMatrix.cs
  10. 34
      src/Numerics/LinearAlgebra/Complex/SparseVector.cs
  11. 44
      src/Numerics/LinearAlgebra/Complex32/DenseMatrix.cs
  12. 34
      src/Numerics/LinearAlgebra/Complex32/DenseVector.cs
  13. 24
      src/Numerics/LinearAlgebra/Complex32/DiagonalMatrix.cs
  14. 47
      src/Numerics/LinearAlgebra/Complex32/SparseMatrix.cs
  15. 34
      src/Numerics/LinearAlgebra/Complex32/SparseVector.cs
  16. 44
      src/Numerics/LinearAlgebra/Double/DenseMatrix.cs
  17. 34
      src/Numerics/LinearAlgebra/Double/DenseVector.cs
  18. 24
      src/Numerics/LinearAlgebra/Double/DiagonalMatrix.cs
  19. 47
      src/Numerics/LinearAlgebra/Double/SparseMatrix.cs
  20. 34
      src/Numerics/LinearAlgebra/Double/SparseVector.cs
  21. 78
      src/Numerics/LinearAlgebra/Generic/Matrix.cs
  22. 9
      src/Numerics/LinearAlgebra/Generic/Vector.BCL.cs
  23. 19
      src/Numerics/LinearAlgebra/Generic/Vector.cs
  24. 44
      src/Numerics/LinearAlgebra/Single/DenseMatrix.cs
  25. 34
      src/Numerics/LinearAlgebra/Single/DenseVector.cs
  26. 24
      src/Numerics/LinearAlgebra/Single/DiagonalMatrix.cs
  27. 47
      src/Numerics/LinearAlgebra/Single/SparseMatrix.cs
  28. 34
      src/Numerics/LinearAlgebra/Single/SparseVector.cs
  29. 1
      src/Numerics/Numerics.csproj
  30. 20
      src/Numerics/SpecialFunctions/Evaluate.cs
  31. 17
      src/Numerics/Statistics/DescriptiveStatistics.cs
  32. 140
      src/Numerics/Statistics/Percentile.cs
  33. 115
      src/Numerics/Threading/CommonParallel.cs
  34. 47
      src/UnitTests/StatisticsTests/PercentileTests.cs

7
src/FSharp/LinearAlgebra.Double.Matrix.fs

@ -67,13 +67,6 @@ module Matrix =
for i = 0 to A.RowCount-1 do
A.SetRow(i, f i (A.Row(i)))
[<System.ObsoleteAttribute("Use mapiInPlace instead. Scheduled for removal in v3.0.")>]
let inplaceMapi = mapiInPlace
[<System.ObsoleteAttribute("Use mapColsInPlace instead. Scheduled for removal in v3.0.")>]
let inplaceMapCols = mapColsInPlace
[<System.ObsoleteAttribute("Use mapRowsInPlace instead. Scheduled for removal in v3.0.")>]
let inplaceMapRows = mapRowsInPlace
/// Map every matrix element using the given function.
let inline map (f: float -> float) (A: #Matrix<float>) =
let A = A.Clone()

12
src/FSharp/LinearAlgebra.Double.Vector.fs

@ -224,7 +224,7 @@ module DenseVector =
/// Create a vector from a float list.
let inline ofList (fl: float list) = DenseVector(Array.ofList fl)
/// Create a vector from a sequences.
/// Create a vector from a float sequence.
let inline ofSeq (fs: #seq<float>) = DenseVector.OfEnumerable(fs)
/// Create a vector with a given dimension from an indexed list of index, value pairs.
@ -255,13 +255,11 @@ module SparseVector =
/// Initialize a vector by calling a construction function for every element.
let inline init (n: int) (f: int -> float) = SparseVector.Create(n, fun i -> f i)
/// Create a sparse vector with a given dimension from a list of index, value pairs.
[<System.ObsoleteAttribute("Use ofListi instead. Will be changed to expect a non-indexed list in a future version.")>]
let inline ofList (n: int) (fl: list<int * float>) = SparseVector.OfIndexedEnumerable(n, Seq.ofList fl)
/// Create a sparse vector from a float list.
let inline ofList (n: int) (fl: float list) = SparseVector.OfEnumerable(Seq.ofList fl)
/// Create a sparse vector with a given dimension from a sequence of index, value pairs.
[<System.ObsoleteAttribute("Use ofSeqi instead. Will be changed to expect a non-indexed seq in a future version.")>]
let inline ofSeq (n: int) (fs: #seq<int * float>) = SparseVector.OfIndexedEnumerable(n, fs)
/// Create a sparse vector from a float sequence.
let inline ofSeq (n: int) (fs: #seq<float>) = SparseVector.OfEnumerable(fs)
/// Create a sparse vector with a given dimension from an indexed list of index, value pairs.
let inline ofListi (n: int) (fl: list<int * float>) = SparseVector.OfIndexedEnumerable(n, Seq.ofList fl)

57
src/Numerics/Complex32.cs

@ -34,7 +34,6 @@ namespace MathNet.Numerics
using System.Collections.Generic;
using System.Globalization;
using System.Runtime.InteropServices;
using Properties;
#if !PORTABLE
using System.Runtime;
@ -109,23 +108,6 @@ namespace MathNet.Numerics
return new Complex32(magnitude * (float)Math.Cos(phase), magnitude * (float)Math.Sin(phase));
}
[Obsolete("Use the public constructor instead. Scheduled for removal in v3.0.")]
public static Complex32 WithRealImaginary(float real, float imaginary)
{
return new Complex32(real, imaginary);
}
[Obsolete("Use static FromPolarCoordinates instead. Scheduled for removal in v3.0.")]
public static Complex32 WithModulusArgument(float modulus, float argument)
{
if (modulus < 0.0f)
{
throw new ArgumentOutOfRangeException("modulus", Resources.ArgumentNotNegative);
}
return new Complex32(modulus * (float)Math.Cos(argument), modulus * (float)Math.Sin(argument));
}
/// <summary>
/// Returns a new <see cref="T:MathNet.Numerics.Complex32" /> instance
/// with a real number equal to zero and an imaginary number equal to zero.
@ -150,9 +132,6 @@ namespace MathNet.Numerics
/// </summary>
public static readonly Complex32 PositiveInfinity = new Complex32(float.PositiveInfinity, float.PositiveInfinity);
[Obsolete("Use PositiveInfinity instead. Scheduled for removal in v3.0.")]
public static readonly Complex32 Infinity = PositiveInfinity;
/// <summary>
/// Returns a new <see cref="T:MathNet.Numerics.Complex32" /> instance
/// with real and imaginary numbers not a number.
@ -674,18 +653,6 @@ namespace MathNet.Numerics
return new Complex32(dividend._real / divisor, dividend._imag / divisor);
}
[Obsolete("No Operation. Scheduled for removal in v3.0.")]
public Complex32 Plus()
{
return this;
}
[Obsolete("Use static Complex32.Negate or the unary - operator instead. Scheduled for removal in v3.0.")]
public Complex32 Negate()
{
return -this;
}
/// <summary>
/// Computes the conjugate of a complex number and returns the result.
/// </summary>
@ -707,30 +674,6 @@ namespace MathNet.Numerics
return 1.0f / this;
}
[Obsolete("Use static Complex32.Add or the + operator instead. Scheduled for removal in v3.0.")]
public Complex32 Add(Complex32 other)
{
return this + other;
}
[Obsolete("Use static Complex32.Subtract or the - operator instead. Scheduled for removal in v3.0.")]
public Complex32 Subtract(Complex32 other)
{
return this - other;
}
[Obsolete("Use static Complex32.Multiply or the * operator instead. Scheduled for removal in v3.0.")]
public Complex32 Multiply(Complex32 multiplier)
{
return this * multiplier;
}
[Obsolete("Use static Complex32.Divide or the / operator instead. Scheduled for removal in v3.0.")]
public Complex32 Divide(Complex32 divisor)
{
return this / divisor;
}
#region IFormattable Members
/// <summary>

20
src/Numerics/Complex64.cs

@ -101,23 +101,6 @@ namespace MathNet.Numerics
return new Complex(magnitude * Math.Cos(phase), magnitude * Math.Sin(phase));
}
[Obsolete("Use the public constructor instead. Scheduled for removal in v3.0.")]
public static Complex WithRealImaginary(double real, double imaginary)
{
return new Complex(real, imaginary);
}
[Obsolete("Use static FromPolarCoordinates instead. Scheduled for removal in v3.0.")]
public static Complex WithModulusArgument(double modulus, double argument)
{
if (modulus < 0.0d)
{
throw new ArgumentOutOfRangeException("modulus", Resources.ArgumentNotNegative);
}
return new Complex(modulus * Math.Cos(argument), modulus * Math.Sin(argument));
}
/// <summary>
/// Returns a new Complex instance
/// with a real number equal to zero and an imaginary number equal to zero.
@ -142,9 +125,6 @@ namespace MathNet.Numerics
/// </summary>
public static readonly Complex PositiveInfinity = new Complex(float.PositiveInfinity, float.PositiveInfinity);
[Obsolete("Use PositiveInfinity instead. Scheduled for removal in v3.0.")]
public static readonly Complex Infinity = PositiveInfinity;
/// <summary>
/// Returns a new Complex instance
/// with real and imaginary numbers not a number.

26
src/Numerics/Distributions/Discrete/Categorical.cs

@ -408,19 +408,6 @@ namespace MathNet.Numerics.Distributions
}
}
/// <summary>
/// Samples one categorical distributed random variable; also known as the Discrete distribution.
/// </summary>
/// <param name="rnd">The random number generator to use.</param>
/// <param name="pmfUnnormalized">An array of nonnegative ratios: this array does not need to be normalized
/// as this is often impossible using floating point arithmetic.</param>
/// <returns>One random integer between 0 and the size of the categorical (exclusive).</returns>
[Obsolete("Use SampleWithProbabilityMass instead (or SampleWithCumulativeDistribution which is faster). Scheduled for removal in v3.0.")]
public static int Sample(Random rnd, double[] pmfUnnormalized)
{
return SampleWithProbabilityMass(rnd, pmfUnnormalized);
}
/// <summary>
/// Samples one categorical distributed random variable; also known as the Discrete distribution.
/// </summary>
@ -454,19 +441,6 @@ namespace MathNet.Numerics.Distributions
return SampleUnchecked(rnd, cdf);
}
/// <summary>
/// Samples a categorically distributed random variable.
/// </summary>
/// <param name="rnd">The random number generator to use.</param>
/// <param name="p">An array of nonnegative ratios: this array does not need to be normalized
/// as this is often impossible using floating point arithmetic.</param>
/// <returns>random integers between 0 and the size of the categorical (exclusive).</returns>
[Obsolete("Use SamplesWithProbabilityMass instead (or SamplesWithCumulativeDistribution which is faster). Scheduled for removal in v3.0.")]
public static IEnumerable<int> Samples(Random rnd, double[] p)
{
return SamplesWithProbabilityMass(rnd, p);
}
/// <summary>
/// Samples a categorically distributed random variable.
/// </summary>

44
src/Numerics/LinearAlgebra/Complex/DenseMatrix.cs

@ -254,50 +254,6 @@ namespace MathNet.Numerics.LinearAlgebra.Complex
(i, j) => new Complex(distribution.Sample(), distribution.Sample())));
}
/// <summary>
/// Create a new dense matrix with the given number of rows and columns.
/// All cells of the matrix will be initialized to the provided value.
/// Zero-length matrices are not supported.
/// </summary>
/// <exception cref="ArgumentException">If the row or column count is less than one.</exception>
[Obsolete("Use DenseMatrix.Create instead. Scheduled for removal in v3.0.")]
public DenseMatrix(int rows, int columns, Complex value)
: this(DenseColumnMajorMatrixStorage<Complex>.OfInit(rows, columns, (i, j) => value))
{
}
/// <summary>
/// Create a new dense matrix as a copy of the given two-dimensional array.
/// This new matrix will be independent from the provided array.
/// A new memory block will be allocated for storing the matrix.
/// </summary>
[Obsolete("Use DenseMatrix.OfArray instead. Scheduled for removal in v3.0.")]
public DenseMatrix(Complex[,] array)
: this(DenseColumnMajorMatrixStorage<Complex>.OfArray(array))
{
}
/// <summary>
/// Create a new dense matrix as a copy of the given other matrix.
/// This new matrix will be independent from the other matrix.
/// A new memory block will be allocated for storing the matrix.
/// </summary>
[Obsolete("Use DenseMatrix.OfMatrix instead. Scheduled for removal in v3.0.")]
public DenseMatrix(Matrix<Complex> matrix)
: this(DenseColumnMajorMatrixStorage<Complex>.OfMatrix(matrix.Storage))
{
}
/// <summary>
/// Gets the matrix's data.
/// </summary>
/// <value>The matrix's data.</value>
[Obsolete("Use Values instead. Scheduled for removal in v3.0.")]
public Complex[] Data
{
get { return _values; }
}
/// <summary>
/// Gets the matrix's data.
/// </summary>

34
src/Numerics/LinearAlgebra/Complex/DenseVector.cs

@ -144,40 +144,6 @@ namespace MathNet.Numerics.LinearAlgebra.Complex
i => new Complex(distribution.Sample(), distribution.Sample())));
}
/// <summary>
/// Create a new dense vector with the given length.
/// All cells of the vector will be initialized with the provided value.
/// Zero-length vectors are not supported.
/// </summary>
/// <exception cref="ArgumentException">If length is less than one.</exception>
[Obsolete("Use DenseVector.Create instead. Scheduled for removal in v3.0.")]
public DenseVector(int length, Complex value)
: this(DenseVectorStorage<Complex>.OfInit(length, i => value))
{
}
/// <summary>
/// Create a new dense vector as a copy of the given other vector.
/// This new vector will be independent from the other vector.
/// A new memory block will be allocated for storing the vector.
/// </summary>
[Obsolete("Use DenseVector.OfVector instead. Scheduled for removal in v3.0.")]
public DenseVector(Vector<Complex> other)
: this(DenseVectorStorage<Complex>.OfVector(other.Storage))
{
}
/// <summary>
/// Create a new dense vector as a copy of the given enumerable.
/// This new vector will be independent from the enumerable.
/// A new memory block will be allocated for storing the vector.
/// </summary>
[Obsolete("Use DenseVector.OfEnumerable instead. Scheduled for removal in v3.0.")]
public DenseVector(IEnumerable<Complex> other)
: this(DenseVectorStorage<Complex>.OfEnumerable(other))
{
}
/// <summary>
/// Gets the vector's data.
/// </summary>

24
src/Numerics/LinearAlgebra/Complex/DiagonalMatrix.cs

@ -186,30 +186,6 @@ namespace MathNet.Numerics.LinearAlgebra.Complex
i => new Complex(distribution.Sample(), distribution.Sample())));
}
/// <summary>
/// Create a new diagonal matrix as a copy of the given two-dimensional array.
/// This new matrix will be independent from the provided array.
/// The array to copy from must be diagonal as well.
/// A new memory block will be allocated for storing the matrix.
/// </summary>
[Obsolete("Use DiagonalMatrix.OfArray instead. Scheduled for removal in v3.0.")]
public DiagonalMatrix(Complex[,] array)
: this(DiagonalMatrixStorage<Complex>.OfArray(array))
{
}
/// <summary>
/// Create a new diagonal matrix as a copy of the given other matrix.
/// This new matrix will be independent from the other matrix.
/// The matrix to copy from must be diagonal as well.
/// A new memory block will be allocated for storing the matrix.
/// </summary>
[Obsolete("Use DiagonalMatrix.OfMatrix instead. Scheduled for removal in v3.0.")]
public DiagonalMatrix(Matrix<Complex> matrix)
: this(DiagonalMatrixStorage<Complex>.OfMatrix(matrix.Storage))
{
}
/// <summary>
/// Creates a <c>DiagonalMatrix</c> for the given number of rows and columns.
/// </summary>

47
src/Numerics/LinearAlgebra/Complex/SparseMatrix.cs

@ -207,53 +207,6 @@ namespace MathNet.Numerics.LinearAlgebra.Complex
return new SparseMatrix(SparseCompressedRowMatrixStorage<Complex>.OfInit(rows, columns, init));
}
/// <summary>
/// Create a new sparse matrix with the given number of rows and columns.
/// All cells of the matrix will be initialized to the provided value.
/// Zero-length matrices are not supported.
/// </summary>
/// <exception cref="ArgumentException">If the row or column count is less than one.</exception>
[Obsolete("Use a dense matrix or SparseMatrix.Create instead. Scheduled for removal in v3.0.")]
public SparseMatrix(int rows, int columns, Complex value)
: this(SparseCompressedRowMatrixStorage<Complex>.OfInit(rows, columns, (i, j) => value))
{
}
/// <summary>
/// Create a new sparse matrix with the given number of rows and columns as a copy of the given array.
/// The array is assumed to be in column-major order (column by column).
/// This new matrix will be independent from the provided array.
/// A new memory block will be allocated for storing the matrix.
/// </summary>
/// <seealso href="http://en.wikipedia.org/wiki/Row-major_order"/>
[Obsolete("Use SparseMatrix.OfColumnMajor instead. Scheduled for removal in v3.0.")]
public SparseMatrix(int rows, int columns, Complex[] array)
: this(SparseCompressedRowMatrixStorage<Complex>.OfColumnMajorList(rows, columns, array))
{
}
/// <summary>
/// Create a new sparse matrix as a copy of the given two-dimensional array.
/// This new matrix will be independent from the provided array.
/// A new memory block will be allocated for storing the matrix.
/// </summary>
[Obsolete("Use SparseMatrix.OfArray instead. Scheduled for removal in v3.0.")]
public SparseMatrix(Complex[,] array)
: this(SparseCompressedRowMatrixStorage<Complex>.OfArray(array))
{
}
/// <summary>
/// Create a new sparse matrix as a copy of the given other matrix.
/// This new matrix will be independent from the other matrix.
/// A new memory block will be allocated for storing the matrix.
/// </summary>
[Obsolete("Use SparseMatrix.OfMatrix instead. Scheduled for removal in v3.0.")]
public SparseMatrix(Matrix<Complex> matrix)
: this(SparseCompressedRowMatrixStorage<Complex>.OfMatrix(matrix.Storage))
{
}
/// <summary>
/// Creates a <c>SparseMatrix</c> for the given number of rows and columns.
/// </summary>

34
src/Numerics/LinearAlgebra/Complex/SparseVector.cs

@ -125,40 +125,6 @@ namespace MathNet.Numerics.LinearAlgebra.Complex
return new SparseVector(SparseVectorStorage<Complex>.OfInit(length, init));
}
/// <summary>
/// Create a new sparse vector with the given length.
/// All cells of the vector will be initialized with the provided value.
/// Zero-length vectors are not supported.
/// </summary>
/// <exception cref="ArgumentException">If length is less than one.</exception>
[Obsolete("Use a dense vector instead. Scheduled for removal in v3.0.")]
public SparseVector(int length, Complex value)
: this(SparseVectorStorage<Complex>.OfInit(length, i => value))
{
}
/// <summary>
/// Create a new sparse vector as a copy of the given other vector.
/// This new vector will be independent from the other vector.
/// A new memory block will be allocated for storing the vector.
/// </summary>
[Obsolete("Use SparseVector.OfVector instead. Scheduled for removal in v3.0.")]
public SparseVector(Vector<Complex> other)
: this(SparseVectorStorage<Complex>.OfVector(other.Storage))
{
}
/// <summary>
/// Create a new sparse vector as a copy of the given enumerable.
/// This new vector will be independent from the enumerable.
/// A new memory block will be allocated for storing the vector.
/// </summary>
[Obsolete("Use SparseVector.OfEnumerable instead. Scheduled for removal in v3.0.")]
public SparseVector(IEnumerable<Complex> other)
: this(SparseVectorStorage<Complex>.OfEnumerable(other))
{
}
/// <summary>
/// Creates a matrix with the given dimensions using the same storage type
/// as this vector.

44
src/Numerics/LinearAlgebra/Complex32/DenseMatrix.cs

@ -249,50 +249,6 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32
(i, j) => new Complex32((float) distribution.Sample(), (float) distribution.Sample())));
}
/// <summary>
/// Create a new dense matrix with the given number of rows and columns.
/// All cells of the matrix will be initialized to the provided value.
/// Zero-length matrices are not supported.
/// </summary>
/// <exception cref="ArgumentException">If the row or column count is less than one.</exception>
[Obsolete("Use DenseMatrix.Create instead. Scheduled for removal in v3.0.")]
public DenseMatrix(int rows, int columns, Complex32 value)
: this(DenseColumnMajorMatrixStorage<Complex32>.OfInit(rows, columns, (i, j) => value))
{
}
/// <summary>
/// Create a new dense matrix as a copy of the given two-dimensional array.
/// This new matrix will be independent from the provided array.
/// A new memory block will be allocated for storing the matrix.
/// </summary>
[Obsolete("Use DenseMatrix.OfArray instead. Scheduled for removal in v3.0.")]
public DenseMatrix(Complex32[,] array)
: this(DenseColumnMajorMatrixStorage<Complex32>.OfArray(array))
{
}
/// <summary>
/// Create a new dense matrix as a copy of the given other matrix.
/// This new matrix will be independent from the other matrix.
/// A new memory block will be allocated for storing the matrix.
/// </summary>
[Obsolete("Use DenseMatrix.OfMatrix instead. Scheduled for removal in v3.0.")]
public DenseMatrix(Matrix<Complex32> matrix)
: this(DenseColumnMajorMatrixStorage<Complex32>.OfMatrix(matrix.Storage))
{
}
/// <summary>
/// Gets the matrix's data.
/// </summary>
/// <value>The matrix's data.</value>
[Obsolete("Use Values instead. Scheduled for removal in v3.0.")]
public Complex32[] Data
{
get { return _values; }
}
/// <summary>
/// Gets the matrix's data.
/// </summary>

34
src/Numerics/LinearAlgebra/Complex32/DenseVector.cs

@ -139,40 +139,6 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32
i => new Complex32((float)distribution.Sample(), (float)distribution.Sample())));
}
/// <summary>
/// Create a new dense vector with the given length.
/// All cells of the vector will be initialized with the provided value.
/// Zero-length vectors are not supported.
/// </summary>
/// <exception cref="ArgumentException">If length is less than one.</exception>
[Obsolete("Use DenseVector.Create instead. Scheduled for removal in v3.0.")]
public DenseVector(int length, Complex32 value)
: this(DenseVectorStorage<Complex32>.OfInit(length, i => value))
{
}
/// <summary>
/// Create a new dense vector as a copy of the given other vector.
/// This new vector will be independent from the other vector.
/// A new memory block will be allocated for storing the vector.
/// </summary>
[Obsolete("Use DenseVector.OfVector instead. Scheduled for removal in v3.0.")]
public DenseVector(Vector<Complex32> other)
: this(DenseVectorStorage<Complex32>.OfVector(other.Storage))
{
}
/// <summary>
/// Create a new dense vector as a copy of the given enumerable.
/// This new vector will be independent from the enumerable.
/// A new memory block will be allocated for storing the vector.
/// </summary>
[Obsolete("Use DenseVector.OfEnumerable instead. Scheduled for removal in v3.0.")]
public DenseVector(IEnumerable<Complex32> other)
: this(DenseVectorStorage<Complex32>.OfEnumerable(other))
{
}
/// <summary>
/// Gets the vector's data.
/// </summary>

24
src/Numerics/LinearAlgebra/Complex32/DiagonalMatrix.cs

@ -181,30 +181,6 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32
i => new Complex32((float) distribution.Sample(), (float) distribution.Sample())));
}
/// <summary>
/// Create a new diagonal matrix as a copy of the given two-dimensional array.
/// This new matrix will be independent from the provided array.
/// The array to copy from must be diagonal as well.
/// A new memory block will be allocated for storing the matrix.
/// </summary>
[Obsolete("Use DiagonalMatrix.OfArray instead. Scheduled for removal in v3.0.")]
public DiagonalMatrix(Complex32[,] array)
: this(DiagonalMatrixStorage<Complex32>.OfArray(array))
{
}
/// <summary>
/// Create a new diagonal matrix as a copy of the given other matrix.
/// This new matrix will be independent from the other matrix.
/// The matrix to copy from must be diagonal as well.
/// A new memory block will be allocated for storing the matrix.
/// </summary>
[Obsolete("Use DiagonalMatrix.OfMatrix instead. Scheduled for removal in v3.0.")]
public DiagonalMatrix(Matrix<Complex32> matrix)
: this(DiagonalMatrixStorage<Complex32>.OfMatrix(matrix.Storage))
{
}
/// <summary>
/// Creates a <c>DiagonalMatrix</c> for the given number of rows and columns.
/// </summary>

47
src/Numerics/LinearAlgebra/Complex32/SparseMatrix.cs

@ -202,53 +202,6 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32
return new SparseMatrix(SparseCompressedRowMatrixStorage<Complex32>.OfInit(rows, columns, init));
}
/// <summary>
/// Create a new sparse matrix with the given number of rows and columns.
/// All cells of the matrix will be initialized to the provided value.
/// Zero-length matrices are not supported.
/// </summary>
/// <exception cref="ArgumentException">If the row or column count is less than one.</exception>
[Obsolete("Use a dense matrix or SparseMatrix.Create instead. Scheduled for removal in v3.0.")]
public SparseMatrix(int rows, int columns, Complex32 value)
: this(SparseCompressedRowMatrixStorage<Complex32>.OfInit(rows, columns, (i,j) => value))
{
}
/// <summary>
/// Create a new sparse matrix with the given number of rows and columns as a copy of the given array.
/// The array is assumed to be in column-major order (column by column).
/// This new matrix will be independent from the provided array.
/// A new memory block will be allocated for storing the matrix.
/// </summary>
/// <seealso href="http://en.wikipedia.org/wiki/Row-major_order"/>
[Obsolete("Use SparseMatrix.OfColumnMajor instead. Scheduled for removal in v3.0.")]
public SparseMatrix(int rows, int columns, Complex32[] array)
: this(SparseCompressedRowMatrixStorage<Complex32>.OfColumnMajorList(rows, columns, array))
{
}
/// <summary>
/// Create a new sparse matrix as a copy of the given two-dimensional array.
/// This new matrix will be independent from the provided array.
/// A new memory block will be allocated for storing the matrix.
/// </summary>
[Obsolete("Use SparseMatrix.OfArray instead. Scheduled for removal in v3.0.")]
public SparseMatrix(Complex32[,] array)
: this(SparseCompressedRowMatrixStorage<Complex32>.OfArray(array))
{
}
/// <summary>
/// Create a new sparse matrix as a copy of the given other matrix.
/// This new matrix will be independent from the other matrix.
/// A new memory block will be allocated for storing the matrix.
/// </summary>
[Obsolete("Use SparseMatrix.OfMatrix instead. Scheduled for removal in v3.0.")]
public SparseMatrix(Matrix<Complex32> matrix)
: this(SparseCompressedRowMatrixStorage<Complex32>.OfMatrix(matrix.Storage))
{
}
/// <summary>
/// Creates a <c>SparseMatrix</c> for the given number of rows and columns.
/// </summary>

34
src/Numerics/LinearAlgebra/Complex32/SparseVector.cs

@ -120,40 +120,6 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32
return new SparseVector(SparseVectorStorage<Complex32>.OfInit(length, init));
}
/// <summary>
/// Create a new sparse vector with the given length.
/// All cells of the vector will be initialized with the provided value.
/// Zero-length vectors are not supported.
/// </summary>
/// <exception cref="ArgumentException">If length is less than one.</exception>
[Obsolete("Use a dense vector instead. Scheduled for removal in v3.0.")]
public SparseVector(int length, Complex32 value)
: this(SparseVectorStorage<Complex32>.OfInit(length, i => value))
{
}
/// <summary>
/// Create a new sparse vector as a copy of the given other vector.
/// This new vector will be independent from the other vector.
/// A new memory block will be allocated for storing the vector.
/// </summary>
[Obsolete("Use SparseVector.OfVector instead. Scheduled for removal in v3.0.")]
public SparseVector(Vector<Complex32> other)
: this(SparseVectorStorage<Complex32>.OfVector(other.Storage))
{
}
/// <summary>
/// Create a new sparse vector as a copy of the given enumerable.
/// This new vector will be independent from the enumerable.
/// A new memory block will be allocated for storing the vector.
/// </summary>
[Obsolete("Use SparseVector.OfEnumerable instead. Scheduled for removal in v3.0.")]
public SparseVector(IEnumerable<Complex32> other)
: this(SparseVectorStorage<Complex32>.OfEnumerable(other))
{
}
/// <summary>
/// Creates a matrix with the given dimensions using the same storage type
/// as this vector.

44
src/Numerics/LinearAlgebra/Double/DenseMatrix.cs

@ -249,50 +249,6 @@ namespace MathNet.Numerics.LinearAlgebra.Double
(i, j) => distribution.Sample()));
}
/// <summary>
/// Create a new dense matrix with the given number of rows and columns.
/// All cells of the matrix will be initialized to the provided value.
/// Zero-length matrices are not supported.
/// </summary>
/// <exception cref="ArgumentException">If the row or column count is less than one.</exception>
[Obsolete("Use DenseMatrix.Create instead. Scheduled for removal in v3.0.")]
public DenseMatrix(int rows, int columns, double value)
: this(DenseColumnMajorMatrixStorage<double>.OfInit(rows, columns, (i, j) => value))
{
}
/// <summary>
/// Create a new dense matrix as a copy of the given two-dimensional array.
/// This new matrix will be independent from the provided array.
/// A new memory block will be allocated for storing the matrix.
/// </summary>
[Obsolete("Use DenseMatrix.OfArray instead. Scheduled for removal in v3.0.")]
public DenseMatrix(double[,] array)
: this(DenseColumnMajorMatrixStorage<double>.OfArray(array))
{
}
/// <summary>
/// Create a new dense matrix as a copy of the given other matrix.
/// This new matrix will be independent from the other matrix.
/// A new memory block will be allocated for storing the matrix.
/// </summary>
[Obsolete("Use DenseMatrix.OfMatrix instead. Scheduled for removal in v3.0.")]
public DenseMatrix(Matrix<double> matrix)
: this(DenseColumnMajorMatrixStorage<double>.OfMatrix(matrix.Storage))
{
}
/// <summary>
/// Gets the matrix's data.
/// </summary>
/// <value>The matrix's data.</value>
[Obsolete("Use Values instead. Scheduled for removal in v3.0.")]
public double[] Data
{
get { return _values; }
}
/// <summary>
/// Gets the matrix's data.
/// </summary>

34
src/Numerics/LinearAlgebra/Double/DenseVector.cs

@ -140,40 +140,6 @@ namespace MathNet.Numerics.LinearAlgebra.Double
i => distribution.Sample()));
}
/// <summary>
/// Create a new dense vector with the given length.
/// All cells of the vector will be initialized with the provided value.
/// Zero-length vectors are not supported.
/// </summary>
/// <exception cref="ArgumentException">If length is less than one.</exception>
[Obsolete("Use DenseVector.Create instead. Scheduled for removal in v3.0.")]
public DenseVector(int length, double value)
: this(DenseVectorStorage<double>.OfInit(length, i => value))
{
}
/// <summary>
/// Create a new dense vector as a copy of the given other vector.
/// This new vector will be independent from the other vector.
/// A new memory block will be allocated for storing the vector.
/// </summary>
[Obsolete("Use DenseVector.OfVector instead. Scheduled for removal in v3.0.")]
public DenseVector(Vector<double> other)
: this(DenseVectorStorage<double>.OfVector(other.Storage))
{
}
/// <summary>
/// Create a new dense vector as a copy of the given enumerable.
/// This new vector will be independent from the enumerable.
/// A new memory block will be allocated for storing the vector.
/// </summary>
[Obsolete("Use DenseVector.OfEnumerable instead. Scheduled for removal in v3.0.")]
public DenseVector(IEnumerable<double> other)
: this(DenseVectorStorage<double>.OfEnumerable(other))
{
}
/// <summary>
/// Gets the vector's data.
/// </summary>

24
src/Numerics/LinearAlgebra/Double/DiagonalMatrix.cs

@ -180,30 +180,6 @@ namespace MathNet.Numerics.LinearAlgebra.Double
i => distribution.Sample()));
}
/// <summary>
/// Create a new diagonal matrix as a copy of the given two-dimensional array.
/// This new matrix will be independent from the provided array.
/// The array to copy from must be diagonal as well.
/// A new memory block will be allocated for storing the matrix.
/// </summary>
[Obsolete("Use DiagonalMatrix.OfArray instead. Scheduled for removal in v3.0.")]
public DiagonalMatrix(double[,] array)
: this(DiagonalMatrixStorage<double>.OfArray(array))
{
}
/// <summary>
/// Create a new diagonal matrix as a copy of the given other matrix.
/// This new matrix will be independent from the other matrix.
/// The matrix to copy from must be diagonal as well.
/// A new memory block will be allocated for storing the matrix.
/// </summary>
[Obsolete("Use DiagonalMatrix.OfMatrix instead. Scheduled for removal in v3.0.")]
public DiagonalMatrix(Matrix<double> matrix)
: this(DiagonalMatrixStorage<double>.OfMatrix(matrix.Storage))
{
}
/// <summary>
/// Creates a <c>DiagonalMatrix</c> for the given number of rows and columns.
/// </summary>

47
src/Numerics/LinearAlgebra/Double/SparseMatrix.cs

@ -201,53 +201,6 @@ namespace MathNet.Numerics.LinearAlgebra.Double
return new SparseMatrix(SparseCompressedRowMatrixStorage<double>.OfInit(rows, columns, init));
}
/// <summary>
/// Create a new sparse matrix with the given number of rows and columns.
/// All cells of the matrix will be initialized to the provided value.
/// Zero-length matrices are not supported.
/// </summary>
/// <exception cref="ArgumentException">If the row or column count is less than one.</exception>
[Obsolete("Use a dense matrix or SparseMatrix.Create instead. Scheduled for removal in v3.0.")]
public SparseMatrix(int rows, int columns, double value)
: this(SparseCompressedRowMatrixStorage<double>.OfInit(rows, columns, (i, j) => value))
{
}
/// <summary>
/// Create a new sparse matrix with the given number of rows and columns as a copy of the given array.
/// The array is assumed to be in column-major order (column by column).
/// This new matrix will be independent from the provided array.
/// A new memory block will be allocated for storing the matrix.
/// </summary>
/// <seealso href="http://en.wikipedia.org/wiki/Row-major_order"/>
[Obsolete("Use SparseMatrix.OfColumnMajor instead. Scheduled for removal in v3.0.")]
public SparseMatrix(int rows, int columns, double[] array)
: this(SparseCompressedRowMatrixStorage<double>.OfColumnMajorList(rows, columns, array))
{
}
/// <summary>
/// Create a new sparse matrix as a copy of the given two-dimensional array.
/// This new matrix will be independent from the provided array.
/// A new memory block will be allocated for storing the matrix.
/// </summary>
[Obsolete("Use SparseMatrix.OfArray instead. Scheduled for removal in v3.0.")]
public SparseMatrix(double[,] array)
: this(SparseCompressedRowMatrixStorage<double>.OfArray(array))
{
}
/// <summary>
/// Create a new sparse matrix as a copy of the given other matrix.
/// This new matrix will be independent from the other matrix.
/// A new memory block will be allocated for storing the matrix.
/// </summary>
[Obsolete("Use SparseMatrix.OfMatrix instead. Scheduled for removal in v3.0.")]
public SparseMatrix(Matrix<double> matrix)
: this(SparseCompressedRowMatrixStorage<double>.OfMatrix(matrix.Storage))
{
}
/// <summary>
/// Creates a <c>SparseMatrix</c> for the given number of rows and columns.
/// </summary>

34
src/Numerics/LinearAlgebra/Double/SparseVector.cs

@ -120,40 +120,6 @@ namespace MathNet.Numerics.LinearAlgebra.Double
return new SparseVector(SparseVectorStorage<double>.OfInit(length, init));
}
/// <summary>
/// Create a new sparse vector with the given length.
/// All cells of the vector will be initialized with the provided value.
/// Zero-length vectors are not supported.
/// </summary>
/// <exception cref="ArgumentException">If length is less than one.</exception>
[Obsolete("Use a dense vector instead. Scheduled for removal in v3.0.")]
public SparseVector(int length, double value)
: this(SparseVectorStorage<double>.OfInit(length, i => value))
{
}
/// <summary>
/// Create a new sparse vector as a copy of the given other vector.
/// This new vector will be independent from the other vector.
/// A new memory block will be allocated for storing the vector.
/// </summary>
[Obsolete("Use SparseVector.OfVector instead. Scheduled for removal in v3.0.")]
public SparseVector(Vector<double> other)
: this(SparseVectorStorage<double>.OfVector(other.Storage))
{
}
/// <summary>
/// Create a new sparse vector as a copy of the given enumerable.
/// This new vector will be independent from the enumerable.
/// A new memory block will be allocated for storing the vector.
/// </summary>
[Obsolete("Use SparseVector.OfEnumerable instead. Scheduled for removal in v3.0.")]
public SparseVector(IEnumerable<double> other)
: this(SparseVectorStorage<double>.OfEnumerable(other))
{
}
/// <summary>
/// Creates a matrix with the given dimensions using the same storage type
/// as this vector.

78
src/Numerics/LinearAlgebra/Generic/Matrix.cs

@ -77,84 +77,6 @@ namespace MathNet.Numerics.LinearAlgebra.Generic
/// <value>The number of rows.</value>
public int RowCount { get; private set; }
/// <summary>
/// Constructs matrix from a list of column vectors.
/// </summary>
/// <param name="columnVectors">The vectors to construct the matrix from.</param>
/// <returns>The matrix constructed from the list of column vectors.</returns>
/// <remarks>Creates a matrix of size Max(<paramref name="columnVectors"/>[i].Count) x <paramref name="columnVectors"/>.Count</remarks>
[Obsolete("Use DenseMatrix.OfColumns or SparseMatrix.OfColumns instead. Scheduled for removal in v3.0.")]
public static Matrix<T> CreateFromColumns(IList<Vector<T>> columnVectors)
{
if (columnVectors == null)
{
throw new ArgumentNullException("columnVectors");
}
if (columnVectors.Count == 0)
{
throw new ArgumentOutOfRangeException("columnVectors");
}
var rows = columnVectors[0].Count;
var columns = columnVectors.Count;
for (var column = 1; column < columns; column++)
{
rows = Math.Max(rows, columnVectors[column].Count);
}
var matrix = columnVectors[0].CreateMatrix(rows, columns);
for (var j = 0; j < columns; j++)
{
for (var i = 0; i < columnVectors[j].Count; i++)
{
matrix.At(i, j, columnVectors[j].At(i));
}
}
return matrix;
}
/// <summary>
/// Constructs matrix from a list of row vectors.
/// </summary>
/// <param name="rowVectors">The vectors to construct the matrix from.</param>
/// <returns>The matrix constructed from the list of row vectors.</returns>
/// <remarks>Creates a matrix of size Max(<paramref name="rowVectors"/>.Count) x <paramref name="rowVectors"/>[i].Count</remarks>
[Obsolete("Use DenseMatrix.OfRows or SparseMatrix.OfRows instead. Scheduled for removal in v3.0.")]
public static Matrix<T> CreateFromRows(IList<Vector<T>> rowVectors)
{
if (rowVectors == null)
{
throw new ArgumentNullException("rowVectors");
}
if (rowVectors.Count == 0)
{
throw new ArgumentOutOfRangeException("rowVectors");
}
var rows = rowVectors.Count;
var columns = rowVectors[0].Count;
for (var row = 1; row < rows; row++)
{
columns = Math.Max(columns, rowVectors[row].Count);
}
var matrix = rowVectors[0].CreateMatrix(rows, columns);
for (var i = 0; i < rows; i++)
{
for (var j = 0; j < rowVectors[i].Count; j++)
{
matrix.At(i, j, rowVectors[i].At(j));
}
}
return matrix;
}
/// <summary>
/// Gets or sets the value at the given row and column, with range checking.
/// </summary>

9
src/Numerics/LinearAlgebra/Generic/Vector.BCL.cs

@ -348,14 +348,5 @@ namespace MathNet.Numerics.LinearAlgebra.Generic
{
return string.Concat(ToTypeString(), Environment.NewLine, ToVectorString(Control.MaxToStringRows, Control.MaxToStringColumns, formatProvider));
}
/// <summary>
/// Returns a <see cref="System.String"/> that summarizes this vector.
/// </summary>
[Obsolete("Scheduled for removal in v3.0.")]
public string ToString(IFormatProvider formatProvider)
{
return ToString(null, formatProvider);
}
}
}

19
src/Numerics/LinearAlgebra/Generic/Vector.cs

@ -317,19 +317,6 @@ namespace MathNet.Numerics.LinearAlgebra.Generic
DoAdd(scalar, result);
}
/// <summary>
/// Returns a copy of this vector.
/// </summary>
/// <returns>This vector.</returns>
/// <remarks>
/// Added as an alternative to the unary addition operator.
/// </remarks>
[Obsolete("Use Clone instead. Scheduled for removal in v3.0.")]
public Vector<T> Plus()
{
return Clone();
}
/// <summary>
/// Adds another vector to this vector.
/// </summary>
@ -1477,12 +1464,6 @@ namespace MathNet.Numerics.LinearAlgebra.Generic
Storage.CopySubVectorTo(destination.Storage, sourceIndex, targetIndex, count);
}
[Obsolete("Use CopySubVectorTo instead. Scheduled for removal in v3.0.")]
public void CopyTo(Vector<T> destination, int sourceIndex, int targetIndex, int count)
{
CopySubVectorTo(destination, sourceIndex, targetIndex, count);
}
/// <summary>
/// Returns the data contained in the vector as an array.
/// </summary>

44
src/Numerics/LinearAlgebra/Single/DenseMatrix.cs

@ -249,50 +249,6 @@ namespace MathNet.Numerics.LinearAlgebra.Single
(i, j) => (float) distribution.Sample()));
}
/// <summary>
/// Create a new dense matrix with the given number of rows and columns.
/// All cells of the matrix will be initialized to the provided value.
/// Zero-length matrices are not supported.
/// </summary>
/// <exception cref="ArgumentException">If the row or column count is less than one.</exception>
[Obsolete("Use DenseMatrix.Create instead. Scheduled for removal in v3.0.")]
public DenseMatrix(int rows, int columns, float value)
: this(DenseColumnMajorMatrixStorage<float>.OfInit(rows, columns, (i, j) => value))
{
}
/// <summary>
/// Create a new dense matrix as a copy of the given two-dimensional array.
/// This new matrix will be independent from the provided array.
/// A new memory block will be allocated for storing the matrix.
/// </summary>
[Obsolete("Use DenseMatrix.OfArray instead. Scheduled for removal in v3.0.")]
public DenseMatrix(float[,] array)
: this(DenseColumnMajorMatrixStorage<float>.OfArray(array))
{
}
/// <summary>
/// Create a new dense matrix as a copy of the given other matrix.
/// This new matrix will be independent from the other matrix.
/// A new memory block will be allocated for storing the matrix.
/// </summary>
[Obsolete("Use DenseMatrix.OfMatrix instead. Scheduled for removal in v3.0.")]
public DenseMatrix(Matrix<float> matrix)
: this(DenseColumnMajorMatrixStorage<float>.OfMatrix(matrix.Storage))
{
}
/// <summary>
/// Gets the matrix's data.
/// </summary>
/// <value>The matrix's data.</value>
[Obsolete("Use Values instead. Scheduled for removal in v3.0.")]
public float[] Data
{
get { return _values; }
}
/// <summary>
/// Gets the matrix's data.
/// </summary>

34
src/Numerics/LinearAlgebra/Single/DenseVector.cs

@ -139,40 +139,6 @@ namespace MathNet.Numerics.LinearAlgebra.Single
i => (float)distribution.Sample()));
}
/// <summary>
/// Create a new dense vector with the given length.
/// All cells of the vector will be initialized with the provided value.
/// Zero-length vectors are not supported.
/// </summary>
/// <exception cref="ArgumentException">If length is less than one.</exception>
[Obsolete("Use DenseVector.Create instead. Scheduled for removal in v3.0.")]
public DenseVector(int length, float value)
: this(DenseVectorStorage<float>.OfInit(length, i => value))
{
}
/// <summary>
/// Create a new dense vector as a copy of the given other vector.
/// This new vector will be independent from the other vector.
/// A new memory block will be allocated for storing the vector.
/// </summary>
[Obsolete("Use DenseVector.OfVector instead. Scheduled for removal in v3.0.")]
public DenseVector(Vector<float> other)
: this(DenseVectorStorage<float>.OfVector(other.Storage))
{
}
/// <summary>
/// Create a new dense vector as a copy of the given enumerable.
/// This new vector will be independent from the enumerable.
/// A new memory block will be allocated for storing the vector.
/// </summary>
[Obsolete("Use DenseVector.OfEnumerable instead. Scheduled for removal in v3.0.")]
public DenseVector(IEnumerable<float> other)
: this(DenseVectorStorage<float>.OfEnumerable(other))
{
}
/// <summary>
/// Gets the vector's data.
/// </summary>

24
src/Numerics/LinearAlgebra/Single/DiagonalMatrix.cs

@ -180,30 +180,6 @@ namespace MathNet.Numerics.LinearAlgebra.Single
i => (float) distribution.Sample()));
}
/// <summary>
/// Create a new diagonal matrix as a copy of the given two-dimensional array.
/// This new matrix will be independent from the provided array.
/// The array to copy from must be diagonal as well.
/// A new memory block will be allocated for storing the matrix.
/// </summary>
[Obsolete("Use DiagonalMatrix.OfArray instead. Scheduled for removal in v3.0.")]
public DiagonalMatrix(float[,] array)
: this(DiagonalMatrixStorage<float>.OfArray(array))
{
}
/// <summary>
/// Create a new diagonal matrix as a copy of the given other matrix.
/// This new matrix will be independent from the other matrix.
/// The matrix to copy from must be diagonal as well.
/// A new memory block will be allocated for storing the matrix.
/// </summary>
[Obsolete("Use DiagonalMatrix.OfMatrix instead. Scheduled for removal in v3.0.")]
public DiagonalMatrix(Matrix<float> matrix)
: this(DiagonalMatrixStorage<float>.OfMatrix(matrix.Storage))
{
}
/// <summary>
/// Creates a <c>DiagonalMatrix</c> for the given number of rows and columns.
/// </summary>

47
src/Numerics/LinearAlgebra/Single/SparseMatrix.cs

@ -201,53 +201,6 @@ namespace MathNet.Numerics.LinearAlgebra.Single
return new SparseMatrix(SparseCompressedRowMatrixStorage<float>.OfInit(rows, columns, init));
}
/// <summary>
/// Create a new sparse matrix with the given number of rows and columns.
/// All cells of the matrix will be initialized to the provided value.
/// Zero-length matrices are not supported.
/// </summary>
/// <exception cref="ArgumentException">If the row or column count is less than one.</exception>
[Obsolete("Use a dense matrix or SparseMatrix.Create instead. Scheduled for removal in v3.0.")]
public SparseMatrix(int rows, int columns, float value)
: this(SparseCompressedRowMatrixStorage<float>.OfInit(rows, columns, (i, j) => value))
{
}
/// <summary>
/// Create a new sparse matrix with the given number of rows and columns as a copy of the given array.
/// The array is assumed to be in column-major order (column by column).
/// This new matrix will be independent from the provided array.
/// A new memory block will be allocated for storing the matrix.
/// </summary>
/// <seealso href="http://en.wikipedia.org/wiki/Row-major_order"/>
[Obsolete("Use SparseMatrix.OfColumnMajor instead. Scheduled for removal in v3.0.")]
public SparseMatrix(int rows, int columns, float[] array)
: this(SparseCompressedRowMatrixStorage<float>.OfColumnMajorList(rows, columns, array))
{
}
/// <summary>
/// Create a new sparse matrix as a copy of the given two-dimensional array.
/// This new matrix will be independent from the provided array.
/// A new memory block will be allocated for storing the matrix.
/// </summary>
[Obsolete("Use SparseMatrix.OfArray instead. Scheduled for removal in v3.0.")]
public SparseMatrix(float[,] array)
: this(SparseCompressedRowMatrixStorage<float>.OfArray(array))
{
}
/// <summary>
/// Create a new sparse matrix as a copy of the given other matrix.
/// This new matrix will be independent from the other matrix.
/// A new memory block will be allocated for storing the matrix.
/// </summary>
[Obsolete("Use SparseMatrix.OfMatrix instead. Scheduled for removal in v3.0.")]
public SparseMatrix(Matrix<float> matrix)
: this(SparseCompressedRowMatrixStorage<float>.OfMatrix(matrix.Storage))
{
}
/// <summary>
/// Creates a <c>SparseMatrix</c> for the given number of rows and columns.
/// </summary>

34
src/Numerics/LinearAlgebra/Single/SparseVector.cs

@ -120,40 +120,6 @@ namespace MathNet.Numerics.LinearAlgebra.Single
return new SparseVector(SparseVectorStorage<float>.OfInit(length, init));
}
/// <summary>
/// Create a new sparse vector with the given length.
/// All cells of the vector will be initialized with the provided value.
/// Zero-length vectors are not supported.
/// </summary>
/// <exception cref="ArgumentException">If length is less than one.</exception>
[Obsolete("Use a dense vector instead. Scheduled for removal in v3.0.")]
public SparseVector(int length, float value)
: this(SparseVectorStorage<float>.OfInit(length, i => value))
{
}
/// <summary>
/// Create a new sparse vector as a copy of the given other vector.
/// This new vector will be independent from the other vector.
/// A new memory block will be allocated for storing the vector.
/// </summary>
[Obsolete("Use SparseVector.OfVector instead. Scheduled for removal in v3.0.")]
public SparseVector(Vector<float> other)
: this(SparseVectorStorage<float>.OfVector(other.Storage))
{
}
/// <summary>
/// Create a new sparse vector as a copy of the given enumerable.
/// This new vector will be independent from the enumerable.
/// A new memory block will be allocated for storing the vector.
/// </summary>
[Obsolete("Use SparseVector.OfEnumerable instead. Scheduled for removal in v3.0.")]
public SparseVector(IEnumerable<float> other)
: this(SparseVectorStorage<float>.OfEnumerable(other))
{
}
/// <summary>
/// Creates a matrix with the given dimensions using the same storage type
/// as this vector.

1
src/Numerics/Numerics.csproj

@ -451,7 +451,6 @@
<Compile Include="Statistics\MCMC\MetropolisSampler.cs" />
<Compile Include="Statistics\MCMC\RejectionSampler.cs" />
<Compile Include="Statistics\MCMC\UnivariateHybridMC.cs" />
<Compile Include="Statistics\Percentile.cs" />
<Compile Include="Statistics\Statistics.cs" />
<Compile Include="Statistics\MCMC\UnivariateSliceSampler.cs" />
<Compile Include="Threading\CommonParallel.cs" />

20
src/Numerics/SpecialFunctions/Evaluate.cs

@ -55,26 +55,6 @@ namespace MathNet.Numerics
/// </summary>
public static class Evaluate
{
/// <summary>
/// Evaluate polynomials.
/// </summary>
/// <param name="coefficients">The coefficients of the polynomial.</param>
/// <param name="z">The location where to evaluate the polynomial at.</param>
/// <returns>the evaluation of the polynomial.</returns>
[Obsolete("Use Polynomial(z, params coefficients) instead.")]
public static double Polynomial(double[] coefficients, double z)
{
int count = coefficients.Length;
double sum = coefficients[count - 1];
for (int i = count - 2; i >= 0; --i)
{
sum *= z;
sum += coefficients[i];
}
return sum;
}
/// <summary>
/// Evaluate a polynomial at point x.
/// Coefficients are ordered by power with power k at index k.

17
src/Numerics/Statistics/DescriptiveStatistics.cs

@ -86,8 +86,6 @@ namespace MathNet.Numerics.Statistics
{
Compute(data);
}
_medianLazy = new Lazy<double>(() => data.Median());
}
/// <summary>
@ -109,7 +107,6 @@ namespace MathNet.Numerics.Statistics
throw new ArgumentNullException("data");
}
if (increasedAccuracy)
{
ComputeHA(data);
@ -118,8 +115,6 @@ namespace MathNet.Numerics.Statistics
{
Compute(data);
}
_medianLazy = new Lazy<double>(() => data.Median());
}
/// <summary>
@ -153,18 +148,6 @@ namespace MathNet.Numerics.Statistics
/// <remarks>Returns zero if <see cref="Count"/> is less than three. </remarks>
public double Skewness { get; private set; }
/// <summary>
/// Gets the sample median.
/// </summary>
/// <value>The sample median.</value>
[Obsolete("Please use Statistics.Median instead (performance). Scheduled for removal in v3.0.")]
public double Median
{
get { return _medianLazy.Value; }
}
readonly Lazy<double> _medianLazy;
/// <summary>
/// Gets the sample kurtosis.
/// </summary>

140
src/Numerics/Statistics/Percentile.cs

@ -1,140 +0,0 @@
// <copyright file="Percentile.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-2013 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.Statistics
{
using System;
using System.Collections.Generic;
using System.Linq;
/// <summary>
/// Methods to calculate the percentiles.
/// </summary>
public enum PercentileMethod
{
/// <summary>
/// Using the method recommened my NIST,
/// http://www.itl.nist.gov/div898/handbook/prc/section2/prc252.htm
/// </summary>
Nist = 0,
/// <summary>
/// Using the nearest rank, http://en.wikipedia.org/wiki/Percentile#Nearest_Rank
/// </summary>
Nearest,
/// <summary>
/// Using the same method as Excel does,
/// http://www.itl.nist.gov/div898/handbook/prc/section2/prc252.htm
/// </summary>
Excel,
/// <summary>
/// Use linear interpolation between the two nearest ranks,
/// http://en.wikipedia.org/wiki/Percentile#Linear_Interpolation_Between_Closest_Ranks
/// </summary>
Interpolation
}
/// <summary>
/// Class to calculate percentiles.
/// </summary>
[Obsolete("Use Statistics.Quantile or .QuantileFunc or one of the custom variants instead. Scheduled for removal in v3.0.")]
public class Percentile
{
/// <summary>
/// Holds the data.
/// </summary>
private readonly double[] _data;
/// <summary>
/// Gets or sets the method used to calculate the percentiles.
/// </summary>
/// <value>The calculation method.</value>
/// <remarks>defaults to <see cref="PercentileMethod.Nist"/>.</remarks>
public PercentileMethod Method
{
get;
set;
}
/// <summary>
/// Initializes a new instance of the <see cref="Percentile"/> class.
/// </summary>
/// <param name="data">The data to calculate the percentiles of.</param>
public Percentile(IEnumerable<double> data)
{
if (data == null)
{
throw new ArgumentNullException("data");
}
_data = data.ToArray();
Array.Sort(_data);
}
/// <summary>
/// Computes the percentile.
/// </summary>
/// <param name="percentile">The percentile, must be between 0.0 and 1.0 (inclusive).</param>
/// <returns>the requested percentile.</returns>
public double Compute(double percentile)
{
switch (Method)
{
case PercentileMethod.Nist:
return SortedArrayStatistics.QuantileCustom(_data, percentile, QuantileDefinition.Nist);
case PercentileMethod.Nearest:
return SortedArrayStatistics.QuantileCustom(_data, percentile, QuantileDefinition.R3);
case PercentileMethod.Interpolation:
return SortedArrayStatistics.QuantileCustom(_data, percentile, QuantileDefinition.R5);
case PercentileMethod.Excel:
return SortedArrayStatistics.QuantileCustom(_data, percentile, QuantileDefinition.Excel);
default:
return SortedArrayStatistics.Quantile(_data, percentile);
}
}
/// <summary>
/// Computes the percentiles for the given list.
/// </summary>
/// <param name="percentiles">The percentiles, must be between 0.0 and 1.0 (inclusive)</param>
/// <returns>the values that correspond to the given percentiles.</returns>
public IList<double> Compute(IEnumerable<double> percentiles)
{
if (percentiles == null)
{
throw new ArgumentNullException("percentiles");
}
return percentiles.Select(Compute).ToList();
}
}
}

115
src/Numerics/Threading/CommonParallel.cs

@ -46,35 +46,6 @@ namespace MathNet.Numerics.Threading
/// </summary>
public static class CommonParallel
{
/// <summary>
/// Executes a for loop in which iterations may run in parallel.
/// </summary>
/// <param name="fromInclusive">The start index, inclusive.</param>
/// <param name="toExclusive">The end index, exclusive.</param>
/// <param name="body">The body to be invoked for each iteration.</param>
/// <exception cref="ArgumentNullException">The <paramref name="body"/> argument is <c>null</c>.</exception>
/// <exception cref="AggregateException">At least one invocation of the body threw an exception.</exception>
[Obsolete("Use a more efficient overload instead. Scheduled for removal in v3.0.")]
public static void For(int fromInclusive, int toExclusive, Action<int> body)
{
if (body == null) throw new ArgumentNullException("body");
if (toExclusive <= fromInclusive) throw new ArgumentOutOfRangeException("toExclusive");
int rangeSize = (toExclusive - fromInclusive)/(Control.NumberOfParallelWorkerThreads*2);
rangeSize = Math.Max(rangeSize, 1);
For(fromInclusive,
toExclusive,
rangeSize,
(start, stop) =>
{
for (var i = start; i < stop; i++)
{
body(i);
}
});
}
/// <summary>
/// Executes a for loop in which iterations may run in parallel.
/// </summary>
@ -142,92 +113,6 @@ namespace MathNet.Numerics.Threading
#endif
}
/// <summary>
/// Executes a for loop in which iterations may run in parallel.
/// </summary>
/// <param name="array">The array to iterate over.</param>
/// <param name="body">The body to be invoked for each iteration.</param>
/// <exception cref="ArgumentNullException">The <paramref name="body"/> argument is <c>null</c>.</exception>
/// <exception cref="AggregateException">At least one invocation of the body threw an exception.</exception>
[Obsolete("Use a more efficient overload instead. Scheduled for removal in v3.0.")]
public static void For<T>(T[] array, Action<int, T> body)
{
if (body == null)
{
throw new ArgumentNullException("body");
}
// Special case: no action
if (array == null || array.Length == 0)
{
return;
}
// Special case: single action, inline
if (array.Length == 0)
{
body(0, array[0]);
return;
}
// Special case: straight execution without parallelism
if (Control.DisableParallelization || Control.NumberOfParallelWorkerThreads < 2)
{
// efficient since the compiler can drop the range checks
for (int i = 0; i < array.Length; i++)
{
body(i, array[i]);
}
return;
}
// Common case
#if PORTABLE
var tasks = new Task[Control.NumberOfParallelWorkerThreads];
var size = array.Length / tasks.Length;
// partition the jobs into separate sets for each but the last worked thread
for (var i1 = 0; i1 < tasks.Length - 1; i1++)
{
var start = (i1 * size);
var stop = ((i1 + 1) * size);
tasks[i1] = Task.Factory.StartNew(() =>
{
for (int j = start; j < stop; j++)
{
body(j, array[j]);
}
});
}
// add another set for last worker thread
tasks[tasks.Length - 1] = Task.Factory.StartNew(() =>
{
for (int j = ((tasks.Length - 1) * size); j < array.Length; j++)
{
body(j, array[j]);
}
});
Task.WaitAll(tasks);
#else
Parallel.ForEach(
Partitioner.Create(0, array.Length),
new ParallelOptions
{
MaxDegreeOfParallelism = Control.NumberOfParallelWorkerThreads
},
(range, loopState) =>
{
for (var i = range.Item1; i < range.Item2; i++)
{
body(i, array[i]);
}
});
#endif
}
/// <summary>
/// Executes each of the provided actions inside a discrete, asynchronous task.
/// </summary>

47
src/UnitTests/StatisticsTests/PercentileTests.cs

@ -28,8 +28,6 @@
// OTHER DEALINGS IN THE SOFTWARE.
// </copyright>
using System;
namespace MathNet.Numerics.UnitTests.StatisticsTests
{
using NUnit.Framework;
@ -38,7 +36,7 @@ namespace MathNet.Numerics.UnitTests.StatisticsTests
/// <summary>
/// Percentile tests.
/// </summary>
[TestFixture, Obsolete]
[TestFixture]
public class PercentileTests
{
/// <summary>
@ -49,63 +47,37 @@ namespace MathNet.Numerics.UnitTests.StatisticsTests
/// <summary>
/// Can compute percentile using NIST method.
/// </summary>
[Test, Obsolete]
[Test]
public void CanComputePercentileUsingNistMethod()
{
var percentile = new Percentile(Data)
{
Method = PercentileMethod.Nist
};
Assert.AreEqual(95.19807, percentile.Compute(.9));
Assert.AreEqual(95.19807, Data.QuantileCustom(.9, QuantileDefinition.Nist));
}
/// <summary>
/// Can compute percentile using excel method.
/// </summary>
[Test, Obsolete]
[Test]
public void CanComputePercentileUsingExcelMethod()
{
var percentile = new Percentile(Data)
{
Method = PercentileMethod.Excel
};
Assert.AreEqual(95.19568, percentile.Compute(.9));
Assert.AreEqual(95.19568, Data.QuantileCustom(.9, QuantileDefinition.Excel));
}
/// <summary>
/// Can compute percentile using nearest method.
/// </summary>
[Test, Obsolete]
[Test]
public void CanComputePercentileUsingNearestMethod()
{
var percentile = new Percentile(Data)
{
Method = PercentileMethod.Nearest
};
Assert.AreEqual(95.1959, percentile.Compute(.9));
Assert.AreEqual(95.1959, Data.QuantileCustom(.9, QuantileDefinition.Nearest));
}
/// <summary>
/// Can compute percentile using interpolation method
/// </summary>
[Test, Obsolete]
[Test]
public void CanComputePercentileUsingInterpolationMethod()
{
var data = new double[] {1, 2, 3, 4, 5};
var percentile = new Percentile(data)
{
Method = PercentileMethod.Interpolation
};
var values = new[] {.25, .5, .75};
var percentiles = percentile.Compute(values);
Assert.AreEqual(1.75, percentiles[0]);
Assert.AreEqual(3.0, percentiles[1]);
Assert.AreEqual(4.25, percentiles[2]);
var q = data.QuantileCustomFunc(QuantileDefinition.R5);
Assert.AreEqual(1.75, q(0.25));
Assert.AreEqual(3.0, q(0.5));
@ -115,24 +87,19 @@ namespace MathNet.Numerics.UnitTests.StatisticsTests
/// <summary>
/// Empty dataset returns NaN.
/// </summary>
[Test, Obsolete]
[Test]
public void EmptyDataSetReturnsNaN()
{
var data = new double[] {};
var percentile = new Percentile(data);
Assert.IsTrue(double.IsNaN(percentile.Compute(0)));
Assert.IsTrue(double.IsNaN(data.Quantile(0)));
}
/// <summary>
/// Invalid percentile values return NaN.
/// </summary>
[Test, Obsolete]
[Test]
public void InvalidPercentileValuesReturnNaN()
{
var percentile = new Percentile(Data);
Assert.IsTrue(double.IsNaN(percentile.Compute(-0.1)));
Assert.IsTrue(double.IsNaN(percentile.Compute(1.1)));
Assert.IsTrue(double.IsNaN(Data.Quantile(-0.1)));
Assert.IsTrue(double.IsNaN(Data.Quantile(1.1)));
}

Loading…
Cancel
Save