From 07f563d7e43c42060f6161ad2aed4bb71d1da437 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Mon, 26 Nov 2012 14:37:45 +0200 Subject: [PATCH] [SymmetricDenseMatrix] Trace(): remove redundant check for square matrix since symm matrices are always square Signed-off-by: Alexander Karatarakis --- src/Numerics/LinearAlgebra/Double/SymmetricDenseMatrix.cs | 7 +------ src/Numerics/LinearAlgebra/Single/SymmetricDenseMatrix.cs | 7 +------ 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/src/Numerics/LinearAlgebra/Double/SymmetricDenseMatrix.cs b/src/Numerics/LinearAlgebra/Double/SymmetricDenseMatrix.cs index d989a081..f5624d1e 100644 --- a/src/Numerics/LinearAlgebra/Double/SymmetricDenseMatrix.cs +++ b/src/Numerics/LinearAlgebra/Double/SymmetricDenseMatrix.cs @@ -529,14 +529,9 @@ namespace MathNet.Numerics.LinearAlgebra.Double /// Computes the trace of this matrix. /// /// The trace of this matrix - /// If the matrix is not square public override double Trace() { - if (RowCount != ColumnCount) - { - throw new ArgumentException(Resources.ArgumentMatrixSquare); - } - + // Matrix is always square. var sum = 0.0; for (var i = 0; i < RowCount; i++) { diff --git a/src/Numerics/LinearAlgebra/Single/SymmetricDenseMatrix.cs b/src/Numerics/LinearAlgebra/Single/SymmetricDenseMatrix.cs index 2f9d7251..7b6068c4 100644 --- a/src/Numerics/LinearAlgebra/Single/SymmetricDenseMatrix.cs +++ b/src/Numerics/LinearAlgebra/Single/SymmetricDenseMatrix.cs @@ -529,14 +529,9 @@ namespace MathNet.Numerics.LinearAlgebra.Single /// Computes the trace of this matrix. /// /// The trace of this matrix - /// If the matrix is not square public override float Trace() { - if (RowCount != ColumnCount) - { - throw new ArgumentException(Resources.ArgumentMatrixSquare); - } - + // Matrix is always square. var sum = 0.0f; for (var i = 0; i < RowCount; i++) {