From e80ea6f5a2b8beb28abbd0f3de12d52f25f70a6b Mon Sep 17 00:00:00 2001 From: Christoph Ruegg Date: Sat, 26 Jul 2014 16:28:41 +0200 Subject: [PATCH] LA: fix RemoveColumn/Row early index bound check #240 --- src/Numerics/LinearAlgebra/Matrix.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Numerics/LinearAlgebra/Matrix.cs b/src/Numerics/LinearAlgebra/Matrix.cs index 4bb626f9..b5f9c7e4 100644 --- a/src/Numerics/LinearAlgebra/Matrix.cs +++ b/src/Numerics/LinearAlgebra/Matrix.cs @@ -718,10 +718,10 @@ namespace MathNet.Numerics.LinearAlgebra /// /// The index of the column to remove. /// A new matrix without the chosen column. - /// If is < zero or > the number of columns. + /// If is < zero or >= the number of columns. public Matrix RemoveColumn(int columnIndex) { - if (columnIndex < 0 || columnIndex > ColumnCount) + if (columnIndex < 0 || columnIndex >= ColumnCount) { throw new ArgumentOutOfRangeException("columnIndex"); } @@ -834,10 +834,10 @@ namespace MathNet.Numerics.LinearAlgebra /// /// The index of the row to remove. /// A new matrix without the chosen row. - /// If is < zero or > the number of rows. + /// If is < zero or >= the number of rows. public Matrix RemoveRow(int rowIndex) { - if (rowIndex < 0 || rowIndex > RowCount) + if (rowIndex < 0 || rowIndex >= RowCount) { throw new ArgumentOutOfRangeException("rowIndex"); }