From 55b2dbc6a8a608a69b5fa23f6423c55ba88a2a90 Mon Sep 17 00:00:00 2001 From: Christoph Ruegg Date: Thu, 26 Jun 2014 18:43:18 +0200 Subject: [PATCH] LA: fix bug in Matrix.RemoveRow range checks --- src/Numerics/LinearAlgebra/Matrix.cs | 2 +- .../LinearAlgebraTests/MatrixStructureTheory.Reform.cs | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/src/Numerics/LinearAlgebra/Matrix.cs b/src/Numerics/LinearAlgebra/Matrix.cs index 13d2add5..bc31a785 100644 --- a/src/Numerics/LinearAlgebra/Matrix.cs +++ b/src/Numerics/LinearAlgebra/Matrix.cs @@ -836,7 +836,7 @@ namespace MathNet.Numerics.LinearAlgebra /// If is < zero or > the number of rows. public Matrix RemoveRow(int rowIndex) { - if (rowIndex < 0 || rowIndex > ColumnCount) + if (rowIndex < 0 || rowIndex > RowCount) { throw new ArgumentOutOfRangeException("rowIndex"); } diff --git a/src/UnitTests/LinearAlgebraTests/MatrixStructureTheory.Reform.cs b/src/UnitTests/LinearAlgebraTests/MatrixStructureTheory.Reform.cs index 7efb3095..0405dc91 100644 --- a/src/UnitTests/LinearAlgebraTests/MatrixStructureTheory.Reform.cs +++ b/src/UnitTests/LinearAlgebraTests/MatrixStructureTheory.Reform.cs @@ -134,7 +134,6 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests [Theory] public void CanRemoveRow(Matrix matrix) { - var row = Vector.Build.Random(matrix.ColumnCount, 0); for (var position = 0; position < matrix.RowCount; position++) { var result = matrix.RemoveRow(position); @@ -195,7 +194,6 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests [Theory] public void CanRemoveColumn(Matrix matrix) { - var column = Vector.Build.Random(matrix.RowCount, 0); for (var position = 0; position < matrix.ColumnCount; position++) { var result = matrix.RemoveColumn(position);