Browse Source

[SymmetricMatrix] Disable SetRow/Column() for symmetric matrices

Signed-off-by: Alexander Karatarakis <alex@karatarakis.com>
la-symmetric^2
Alexander Karatarakis 14 years ago
parent
commit
38a8b1f01b
  1. 80
      src/Numerics/LinearAlgebra/Complex/SymmetricMatrix.cs
  2. 80
      src/Numerics/LinearAlgebra/Complex32/SymmetricMatrix.cs
  3. 80
      src/Numerics/LinearAlgebra/Double/SymmetricMatrix.cs
  4. 80
      src/Numerics/LinearAlgebra/Single/SymmetricMatrix.cs

80
src/Numerics/LinearAlgebra/Complex/SymmetricMatrix.cs

@ -574,25 +574,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex
/// equal the number of rows of this <strong>Matrix</strong>.</exception>
public override void SetColumn(int columnIndex, Complex[] column)
{
if (columnIndex < 0 || columnIndex >= ColumnCount)
{
throw new ArgumentOutOfRangeException("columnIndex");
}
if (column == null)
{
throw new ArgumentNullException("column");
}
if (column.Length != RowCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSameRowDimension, "column");
}
for (var i = 0; i < columnIndex; i++)
{
At(i, columnIndex, column[i]);
}
throw new InvalidOperationException("Setting a column is not supported on a symmetric matrix. It will violate symmetry");
}
/// <summary>
@ -607,25 +589,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex
/// equal the number of rows of this <strong>Matrix</strong>.</exception>
public override void SetColumn(int columnIndex, Vector<Complex> column)
{
if (columnIndex < 0 || columnIndex >= ColumnCount)
{
throw new ArgumentOutOfRangeException("columnIndex");
}
if (column == null)
{
throw new ArgumentNullException("column");
}
if (column.Count != RowCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSameRowDimension, "column");
}
for (var i = 0; i < columnIndex; i++)
{
At(i, columnIndex, column[i]);
}
throw new InvalidOperationException("Setting a column is not supported on a symmetric matrix. It will violate symmetry");
}
/// <summary>
@ -654,25 +618,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex
/// equal the number of columns of this <strong>Matrix</strong>.</exception>
public override void SetRow(int rowIndex, Vector<Complex> row)
{
if (rowIndex < 0 || rowIndex >= RowCount)
{
throw new ArgumentOutOfRangeException("rowIndex");
}
if (row == null)
{
throw new ArgumentNullException("row");
}
if (row.Count != ColumnCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSameRowDimension, "row");
}
for (var i = rowIndex; i < ColumnCount; i++)
{
At(rowIndex, i, row[i]);
}
throw new InvalidOperationException("Setting a row is not supported on a symmetric matrix. It will violate symmetry");
}
/// <summary>
@ -687,25 +633,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex
/// equal the number of columns of this <strong>Matrix</strong>.</exception>
public override void SetRow(int rowIndex, Complex[] row)
{
if (rowIndex < 0 || rowIndex >= RowCount)
{
throw new ArgumentOutOfRangeException("rowIndex");
}
if (row == null)
{
throw new ArgumentNullException("row");
}
if (row.Length != ColumnCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSameRowDimension, "row");
}
for (var i = rowIndex; i < ColumnCount; i++)
{
At(rowIndex, i, row[i]);
}
throw new InvalidOperationException("Setting a row is not supported on a symmetric matrix. It will violate symmetry");
}
}
}

80
src/Numerics/LinearAlgebra/Complex32/SymmetricMatrix.cs

@ -574,25 +574,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32
/// equal the number of rows of this <strong>Matrix</strong>.</exception>
public override void SetColumn(int columnIndex, Complex32[] column)
{
if (columnIndex < 0 || columnIndex >= ColumnCount)
{
throw new ArgumentOutOfRangeException("columnIndex");
}
if (column == null)
{
throw new ArgumentNullException("column");
}
if (column.Length != RowCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSameRowDimension, "column");
}
for (var i = 0; i < columnIndex; i++)
{
At(i, columnIndex, column[i]);
}
throw new InvalidOperationException("Setting a column is not supported on a symmetric matrix. It will violate symmetry");
}
/// <summary>
@ -607,25 +589,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32
/// equal the number of rows of this <strong>Matrix</strong>.</exception>
public override void SetColumn(int columnIndex, Vector<Complex32> column)
{
if (columnIndex < 0 || columnIndex >= ColumnCount)
{
throw new ArgumentOutOfRangeException("columnIndex");
}
if (column == null)
{
throw new ArgumentNullException("column");
}
if (column.Count != RowCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSameRowDimension, "column");
}
for (var i = 0; i < columnIndex; i++)
{
At(i, columnIndex, column[i]);
}
throw new InvalidOperationException("Setting a column is not supported on a symmetric matrix. It will violate symmetry");
}
/// <summary>
@ -654,25 +618,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32
/// equal the number of columns of this <strong>Matrix</strong>.</exception>
public override void SetRow(int rowIndex, Vector<Complex32> row)
{
if (rowIndex < 0 || rowIndex >= RowCount)
{
throw new ArgumentOutOfRangeException("rowIndex");
}
if (row == null)
{
throw new ArgumentNullException("row");
}
if (row.Count != ColumnCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSameRowDimension, "row");
}
for (var i = rowIndex; i < ColumnCount; i++)
{
At(rowIndex, i, row[i]);
}
throw new InvalidOperationException("Setting a row is not supported on a symmetric matrix. It will violate symmetry");
}
/// <summary>
@ -687,25 +633,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32
/// equal the number of columns of this <strong>Matrix</strong>.</exception>
public override void SetRow(int rowIndex, Complex32[] row)
{
if (rowIndex < 0 || rowIndex >= RowCount)
{
throw new ArgumentOutOfRangeException("rowIndex");
}
if (row == null)
{
throw new ArgumentNullException("row");
}
if (row.Length != ColumnCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSameRowDimension, "row");
}
for (var i = rowIndex; i < ColumnCount; i++)
{
At(rowIndex, i, row[i]);
}
throw new InvalidOperationException("Setting a row is not supported on a symmetric matrix. It will violate symmetry");
}
}
}

80
src/Numerics/LinearAlgebra/Double/SymmetricMatrix.cs

@ -588,25 +588,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double
/// equal the number of rows of this <strong>Matrix</strong>.</exception>
public override void SetColumn(int columnIndex, double[] column)
{
if (columnIndex < 0 || columnIndex >= ColumnCount)
{
throw new ArgumentOutOfRangeException("columnIndex");
}
if (column == null)
{
throw new ArgumentNullException("column");
}
if (column.Length != RowCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSameRowDimension, "column");
}
for (var i = 0; i < columnIndex; i++)
{
At(i, columnIndex, column[i]);
}
throw new InvalidOperationException("Setting a column is not supported on a symmetric matrix. It will violate symmetry");
}
/// <summary>
@ -621,25 +603,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double
/// equal the number of rows of this <strong>Matrix</strong>.</exception>
public override void SetColumn(int columnIndex, Vector<double> column)
{
if (columnIndex < 0 || columnIndex >= ColumnCount)
{
throw new ArgumentOutOfRangeException("columnIndex");
}
if (column == null)
{
throw new ArgumentNullException("column");
}
if (column.Count != RowCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSameRowDimension, "column");
}
for (var i = 0; i < columnIndex; i++)
{
At(i, columnIndex, column[i]);
}
throw new InvalidOperationException("Setting a column is not supported on a symmetric matrix. It will violate symmetry");
}
/// <summary>
@ -668,25 +632,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double
/// equal the number of columns of this <strong>Matrix</strong>.</exception>
public override void SetRow(int rowIndex, Vector<double> row)
{
if (rowIndex < 0 || rowIndex >= RowCount)
{
throw new ArgumentOutOfRangeException("rowIndex");
}
if (row == null)
{
throw new ArgumentNullException("row");
}
if (row.Count != ColumnCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSameRowDimension, "row");
}
for (var i = rowIndex; i < ColumnCount; i++)
{
At(rowIndex, i, row[i]);
}
throw new InvalidOperationException("Setting a row is not supported on a symmetric matrix. It will violate symmetry");
}
/// <summary>
@ -701,25 +647,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double
/// equal the number of columns of this <strong>Matrix</strong>.</exception>
public override void SetRow(int rowIndex, double[] row)
{
if (rowIndex < 0 || rowIndex >= RowCount)
{
throw new ArgumentOutOfRangeException("rowIndex");
}
if (row == null)
{
throw new ArgumentNullException("row");
}
if (row.Length != ColumnCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSameRowDimension, "row");
}
for (var i = rowIndex; i < ColumnCount; i++)
{
At(rowIndex, i, row[i]);
}
throw new InvalidOperationException("Setting a row is not supported on a symmetric matrix. It will violate symmetry");
}
}
}

80
src/Numerics/LinearAlgebra/Single/SymmetricMatrix.cs

@ -588,25 +588,7 @@ namespace MathNet.Numerics.LinearAlgebra.Single
/// equal the number of rows of this <strong>Matrix</strong>.</exception>
public override void SetColumn(int columnIndex, float[] column)
{
if (columnIndex < 0 || columnIndex >= ColumnCount)
{
throw new ArgumentOutOfRangeException("columnIndex");
}
if (column == null)
{
throw new ArgumentNullException("column");
}
if (column.Length != RowCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSameRowDimension, "column");
}
for (var i = 0; i < columnIndex; i++)
{
At(i, columnIndex, column[i]);
}
throw new InvalidOperationException("Setting a column is not supported on a symmetric matrix. It will violate symmetry");
}
/// <summary>
@ -621,25 +603,7 @@ namespace MathNet.Numerics.LinearAlgebra.Single
/// equal the number of rows of this <strong>Matrix</strong>.</exception>
public override void SetColumn(int columnIndex, Vector<float> column)
{
if (columnIndex < 0 || columnIndex >= ColumnCount)
{
throw new ArgumentOutOfRangeException("columnIndex");
}
if (column == null)
{
throw new ArgumentNullException("column");
}
if (column.Count != RowCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSameRowDimension, "column");
}
for (var i = 0; i < columnIndex; i++)
{
At(i, columnIndex, column[i]);
}
throw new InvalidOperationException("Setting a column is not supported on a symmetric matrix. It will violate symmetry");
}
/// <summary>
@ -668,25 +632,7 @@ namespace MathNet.Numerics.LinearAlgebra.Single
/// equal the number of columns of this <strong>Matrix</strong>.</exception>
public override void SetRow(int rowIndex, Vector<float> row)
{
if (rowIndex < 0 || rowIndex >= RowCount)
{
throw new ArgumentOutOfRangeException("rowIndex");
}
if (row == null)
{
throw new ArgumentNullException("row");
}
if (row.Count != ColumnCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSameRowDimension, "row");
}
for (var i = rowIndex; i < ColumnCount; i++)
{
At(rowIndex, i, row[i]);
}
throw new InvalidOperationException("Setting a row is not supported on a symmetric matrix. It will violate symmetry");
}
/// <summary>
@ -701,25 +647,7 @@ namespace MathNet.Numerics.LinearAlgebra.Single
/// equal the number of columns of this <strong>Matrix</strong>.</exception>
public override void SetRow(int rowIndex, float[] row)
{
if (rowIndex < 0 || rowIndex >= RowCount)
{
throw new ArgumentOutOfRangeException("rowIndex");
}
if (row == null)
{
throw new ArgumentNullException("row");
}
if (row.Length != ColumnCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSameRowDimension, "row");
}
for (var i = rowIndex; i < ColumnCount; i++)
{
At(rowIndex, i, row[i]);
}
throw new InvalidOperationException("Setting a row is not supported on a symmetric matrix. It will violate symmetry");
}
}
}

Loading…
Cancel
Save