Browse Source

LA: upgrade old/obsolete ctors to new implementation (deduplication)

pull/112/head
Christoph Ruegg 13 years ago
parent
commit
400d61641f
  1. 12
      src/Numerics/LinearAlgebra/Complex/DenseMatrix.cs
  2. 19
      src/Numerics/LinearAlgebra/Complex/DiagonalMatrix.cs
  3. 12
      src/Numerics/LinearAlgebra/Complex/SparseMatrix.cs
  4. 12
      src/Numerics/LinearAlgebra/Complex32/DenseMatrix.cs
  5. 19
      src/Numerics/LinearAlgebra/Complex32/DiagonalMatrix.cs
  6. 12
      src/Numerics/LinearAlgebra/Complex32/SparseMatrix.cs
  7. 12
      src/Numerics/LinearAlgebra/Double/DenseMatrix.cs
  8. 19
      src/Numerics/LinearAlgebra/Double/DiagonalMatrix.cs
  9. 12
      src/Numerics/LinearAlgebra/Double/SparseMatrix.cs
  10. 12
      src/Numerics/LinearAlgebra/Single/DenseMatrix.cs
  11. 19
      src/Numerics/LinearAlgebra/Single/DiagonalMatrix.cs
  12. 12
      src/Numerics/LinearAlgebra/Single/SparseMatrix.cs

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

@ -168,15 +168,8 @@ namespace MathNet.Numerics.LinearAlgebra.Complex
/// </summary>
[Obsolete("Use DenseMatrix.OfArray instead. Scheduled for removal in v3.0.")]
public DenseMatrix(Complex[,] array)
: this(array.GetLength(0), array.GetLength(1))
: this(DenseColumnMajorMatrixStorage<Complex>.OfArray(array))
{
for (var i = 0; i < _rowCount; i++)
{
for (var j = 0; j < _columnCount; j++)
{
_values[(j * _rowCount) + i] = array[i, j];
}
}
}
/// <summary>
@ -186,9 +179,8 @@ namespace MathNet.Numerics.LinearAlgebra.Complex
/// </summary>
[Obsolete("Use DenseMatrix.OfMatrix instead. Scheduled for removal in v3.0.")]
public DenseMatrix(Matrix<Complex> matrix)
: this(matrix.RowCount, matrix.ColumnCount)
: this(DenseColumnMajorMatrixStorage<Complex>.OfMatrix(matrix.Storage))
{
matrix.Storage.CopyToUnchecked(Storage, skipClearing: true);
}
/// <summary>

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

@ -149,22 +149,8 @@ namespace MathNet.Numerics.LinearAlgebra.Complex
/// </summary>
[Obsolete("Use DiagonalMatrix.OfArray instead. Scheduled for removal in v3.0.")]
public DiagonalMatrix(Complex[,] array)
: this(array.GetLength(0), array.GetLength(1))
: this(DiagonalMatrixStorage<Complex>.OfArray(array))
{
for (var i = 0; i < RowCount; i++)
{
for (var j = 0; j < ColumnCount; j++)
{
if (i == j)
{
_data[i] = array[i, j];
}
else if (((array[i, j].Real != 0.0) && !double.IsNaN(array[i, j].Real)) || ((array[i, j].Imaginary != 0.0) && !double.IsNaN(array[i, j].Imaginary)))
{
throw new IndexOutOfRangeException("Cannot set an off-diagonal element in a diagonal matrix.");
}
}
}
}
/// <summary>
@ -175,9 +161,8 @@ namespace MathNet.Numerics.LinearAlgebra.Complex
/// </summary>
[Obsolete("Use DiagonalMatrix.OfMatrix instead. Scheduled for removal in v3.0.")]
public DiagonalMatrix(Matrix<Complex> matrix)
: this(matrix.RowCount, matrix.ColumnCount)
: this(DiagonalMatrixStorage<Complex>.OfMatrix(matrix.Storage))
{
matrix.Storage.CopyToUnchecked(Storage, skipClearing: true);
}
/// <summary>

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

@ -220,15 +220,8 @@ namespace MathNet.Numerics.LinearAlgebra.Complex
/// </summary>
[Obsolete("Use SparseMatrix.OfArray instead. Scheduled for removal in v3.0.")]
public SparseMatrix(Complex[,] array)
: this(array.GetLength(0), array.GetLength(1))
: this(SparseCompressedRowMatrixStorage<Complex>.OfArray(array))
{
for (var i = 0; i < _storage.RowCount; i++)
{
for (var j = 0; j < _storage.ColumnCount; j++)
{
_storage.At(i, j, array[i, j]);
}
}
}
/// <summary>
@ -238,9 +231,8 @@ namespace MathNet.Numerics.LinearAlgebra.Complex
/// </summary>
[Obsolete("Use SparseMatrix.OfMatrix instead. Scheduled for removal in v3.0.")]
public SparseMatrix(Matrix<Complex> matrix)
: this(matrix.RowCount, matrix.ColumnCount)
: this(SparseCompressedRowMatrixStorage<Complex>.OfMatrix(matrix.Storage))
{
matrix.Storage.CopyToUnchecked(Storage, skipClearing: true);
}
/// <summary>

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

@ -168,15 +168,8 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32
/// </summary>
[Obsolete("Use DenseMatrix.OfArray instead. Scheduled for removal in v3.0.")]
public DenseMatrix(Complex32[,] array)
: this(array.GetLength(0), array.GetLength(1))
: this(DenseColumnMajorMatrixStorage<Complex32>.OfArray(array))
{
for (var i = 0; i < _rowCount; i++)
{
for (var j = 0; j < _columnCount; j++)
{
_values[(j * _rowCount) + i] = array[i, j];
}
}
}
/// <summary>
@ -186,9 +179,8 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32
/// </summary>
[Obsolete("Use DenseMatrix.OfMatrix instead. Scheduled for removal in v3.0.")]
public DenseMatrix(Matrix<Complex32> matrix)
: this(matrix.RowCount, matrix.ColumnCount)
: this(DenseColumnMajorMatrixStorage<Complex32>.OfMatrix(matrix.Storage))
{
matrix.Storage.CopyToUnchecked(Storage, skipClearing: true);
}
/// <summary>

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

@ -149,22 +149,8 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32
/// </summary>
[Obsolete("Use DiagonalMatrix.OfArray instead. Scheduled for removal in v3.0.")]
public DiagonalMatrix(Complex32[,] array)
: this(array.GetLength(0), array.GetLength(1))
: this(DiagonalMatrixStorage<Complex32>.OfArray(array))
{
for (var i = 0; i < RowCount; i++)
{
for (var j = 0; j < ColumnCount; j++)
{
if (i == j)
{
_data[i] = array[i, j];
}
else if (((array[i, j].Real != 0.0) && !double.IsNaN(array[i, j].Real)) || ((array[i, j].Imaginary != 0.0) && !double.IsNaN(array[i, j].Imaginary)))
{
throw new IndexOutOfRangeException("Cannot set an off-diagonal element in a diagonal matrix.");
}
}
}
}
/// <summary>
@ -175,9 +161,8 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32
/// </summary>
[Obsolete("Use DiagonalMatrix.OfMatrix instead. Scheduled for removal in v3.0.")]
public DiagonalMatrix(Matrix<Complex32> matrix)
: this(matrix.RowCount, matrix.ColumnCount)
: this(DiagonalMatrixStorage<Complex32>.OfMatrix(matrix.Storage))
{
matrix.Storage.CopyToUnchecked(Storage, skipClearing: true);
}
/// <summary>

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

@ -220,15 +220,8 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32
/// </summary>
[Obsolete("Use SparseMatrix.OfArray instead. Scheduled for removal in v3.0.")]
public SparseMatrix(Complex32[,] array)
: this(array.GetLength(0), array.GetLength(1))
: this(SparseCompressedRowMatrixStorage<Complex32>.OfArray(array))
{
for (var i = 0; i < _storage.RowCount; i++)
{
for (var j = 0; j < _storage.ColumnCount; j++)
{
_storage.At(i, j, array[i, j]);
}
}
}
/// <summary>
@ -238,9 +231,8 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32
/// </summary>
[Obsolete("Use SparseMatrix.OfMatrix instead. Scheduled for removal in v3.0.")]
public SparseMatrix(Matrix<Complex32> matrix)
: this(matrix.RowCount, matrix.ColumnCount)
: this(SparseCompressedRowMatrixStorage<Complex32>.OfMatrix(matrix.Storage))
{
matrix.Storage.CopyToUnchecked(Storage, skipClearing: true);
}
/// <summary>

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

@ -170,15 +170,8 @@ namespace MathNet.Numerics.LinearAlgebra.Double
/// </summary>
[Obsolete("Use DenseMatrix.OfArray instead. Scheduled for removal in v3.0.")]
public DenseMatrix(double[,] array)
: this(array.GetLength(0), array.GetLength(1))
: this(DenseColumnMajorMatrixStorage<double>.OfArray(array))
{
for (var i = 0; i < _rowCount; i++)
{
for (var j = 0; j < _columnCount; j++)
{
_values[(j * _rowCount) + i] = array[i, j];
}
}
}
/// <summary>
@ -188,9 +181,8 @@ namespace MathNet.Numerics.LinearAlgebra.Double
/// </summary>
[Obsolete("Use DenseMatrix.OfMatrix instead. Scheduled for removal in v3.0.")]
public DenseMatrix(Matrix<double> matrix)
: this(matrix.RowCount, matrix.ColumnCount)
: this(DenseColumnMajorMatrixStorage<double>.OfMatrix(matrix.Storage))
{
matrix.Storage.CopyToUnchecked(Storage, skipClearing: true);
}
/// <summary>

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

@ -148,22 +148,8 @@ namespace MathNet.Numerics.LinearAlgebra.Double
/// </summary>
[Obsolete("Use DiagonalMatrix.OfArray instead. Scheduled for removal in v3.0.")]
public DiagonalMatrix(double[,] array)
: this(array.GetLength(0), array.GetLength(1))
: this(DiagonalMatrixStorage<double>.OfArray(array))
{
for (var i = 0; i < RowCount; i++)
{
for (var j = 0; j < ColumnCount; j++)
{
if (i == j)
{
_data[i] = array[i, j];
}
else if (array[i, j] != 0.0 && !Double.IsNaN(array[i, j]))
{
throw new IndexOutOfRangeException("Cannot set an off-diagonal element in a diagonal matrix.");
}
}
}
}
/// <summary>
@ -174,9 +160,8 @@ namespace MathNet.Numerics.LinearAlgebra.Double
/// </summary>
[Obsolete("Use DiagonalMatrix.OfMatrix instead. Scheduled for removal in v3.0.")]
public DiagonalMatrix(Matrix<double> matrix)
: this(matrix.RowCount, matrix.ColumnCount)
: this(DiagonalMatrixStorage<double>.OfMatrix(matrix.Storage))
{
matrix.Storage.CopyToUnchecked(Storage, skipClearing: true);
}
/// <summary>

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

@ -219,15 +219,8 @@ namespace MathNet.Numerics.LinearAlgebra.Double
/// </summary>
[Obsolete("Use SparseMatrix.OfArray instead. Scheduled for removal in v3.0.")]
public SparseMatrix(double[,] array)
: this(array.GetLength(0), array.GetLength(1))
: this(SparseCompressedRowMatrixStorage<double>.OfArray(array))
{
for (var i = 0; i < _storage.RowCount; i++)
{
for (var j = 0; j < _storage.ColumnCount; j++)
{
_storage.At(i, j, array[i, j]);
}
}
}
/// <summary>
@ -237,9 +230,8 @@ namespace MathNet.Numerics.LinearAlgebra.Double
/// </summary>
[Obsolete("Use SparseMatrix.OfMatrix instead. Scheduled for removal in v3.0.")]
public SparseMatrix(Matrix<double> matrix)
: this(matrix.RowCount, matrix.ColumnCount)
: this(SparseCompressedRowMatrixStorage<double>.OfMatrix(matrix.Storage))
{
matrix.Storage.CopyToUnchecked(Storage, skipClearing: true);
}
/// <summary>

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

@ -168,15 +168,8 @@ namespace MathNet.Numerics.LinearAlgebra.Single
/// </summary>
[Obsolete("Use DenseMatrix.OfArray instead. Scheduled for removal in v3.0.")]
public DenseMatrix(float[,] array)
: this(array.GetLength(0), array.GetLength(1))
: this(DenseColumnMajorMatrixStorage<float>.OfArray(array))
{
for (var i = 0; i < _rowCount; i++)
{
for (var j = 0; j < _columnCount; j++)
{
_values[(j * _rowCount) + i] = array[i, j];
}
}
}
/// <summary>
@ -186,9 +179,8 @@ namespace MathNet.Numerics.LinearAlgebra.Single
/// </summary>
[Obsolete("Use DenseMatrix.OfMatrix instead. Scheduled for removal in v3.0.")]
public DenseMatrix(Matrix<float> matrix)
: this(matrix.RowCount, matrix.ColumnCount)
: this(DenseColumnMajorMatrixStorage<float>.OfMatrix(matrix.Storage))
{
matrix.Storage.CopyToUnchecked(Storage, skipClearing: true);
}
/// <summary>

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

@ -148,22 +148,8 @@ namespace MathNet.Numerics.LinearAlgebra.Single
/// </summary>
[Obsolete("Use DiagonalMatrix.OfArray instead. Scheduled for removal in v3.0.")]
public DiagonalMatrix(float[,] array)
: this(array.GetLength(0), array.GetLength(1))
: this(DiagonalMatrixStorage<float>.OfArray(array))
{
for (var i = 0; i < RowCount; i++)
{
for (var j = 0; j < ColumnCount; j++)
{
if (i == j)
{
_data[i] = array[i, j];
}
else if (array[i, j] != 0.0 && !float.IsNaN(array[i, j]))
{
throw new IndexOutOfRangeException("Cannot set an off-diagonal element in a diagonal matrix.");
}
}
}
}
/// <summary>
@ -174,9 +160,8 @@ namespace MathNet.Numerics.LinearAlgebra.Single
/// </summary>
[Obsolete("Use DiagonalMatrix.OfMatrix instead. Scheduled for removal in v3.0.")]
public DiagonalMatrix(Matrix<float> matrix)
: this(matrix.RowCount, matrix.ColumnCount)
: this(DiagonalMatrixStorage<float>.OfMatrix(matrix.Storage))
{
matrix.Storage.CopyToUnchecked(Storage, skipClearing: true);
}
/// <summary>

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

@ -219,15 +219,8 @@ namespace MathNet.Numerics.LinearAlgebra.Single
/// </summary>
[Obsolete("Use SparseMatrix.OfArray instead. Scheduled for removal in v3.0.")]
public SparseMatrix(float[,] array)
: this(array.GetLength(0), array.GetLength(1))
: this(SparseCompressedRowMatrixStorage<float>.OfArray(array))
{
for (var i = 0; i < _storage.RowCount; i++)
{
for (var j = 0; j < _storage.ColumnCount; j++)
{
_storage.At(i, j, array[i, j]);
}
}
}
/// <summary>
@ -237,9 +230,8 @@ namespace MathNet.Numerics.LinearAlgebra.Single
/// </summary>
[Obsolete("Use SparseMatrix.OfMatrix instead. Scheduled for removal in v3.0.")]
public SparseMatrix(Matrix<float> matrix)
: this(matrix.RowCount, matrix.ColumnCount)
: this(SparseCompressedRowMatrixStorage<float>.OfMatrix(matrix.Storage))
{
matrix.Storage.CopyToUnchecked(Storage, skipClearing: true);
}
/// <summary>

Loading…
Cancel
Save