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);