diff --git a/src/Numerics.IO/LinearAlgebra/IO/Matlab/MatlabParser.cs b/src/Numerics.IO/LinearAlgebra/IO/Matlab/MatlabParser.cs index 4485d710..7c8cbdf6 100644 --- a/src/Numerics.IO/LinearAlgebra/IO/Matlab/MatlabParser.cs +++ b/src/Numerics.IO/LinearAlgebra/IO/Matlab/MatlabParser.cs @@ -412,7 +412,6 @@ namespace MathNet.Numerics.LinearAlgebra.IO.Matlab for (var i = 0; i < ir.Count; i++) { var row = ir[i]; - // if (jc[col + 1] == i) while(jc[col + 1] == i) { col++; @@ -470,7 +469,7 @@ namespace MathNet.Numerics.LinearAlgebra.IO.Matlab for (var i = 0; i < ir.Count; i++) { var row = ir[i]; - if (jc[col + 1] == i) + while (jc[col + 1] == i) { col++; } @@ -529,7 +528,7 @@ namespace MathNet.Numerics.LinearAlgebra.IO.Matlab for (var i = 0; i < ir.Count; i++) { var row = ir[i]; - if (jc[col + 1] == i) + while (jc[col + 1] == i) { col++; } @@ -585,7 +584,7 @@ namespace MathNet.Numerics.LinearAlgebra.IO.Matlab for (var i = 0; i < ir.Count; i++) { var row = ir[i]; - if (jc[col + 1] == i) + while (jc[col + 1] == i) { col++; } @@ -646,7 +645,7 @@ namespace MathNet.Numerics.LinearAlgebra.IO.Matlab for (var i = 0; i < ir.Count; i++) { var row = ir[i]; - if (jc[col + 1] == i) + while (jc[col + 1] == i) { col++; } @@ -703,7 +702,7 @@ namespace MathNet.Numerics.LinearAlgebra.IO.Matlab for (var i = 0; i < ir.Count; i++) { var row = ir[i]; - if (jc[col + 1] == i) + while (jc[col + 1] == i) { col++; } diff --git a/src/UnitTests/LinearAlgebraTests/Complex/IO/MatlabWriterTests.cs b/src/UnitTests/LinearAlgebraTests/Complex/IO/MatlabWriterTests.cs index 486251df..ad69ea87 100644 --- a/src/UnitTests/LinearAlgebraTests/Complex/IO/MatlabWriterTests.cs +++ b/src/UnitTests/LinearAlgebraTests/Complex/IO/MatlabWriterTests.cs @@ -97,16 +97,14 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Complex.IO } Matrix mat3 = new SparseMatrix(5, 4); - for (var i = 0; i < mat3.ColumnCount; i++) - { - mat3[i, i] = new Complex(i + .1, i + .1); - } + mat3[0, 0] = new Complex(1.1, 1.1); + mat3[0, 2] = new Complex(2.2, 2.2); + mat3[4, 3] = new Complex(3.3, 3.3); Matrix mat4 = new SparseMatrix(3, 5); - for (var i = 0; i < mat4.RowCount; i++) - { - mat4[i, i] = new Complex(i + .1, i + .1); - } + mat4[0, 0] = new Complex(1.1, 1.1); + mat4[0, 2] = new Complex(2.2, 2.2); + mat4[2, 4] = new Complex(3.3, 3.3); var write = new[] { mat1, mat2, mat3, mat4 }; diff --git a/src/UnitTests/LinearAlgebraTests/Complex32/IO/MatlabWriterTests.cs b/src/UnitTests/LinearAlgebraTests/Complex32/IO/MatlabWriterTests.cs index c21d51d9..71aa7338 100644 --- a/src/UnitTests/LinearAlgebraTests/Complex32/IO/MatlabWriterTests.cs +++ b/src/UnitTests/LinearAlgebraTests/Complex32/IO/MatlabWriterTests.cs @@ -97,16 +97,14 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Complex32.IO } Matrix mat3 = new SparseMatrix(5, 4); - for (var i = 0; i < mat3.ColumnCount; i++) - { - mat3[i, i] = new Complex32(i + .1f, i + .1f); - } + mat3[0, 0] = new Complex32(1.1f, 1.1f); + mat3[0, 2] = new Complex32(2.2f, 2.2f); + mat3[4, 3] = new Complex32(3.3f, 3.3f); Matrix mat4 = new SparseMatrix(3, 5); - for (var i = 0; i < mat4.RowCount; i++) - { - mat4[i, i] = new Complex32(i + .1f, i + .1f); - } + mat4[0, 0] = new Complex32(1.1f, 1.1f); + mat4[0, 2] = new Complex32(2.2f, 2.2f); + mat4[2, 4] = new Complex32(3.3f, 3.3f); var write = new[] { mat1, mat2, mat3, mat4 }; diff --git a/src/UnitTests/LinearAlgebraTests/Double/IO/MatlabWriterTests.cs b/src/UnitTests/LinearAlgebraTests/Double/IO/MatlabWriterTests.cs index 608d6ef1..f4c3c5db 100644 --- a/src/UnitTests/LinearAlgebraTests/Double/IO/MatlabWriterTests.cs +++ b/src/UnitTests/LinearAlgebraTests/Double/IO/MatlabWriterTests.cs @@ -96,16 +96,14 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Double.IO } Matrix mat3 = new SparseMatrix(5, 4); - for (var i = 0; i < mat3.ColumnCount; i++) - { - mat3[i, i] = i + .1; - } + mat3[0, 0] = 1.1; + mat3[0, 2] = 2.2; + mat3[4, 3] = 3.3; Matrix mat4 = new SparseMatrix(3, 5); - for (var i = 0; i < mat4.RowCount; i++) - { - mat4[i, i] = i + .1; - } + mat4[0, 0] = 1.1; + mat4[0, 2] = 2.2; + mat4[2, 4] = 3.3; var write = new[] { mat1, mat2, mat3, mat4 }; diff --git a/src/UnitTests/LinearAlgebraTests/Single/IO/MatlabWriterTests.cs b/src/UnitTests/LinearAlgebraTests/Single/IO/MatlabWriterTests.cs index 3ded9446..694d002b 100644 --- a/src/UnitTests/LinearAlgebraTests/Single/IO/MatlabWriterTests.cs +++ b/src/UnitTests/LinearAlgebraTests/Single/IO/MatlabWriterTests.cs @@ -95,16 +95,14 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Single.IO } Matrix mat3 = new SparseMatrix(5, 4); - for (var i = 0; i < mat3.ColumnCount; i++) - { - mat3[i, i] = i + .1f; - } + mat3[0, 0] = 1.1f; + mat3[0, 2] = 2.2f; + mat3[4, 3] = 3.3f; Matrix mat4 = new SparseMatrix(3, 5); - for (var i = 0; i < mat4.RowCount; i++) - { - mat4[i, i] = i + .1f; - } + mat4[0, 0] = 1.1f; + mat4[0, 2] = 2.2f; + mat4[2, 4] = 3.3f; var write = new[] { mat1, mat2, mat3, mat4 };