From 03f613852ed77e2f68700d98d6b8b1bba7cb65e7 Mon Sep 17 00:00:00 2001 From: Marcus Cuda Date: Sun, 4 Jul 2010 21:49:21 +0800 Subject: [PATCH] added missing commit --- src/MathNet.Numerics.5.0.ReSharper | 7 ++++++- .../ManagedLinearAlgebraProvider.cs | 17 ++++++++--------- src/Numerics/Properties/Resources.resx | 3 +++ 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/src/MathNet.Numerics.5.0.ReSharper b/src/MathNet.Numerics.5.0.ReSharper index d76c21db..20bd5dbf 100644 --- a/src/MathNet.Numerics.5.0.ReSharper +++ b/src/MathNet.Numerics.5.0.ReSharper @@ -11,7 +11,12 @@ en-US false pointwise -Frobenius +Frobenius +indices +ipiv +blocksize +Dont +Cholesky diff --git a/src/Numerics/Algorithms/LinearAlgebra/ManagedLinearAlgebraProvider.cs b/src/Numerics/Algorithms/LinearAlgebra/ManagedLinearAlgebraProvider.cs index cf2b3287..6fcf52a5 100644 --- a/src/Numerics/Algorithms/LinearAlgebra/ManagedLinearAlgebraProvider.cs +++ b/src/Numerics/Algorithms/LinearAlgebra/ManagedLinearAlgebraProvider.cs @@ -1037,7 +1037,8 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra if (work.Length < rRows * rRows) { - throw new ArgumentException(Resources.ArgumentArraysSameLength, "work"); + work[0] = rRows * rRows; + throw new ArgumentException(Resources.WorkArrayTooSmall, "work"); } CommonParallel.For(0, rRows, i => q[(i * rRows) + i] = 1.0); @@ -1502,9 +1503,8 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra if (work.Length < aRows) { - // TODO: Actually "work = new double[aRows]" is acceptable size of work array. I set size proposed in method description - work[0] = Math.Max((3 * Math.Min(aRows, aColumns)) + Math.Max(aRows, aColumns), 5 * Math.Min(aRows, aColumns)); - return; + work[0] = aRows; + throw new ArgumentException(Resources.WorkArrayTooSmall, "work"); } const int Maxiter = 1000; @@ -2172,8 +2172,8 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra if (work.Length < aRows) { - work[0] = Math.Max(3 * Math.Min(aRows, aColumns) + Math.Max(aRows, aColumns), 5 * Math.Min(aRows, aColumns)); - return; + work[0] = aRows; + throw new ArgumentException(Resources.WorkArrayTooSmall, "work"); } const int Maxiter = 1000; @@ -2965,9 +2965,8 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra if (work.Length < aRows) { - // TODO: Actually "work = new double[aRows]" is acceptable size of work array. I set size proposed in method description - work[0] = Math.Max((3 * Math.Min(aRows, aColumns)) + Math.Max(aRows, aColumns), 5 * Math.Min(aRows, aColumns)); - return; + work[0] = aRows; + throw new ArgumentException(Resources.WorkArrayTooSmall, "work"); } SingularValueDecomposition(true, a, aRows, aColumns, s, u, vt, work); diff --git a/src/Numerics/Properties/Resources.resx b/src/Numerics/Properties/Resources.resx index 3c600f68..61500ada 100644 --- a/src/Numerics/Properties/Resources.resx +++ b/src/Numerics/Properties/Resources.resx @@ -309,4 +309,7 @@ The singular vectors were not computed. + + The given work array is too small. Check work[0] for the corret size. + \ No newline at end of file