Browse Source

Merge pull request #542 from jnyrup/ArgumentChecks

Argument checks
spatial
Christoph Ruegg 9 years ago
committed by GitHub
parent
commit
e53e3cac5b
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      src/Numerics/Distance.cs
  2. 2
      src/Numerics/Optimization/NelderMeadSimplex.cs
  3. 5
      src/Numerics/Providers/LinearAlgebra/ManagedLinearAlgebraProvider.Complex.cs

4
src/Numerics/Distance.cs

@ -427,7 +427,7 @@ namespace MathNet.Numerics
throw new ArgumentException(Resources.ArgumentVectorsSameLength); throw new ArgumentException(Resources.ArgumentVectorsSameLength);
} }
if ((a.Length == 0 && b.Length == 0) || (a == null && b == null)) if (a.Length == 0 && b.Length == 0)
{ {
return 0; return 0;
} }
@ -473,7 +473,7 @@ namespace MathNet.Numerics
throw new ArgumentException(Resources.ArgumentVectorsSameLength); throw new ArgumentException(Resources.ArgumentVectorsSameLength);
} }
if ((a.Length == 0 && b.Length == 0) || (a == null && b == null)) if (a.Length == 0 && b.Length == 0)
{ {
return 0; return 0;
} }

2
src/Numerics/Optimization/NelderMeadSimplex.cs

@ -113,7 +113,7 @@ namespace MathNet.Numerics.Optimization
if (initialGuess == null) if (initialGuess == null)
throw new ArgumentNullException("initialGuess", "initialGuess must be initialized"); throw new ArgumentNullException("initialGuess", "initialGuess must be initialized");
if (initialGuess == null) if (initalPertubation == null)
throw new ArgumentNullException("initalPertubation", "initalPertubation must be initialized, if unknown use overloaded version of FindMinimum()"); throw new ArgumentNullException("initalPertubation", "initalPertubation must be initialized, if unknown use overloaded version of FindMinimum()");
SimplexConstant[] simplexConstants = SimplexConstant.CreateSimplexConstantsFromVectors(initialGuess,initalPertubation); SimplexConstant[] simplexConstants = SimplexConstant.CreateSimplexConstantsFromVectors(initialGuess,initalPertubation);

5
src/Numerics/Providers/LinearAlgebra/ManagedLinearAlgebraProvider.Complex.cs

@ -70,11 +70,6 @@ namespace MathNet.Numerics.Providers.LinearAlgebra
throw new ArgumentException(Resources.ArgumentVectorsSameLength); throw new ArgumentException(Resources.ArgumentVectorsSameLength);
} }
if (y.Length != x.Length)
{
throw new ArgumentException(Resources.ArgumentVectorsSameLength);
}
if (alpha.IsZero()) if (alpha.IsZero())
{ {
y.Copy(result); y.Copy(result);

Loading…
Cancel
Save