From 465a2c2bd8b6820b7141797d18ff5b97dc137c05 Mon Sep 17 00:00:00 2001 From: Christoph Ruegg Date: Sun, 1 Dec 2013 23:36:55 +0100 Subject: [PATCH] LA: Diagonal matrices: clean up some pointless null-checks --- .../LinearAlgebra/Complex/DiagonalMatrix.cs | 46 ------------------- .../LinearAlgebra/Complex32/DiagonalMatrix.cs | 45 ------------------ .../LinearAlgebra/Double/DiagonalMatrix.cs | 46 ------------------- .../LinearAlgebra/Single/DiagonalMatrix.cs | 46 ------------------- .../MatrixStructureTheory.Access.cs | 10 ++-- .../MatrixStructureTheory.Reform.cs | 4 +- 6 files changed, 7 insertions(+), 190 deletions(-) diff --git a/src/Numerics/LinearAlgebra/Complex/DiagonalMatrix.cs b/src/Numerics/LinearAlgebra/Complex/DiagonalMatrix.cs index 5d5cfbaf..d18bdff1 100644 --- a/src/Numerics/LinearAlgebra/Complex/DiagonalMatrix.cs +++ b/src/Numerics/LinearAlgebra/Complex/DiagonalMatrix.cs @@ -199,7 +199,6 @@ namespace MathNet.Numerics.LinearAlgebra.Complex /// /// The matrix to add to this matrix. /// The matrix to store the result of the addition. - /// If the other matrix is . /// If the two matrices don't have the same dimensions. protected override void DoAdd(Matrix other, Matrix result) { @@ -221,7 +220,6 @@ namespace MathNet.Numerics.LinearAlgebra.Complex /// /// The matrix to subtract. /// The matrix to store the result of the subtraction. - /// If the other matrix is . /// If the two matrices don't have the same dimensions. protected override void DoSubtract(Matrix other, Matrix result) { @@ -243,18 +241,12 @@ namespace MathNet.Numerics.LinearAlgebra.Complex /// /// The array to copy the values from. The length of the vector should be /// Min(Rows, Columns). - /// If is . /// If the length of does not /// equal Min(Rows, Columns). /// For non-square matrices, the elements of are copied to /// this[i,i]. public override void SetDiagonal(Complex[] source) { - if (source == null) - { - throw new ArgumentNullException("source"); - } - if (source.Length != _data.Length) { throw new ArgumentException(Resources.ArgumentArraysSameLength, "source"); @@ -268,7 +260,6 @@ namespace MathNet.Numerics.LinearAlgebra.Complex /// /// The vector to copy the values from. The length of the vector should be /// Min(Rows, Columns). - /// If is . /// If the length of does not /// equal Min(Rows, Columns). /// For non-square matrices, the elements of are copied to @@ -295,7 +286,6 @@ namespace MathNet.Numerics.LinearAlgebra.Complex /// /// The scalar to multiply the matrix with. /// The matrix to store the result of the multiplication. - /// If the result matrix is . /// If the result matrix's dimensions are not the same as this matrix. protected override void DoMultiply(Complex scalar, Matrix result) { @@ -640,15 +630,9 @@ namespace MathNet.Numerics.LinearAlgebra.Complex /// Puts the lower triangle of this matrix into the result matrix. /// /// Where to store the lower triangle. - /// If is . /// If the result matrix's dimensions are not the same as this matrix. public override void LowerTriangle(Matrix result) { - if (result == null) - { - throw new ArgumentNullException("result"); - } - if (result.RowCount != RowCount || result.ColumnCount != ColumnCount) { throw DimensionsDontMatch(this, result, "result"); @@ -680,15 +664,9 @@ namespace MathNet.Numerics.LinearAlgebra.Complex /// Puts the strictly lower triangle of this matrix into the result matrix. /// /// Where to store the lower triangle. - /// If is . /// If the result matrix's dimensions are not the same as this matrix. public override void StrictlyLowerTriangle(Matrix result) { - if (result == null) - { - throw new ArgumentNullException("result"); - } - if (result.RowCount != RowCount || result.ColumnCount != ColumnCount) { throw DimensionsDontMatch(this, result, "result"); @@ -710,15 +688,9 @@ namespace MathNet.Numerics.LinearAlgebra.Complex /// Puts the upper triangle of this matrix into the result matrix. /// /// Where to store the lower triangle. - /// If is . /// If the result matrix's dimensions are not the same as this matrix. public override void UpperTriangle(Matrix result) { - if (result == null) - { - throw new ArgumentNullException("result"); - } - if (result.RowCount != RowCount || result.ColumnCount != ColumnCount) { throw DimensionsDontMatch(this, result, "result"); @@ -745,15 +717,9 @@ namespace MathNet.Numerics.LinearAlgebra.Complex /// Puts the strictly upper triangle of this matrix into the result matrix. /// /// Where to store the lower triangle. - /// If is . /// If the result matrix's dimensions are not the same as this matrix. public override void StrictlyUpperTriangle(Matrix result) { - if (result == null) - { - throw new ArgumentNullException("result"); - } - if (result.RowCount != RowCount || result.ColumnCount != ColumnCount) { throw DimensionsDontMatch(this, result, "result"); @@ -794,16 +760,10 @@ namespace MathNet.Numerics.LinearAlgebra.Complex /// The index of where to insert the column. /// The column to insert. /// A new with the inserted column. - /// If is . /// If is < zero or > the number of columns. /// If the size of != the number of rows. public override Matrix InsertColumn(int columnIndex, Vector column) { - if (column == null) - { - throw new ArgumentNullException("column"); - } - if (columnIndex < 0 || columnIndex > ColumnCount) { throw new ArgumentOutOfRangeException("columnIndex"); @@ -837,16 +797,10 @@ namespace MathNet.Numerics.LinearAlgebra.Complex /// The index of where to insert the row. /// The row to insert. /// A new with the inserted column. - /// If is . /// If is < zero or > the number of rows. /// If the size of != the number of columns. public override Matrix InsertRow(int rowIndex, Vector row) { - if (row == null) - { - throw new ArgumentNullException("row"); - } - if (rowIndex < 0 || rowIndex > RowCount) { throw new ArgumentOutOfRangeException("rowIndex"); diff --git a/src/Numerics/LinearAlgebra/Complex32/DiagonalMatrix.cs b/src/Numerics/LinearAlgebra/Complex32/DiagonalMatrix.cs index 4f3c3b97..233b51d0 100644 --- a/src/Numerics/LinearAlgebra/Complex32/DiagonalMatrix.cs +++ b/src/Numerics/LinearAlgebra/Complex32/DiagonalMatrix.cs @@ -194,7 +194,6 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32 /// /// The matrix to add to this matrix. /// The matrix to store the result of the addition. - /// If the other matrix is . /// If the two matrices don't have the same dimensions. protected override void DoAdd(Matrix other, Matrix result) { @@ -216,7 +215,6 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32 /// /// The matrix to subtract. /// The matrix to store the result of the subtraction. - /// If the other matrix is . /// If the two matrices don't have the same dimensions. protected override void DoSubtract(Matrix other, Matrix result) { @@ -238,18 +236,12 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32 /// /// The array to copy the values from. The length of the vector should be /// Min(Rows, Columns). - /// If is . /// If the length of does not /// equal Min(Rows, Columns). /// For non-square matrices, the elements of are copied to /// this[i,i]. public override void SetDiagonal(Complex32[] source) { - if (source == null) - { - throw new ArgumentNullException("source"); - } - if (source.Length != _data.Length) { throw new ArgumentException(Resources.ArgumentArraysSameLength, "source"); @@ -263,7 +255,6 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32 /// /// The vector to copy the values from. The length of the vector should be /// Min(Rows, Columns). - /// If is . /// If the length of does not /// equal Min(Rows, Columns). /// For non-square matrices, the elements of are copied to @@ -633,15 +624,9 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32 /// Puts the lower triangle of this matrix into the result matrix. /// /// Where to store the lower triangle. - /// If is . /// If the result matrix's dimensions are not the same as this matrix. public override void LowerTriangle(Matrix result) { - if (result == null) - { - throw new ArgumentNullException("result"); - } - if (result.RowCount != RowCount || result.ColumnCount != ColumnCount) { throw DimensionsDontMatch(this, result, "result"); @@ -673,15 +658,9 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32 /// Puts the strictly lower triangle of this matrix into the result matrix. /// /// Where to store the lower triangle. - /// If is . /// If the result matrix's dimensions are not the same as this matrix. public override void StrictlyLowerTriangle(Matrix result) { - if (result == null) - { - throw new ArgumentNullException("result"); - } - if (result.RowCount != RowCount || result.ColumnCount != ColumnCount) { throw DimensionsDontMatch(this, result, "result"); @@ -703,15 +682,9 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32 /// Puts the upper triangle of this matrix into the result matrix. /// /// Where to store the lower triangle. - /// If is . /// If the result matrix's dimensions are not the same as this matrix. public override void UpperTriangle(Matrix result) { - if (result == null) - { - throw new ArgumentNullException("result"); - } - if (result.RowCount != RowCount || result.ColumnCount != ColumnCount) { throw DimensionsDontMatch(this, result, "result"); @@ -738,15 +711,9 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32 /// Puts the strictly upper triangle of this matrix into the result matrix. /// /// Where to store the lower triangle. - /// If is . /// If the result matrix's dimensions are not the same as this matrix. public override void StrictlyUpperTriangle(Matrix result) { - if (result == null) - { - throw new ArgumentNullException("result"); - } - if (result.RowCount != RowCount || result.ColumnCount != ColumnCount) { throw DimensionsDontMatch(this, result, "result"); @@ -787,16 +754,10 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32 /// The index of where to insert the column. /// The column to insert. /// A new with the inserted column. - /// If is . /// If is < zero or > the number of columns. /// If the size of != the number of rows. public override Matrix InsertColumn(int columnIndex, Vector column) { - if (column == null) - { - throw new ArgumentNullException("column"); - } - if (columnIndex < 0 || columnIndex > ColumnCount) { throw new ArgumentOutOfRangeException("columnIndex"); @@ -830,16 +791,10 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32 /// The index of where to insert the row. /// The row to insert. /// A new with the inserted column. - /// If is . /// If is < zero or > the number of rows. /// If the size of != the number of columns. public override Matrix InsertRow(int rowIndex, Vector row) { - if (row == null) - { - throw new ArgumentNullException("row"); - } - if (rowIndex < 0 || rowIndex > RowCount) { throw new ArgumentOutOfRangeException("rowIndex"); diff --git a/src/Numerics/LinearAlgebra/Double/DiagonalMatrix.cs b/src/Numerics/LinearAlgebra/Double/DiagonalMatrix.cs index 81ad1356..9d735cb5 100644 --- a/src/Numerics/LinearAlgebra/Double/DiagonalMatrix.cs +++ b/src/Numerics/LinearAlgebra/Double/DiagonalMatrix.cs @@ -193,7 +193,6 @@ namespace MathNet.Numerics.LinearAlgebra.Double /// /// The matrix to add to this matrix. /// The matrix to store the result of the addition. - /// If the other matrix is . /// If the two matrices don't have the same dimensions. protected override void DoAdd(Matrix other, Matrix result) { @@ -215,7 +214,6 @@ namespace MathNet.Numerics.LinearAlgebra.Double /// /// The matrix to subtract. /// The matrix to store the result of the subtraction. - /// If the other matrix is . /// If the two matrices don't have the same dimensions. protected override void DoSubtract(Matrix other, Matrix result) { @@ -237,18 +235,12 @@ namespace MathNet.Numerics.LinearAlgebra.Double /// /// The array to copy the values from. The length of the vector should be /// Min(Rows, Columns). - /// If is . /// If the length of does not /// equal Min(Rows, Columns). /// For non-square matrices, the elements of are copied to /// this[i,i]. public override void SetDiagonal(double[] source) { - if (source == null) - { - throw new ArgumentNullException("source"); - } - if (source.Length != _data.Length) { throw new ArgumentException(Resources.ArgumentArraysSameLength, "source"); @@ -262,7 +254,6 @@ namespace MathNet.Numerics.LinearAlgebra.Double /// /// The vector to copy the values from. The length of the vector should be /// Min(Rows, Columns). - /// If is . /// If the length of does not /// equal Min(Rows, Columns). /// For non-square matrices, the elements of are copied to @@ -289,7 +280,6 @@ namespace MathNet.Numerics.LinearAlgebra.Double /// /// The scalar to multiply the matrix with. /// The matrix to store the result of the multiplication. - /// If the result matrix is . /// If the result matrix's dimensions are not the same as this matrix. protected override void DoMultiply(double scalar, Matrix result) { @@ -634,15 +624,9 @@ namespace MathNet.Numerics.LinearAlgebra.Double /// Puts the lower triangle of this matrix into the result matrix. /// /// Where to store the lower triangle. - /// If is . /// If the result matrix's dimensions are not the same as this matrix. public override void LowerTriangle(Matrix result) { - if (result == null) - { - throw new ArgumentNullException("result"); - } - if (result.RowCount != RowCount || result.ColumnCount != ColumnCount) { throw DimensionsDontMatch(this, result, "result"); @@ -674,15 +658,9 @@ namespace MathNet.Numerics.LinearAlgebra.Double /// Puts the strictly lower triangle of this matrix into the result matrix. /// /// Where to store the lower triangle. - /// If is . /// If the result matrix's dimensions are not the same as this matrix. public override void StrictlyLowerTriangle(Matrix result) { - if (result == null) - { - throw new ArgumentNullException("result"); - } - if (result.RowCount != RowCount || result.ColumnCount != ColumnCount) { throw DimensionsDontMatch(this, result, "result"); @@ -704,15 +682,9 @@ namespace MathNet.Numerics.LinearAlgebra.Double /// Puts the upper triangle of this matrix into the result matrix. /// /// Where to store the lower triangle. - /// If is . /// If the result matrix's dimensions are not the same as this matrix. public override void UpperTriangle(Matrix result) { - if (result == null) - { - throw new ArgumentNullException("result"); - } - if (result.RowCount != RowCount || result.ColumnCount != ColumnCount) { throw DimensionsDontMatch(this, result, "result"); @@ -739,15 +711,9 @@ namespace MathNet.Numerics.LinearAlgebra.Double /// Puts the strictly upper triangle of this matrix into the result matrix. /// /// Where to store the lower triangle. - /// If is . /// If the result matrix's dimensions are not the same as this matrix. public override void StrictlyUpperTriangle(Matrix result) { - if (result == null) - { - throw new ArgumentNullException("result"); - } - if (result.RowCount != RowCount || result.ColumnCount != ColumnCount) { throw DimensionsDontMatch(this, result, "result"); @@ -788,16 +754,10 @@ namespace MathNet.Numerics.LinearAlgebra.Double /// The index of where to insert the column. /// The column to insert. /// A new with the inserted column. - /// If is . /// If is < zero or > the number of columns. /// If the size of != the number of rows. public override Matrix InsertColumn(int columnIndex, Vector column) { - if (column == null) - { - throw new ArgumentNullException("column"); - } - if (columnIndex < 0 || columnIndex > ColumnCount) { throw new ArgumentOutOfRangeException("columnIndex"); @@ -831,16 +791,10 @@ namespace MathNet.Numerics.LinearAlgebra.Double /// The index of where to insert the row. /// The row to insert. /// A new with the inserted column. - /// If is . /// If is < zero or > the number of rows. /// If the size of != the number of columns. public override Matrix InsertRow(int rowIndex, Vector row) { - if (row == null) - { - throw new ArgumentNullException("row"); - } - if (rowIndex < 0 || rowIndex > RowCount) { throw new ArgumentOutOfRangeException("rowIndex"); diff --git a/src/Numerics/LinearAlgebra/Single/DiagonalMatrix.cs b/src/Numerics/LinearAlgebra/Single/DiagonalMatrix.cs index 78288526..fa9aa7c7 100644 --- a/src/Numerics/LinearAlgebra/Single/DiagonalMatrix.cs +++ b/src/Numerics/LinearAlgebra/Single/DiagonalMatrix.cs @@ -193,7 +193,6 @@ namespace MathNet.Numerics.LinearAlgebra.Single /// /// The matrix to add to this matrix. /// The matrix to store the result of the addition. - /// If the other matrix is . /// If the two matrices don't have the same dimensions. protected override void DoAdd(Matrix other, Matrix result) { @@ -215,7 +214,6 @@ namespace MathNet.Numerics.LinearAlgebra.Single /// /// The matrix to subtract. /// The matrix to store the result of the subtraction. - /// If the other matrix is . /// If the two matrices don't have the same dimensions. protected override void DoSubtract(Matrix other, Matrix result) { @@ -237,18 +235,12 @@ namespace MathNet.Numerics.LinearAlgebra.Single /// /// The array to copy the values from. The length of the vector should be /// Min(Rows, Columns). - /// If is . /// If the length of does not /// equal Min(Rows, Columns). /// For non-square matrices, the elements of are copied to /// this[i,i]. public override void SetDiagonal(float[] source) { - if (source == null) - { - throw new ArgumentNullException("source"); - } - if (source.Length != _data.Length) { throw new ArgumentException(Resources.ArgumentArraysSameLength, "source"); @@ -262,7 +254,6 @@ namespace MathNet.Numerics.LinearAlgebra.Single /// /// The vector to copy the values from. The length of the vector should be /// Min(Rows, Columns). - /// If is . /// If the length of does not /// equal Min(Rows, Columns). /// For non-square matrices, the elements of are copied to @@ -289,7 +280,6 @@ namespace MathNet.Numerics.LinearAlgebra.Single /// /// The scalar to multiply the matrix with. /// The matrix to store the result of the multiplication. - /// If the result matrix is . /// If the result matrix's dimensions are not the same as this matrix. protected override void DoMultiply(float scalar, Matrix result) { @@ -634,15 +624,9 @@ namespace MathNet.Numerics.LinearAlgebra.Single /// Puts the lower triangle of this matrix into the result matrix. /// /// Where to store the lower triangle. - /// If is . /// If the result matrix's dimensions are not the same as this matrix. public override void LowerTriangle(Matrix result) { - if (result == null) - { - throw new ArgumentNullException("result"); - } - if (result.RowCount != RowCount || result.ColumnCount != ColumnCount) { throw DimensionsDontMatch(this, result, "result"); @@ -674,15 +658,9 @@ namespace MathNet.Numerics.LinearAlgebra.Single /// Puts the strictly lower triangle of this matrix into the result matrix. /// /// Where to store the lower triangle. - /// If is . /// If the result matrix's dimensions are not the same as this matrix. public override void StrictlyLowerTriangle(Matrix result) { - if (result == null) - { - throw new ArgumentNullException("result"); - } - if (result.RowCount != RowCount || result.ColumnCount != ColumnCount) { throw DimensionsDontMatch(this, result, "result"); @@ -704,15 +682,9 @@ namespace MathNet.Numerics.LinearAlgebra.Single /// Puts the upper triangle of this matrix into the result matrix. /// /// Where to store the lower triangle. - /// If is . /// If the result matrix's dimensions are not the same as this matrix. public override void UpperTriangle(Matrix result) { - if (result == null) - { - throw new ArgumentNullException("result"); - } - if (result.RowCount != RowCount || result.ColumnCount != ColumnCount) { throw DimensionsDontMatch(this, result, "result"); @@ -739,15 +711,9 @@ namespace MathNet.Numerics.LinearAlgebra.Single /// Puts the strictly upper triangle of this matrix into the result matrix. /// /// Where to store the lower triangle. - /// If is . /// If the result matrix's dimensions are not the same as this matrix. public override void StrictlyUpperTriangle(Matrix result) { - if (result == null) - { - throw new ArgumentNullException("result"); - } - if (result.RowCount != RowCount || result.ColumnCount != ColumnCount) { throw DimensionsDontMatch(this, result, "result"); @@ -788,16 +754,10 @@ namespace MathNet.Numerics.LinearAlgebra.Single /// The index of where to insert the column. /// The column to insert. /// A new with the inserted column. - /// If is . /// If is < zero or > the number of columns. /// If the size of != the number of rows. public override Matrix InsertColumn(int columnIndex, Vector column) { - if (column == null) - { - throw new ArgumentNullException("column"); - } - if (columnIndex < 0 || columnIndex > ColumnCount) { throw new ArgumentOutOfRangeException("columnIndex"); @@ -831,16 +791,10 @@ namespace MathNet.Numerics.LinearAlgebra.Single /// The index of where to insert the row. /// The row to insert. /// A new with the inserted column. - /// If is . /// If is < zero or > the number of rows. /// If the size of != the number of columns. public override Matrix InsertRow(int rowIndex, Vector row) { - if (row == null) - { - throw new ArgumentNullException("row"); - } - if (rowIndex < 0 || rowIndex > RowCount) { throw new ArgumentOutOfRangeException("rowIndex"); diff --git a/src/UnitTests/LinearAlgebraTests/MatrixStructureTheory.Access.cs b/src/UnitTests/LinearAlgebraTests/MatrixStructureTheory.Access.cs index a724cfc4..caebcecb 100644 --- a/src/UnitTests/LinearAlgebraTests/MatrixStructureTheory.Access.cs +++ b/src/UnitTests/LinearAlgebraTests/MatrixStructureTheory.Access.cs @@ -404,7 +404,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests } } - Assert.That(() => matrix.UpperTriangle(null), Throws.InstanceOf()); + Assert.That(() => matrix.UpperTriangle(null), Throws.Exception); Assert.That(() => matrix.UpperTriangle(CreateSparseZero(matrix.RowCount + 1, matrix.ColumnCount)), Throws.ArgumentException); Assert.That(() => matrix.UpperTriangle(CreateDenseZero(matrix.RowCount, matrix.ColumnCount + 1)), Throws.ArgumentException); } @@ -445,7 +445,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests } } - Assert.That(() => matrix.LowerTriangle(null), Throws.InstanceOf()); + Assert.That(() => matrix.LowerTriangle(null), Throws.Exception); Assert.That(() => matrix.LowerTriangle(CreateSparseZero(matrix.RowCount + 1, matrix.ColumnCount)), Throws.ArgumentException); Assert.That(() => matrix.LowerTriangle(CreateDenseZero(matrix.RowCount, matrix.ColumnCount + 1)), Throws.ArgumentException); } @@ -486,7 +486,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests } } - Assert.That(() => matrix.StrictlyUpperTriangle(null), Throws.InstanceOf()); + Assert.That(() => matrix.StrictlyUpperTriangle(null), Throws.Exception); Assert.That(() => matrix.StrictlyUpperTriangle(CreateSparseZero(matrix.RowCount + 1, matrix.ColumnCount)), Throws.ArgumentException); Assert.That(() => matrix.StrictlyUpperTriangle(CreateDenseZero(matrix.RowCount, matrix.ColumnCount + 1)), Throws.ArgumentException); } @@ -527,7 +527,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests } } - Assert.That(() => matrix.StrictlyLowerTriangle(null), Throws.InstanceOf()); + Assert.That(() => matrix.StrictlyLowerTriangle(null), Throws.Exception); Assert.That(() => matrix.StrictlyLowerTriangle(CreateSparseZero(matrix.RowCount + 1, matrix.ColumnCount)), Throws.ArgumentException); Assert.That(() => matrix.StrictlyLowerTriangle(CreateDenseZero(matrix.RowCount, matrix.ColumnCount + 1)), Throws.ArgumentException); } @@ -577,7 +577,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests } // Invalid - Assert.That(() => matrix.SetDiagonal(default(T[])), Throws.InstanceOf()); + Assert.That(() => matrix.SetDiagonal(default(T[])), Throws.Exception); Assert.That(() => matrix.SetDiagonal(new T[Math.Min(matrix.RowCount, matrix.ColumnCount) - 1]), Throws.ArgumentException); Assert.That(() => matrix.SetDiagonal(new T[Math.Min(matrix.RowCount, matrix.ColumnCount) + 1]), Throws.ArgumentException); } diff --git a/src/UnitTests/LinearAlgebraTests/MatrixStructureTheory.Reform.cs b/src/UnitTests/LinearAlgebraTests/MatrixStructureTheory.Reform.cs index 09a237af..d226ed3a 100644 --- a/src/UnitTests/LinearAlgebraTests/MatrixStructureTheory.Reform.cs +++ b/src/UnitTests/LinearAlgebraTests/MatrixStructureTheory.Reform.cs @@ -124,7 +124,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests } // Invalid - Assert.That(() => matrix.InsertRow(0, default(Vector)), Throws.InstanceOf()); + Assert.That(() => matrix.InsertRow(0, default(Vector)), Throws.Exception); Assert.That(() => matrix.InsertRow(-1, CreateVectorZero(matrix.ColumnCount)), Throws.InstanceOf()); Assert.That(() => matrix.InsertRow(matrix.RowCount + 1, CreateVectorZero(matrix.ColumnCount)), Throws.InstanceOf()); Assert.That(() => matrix.InsertRow(0, CreateVectorZero(matrix.ColumnCount - 1)), Throws.ArgumentException); @@ -160,7 +160,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests } // Invalid - Assert.That(() => matrix.InsertColumn(0, default(Vector)), Throws.InstanceOf()); + Assert.That(() => matrix.InsertColumn(0, default(Vector)), Throws.Exception); Assert.That(() => matrix.InsertColumn(-1, CreateVectorZero(matrix.RowCount)), Throws.InstanceOf()); Assert.That(() => matrix.InsertColumn(matrix.ColumnCount + 1, CreateVectorZero(matrix.RowCount)), Throws.InstanceOf()); Assert.That(() => matrix.InsertColumn(0, CreateVectorZero(matrix.RowCount - 1)), Throws.ArgumentException);