From 55db448f900a4b41f123db360a41c9eab4195599 Mon Sep 17 00:00:00 2001 From: Christoph Ruegg Date: Mon, 26 Oct 2015 18:54:17 +0100 Subject: [PATCH] LA: fix bug in Complex and Complex32 SparseMatrix.ToTypeString #347 The Complex and Complex32 implementation of SparseMatrix.ToTypeString was reporting a filling percentage that was too large by a factor of 100 because the conversion to percentage was done twice (once by `P2` string format) --- src/Numerics/LinearAlgebra/Complex/SparseMatrix.cs | 2 +- src/Numerics/LinearAlgebra/Complex32/SparseMatrix.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Numerics/LinearAlgebra/Complex/SparseMatrix.cs b/src/Numerics/LinearAlgebra/Complex/SparseMatrix.cs index baa3d8e9..dfa636b9 100644 --- a/src/Numerics/LinearAlgebra/Complex/SparseMatrix.cs +++ b/src/Numerics/LinearAlgebra/Complex/SparseMatrix.cs @@ -1494,7 +1494,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex public override string ToTypeString() { - return string.Format("SparseMatrix {0}x{1}-Complex {2:P2} Filled", RowCount, ColumnCount, 100d * NonZerosCount / (RowCount * (double)ColumnCount)); + return string.Format("SparseMatrix {0}x{1}-Complex {2:P2} Filled", RowCount, ColumnCount, NonZerosCount / (RowCount * (double)ColumnCount)); } } } diff --git a/src/Numerics/LinearAlgebra/Complex32/SparseMatrix.cs b/src/Numerics/LinearAlgebra/Complex32/SparseMatrix.cs index f1e606aa..2ae0a461 100644 --- a/src/Numerics/LinearAlgebra/Complex32/SparseMatrix.cs +++ b/src/Numerics/LinearAlgebra/Complex32/SparseMatrix.cs @@ -1488,7 +1488,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32 public override string ToTypeString() { - return string.Format("SparseMatrix {0}x{1}-Complex32 {2:P2} Filled", RowCount, ColumnCount, 100d * NonZerosCount / (RowCount * (double)ColumnCount)); + return string.Format("SparseMatrix {0}x{1}-Complex32 {2:P2} Filled", RowCount, ColumnCount, NonZerosCount / (RowCount * (double)ColumnCount)); } } }