Browse Source

Argument checks

spatial
jnyrup 9 years ago
parent
commit
5b1fd6fe62
  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);
}
if ((a.Length == 0 && b.Length == 0) || (a == null && b == null))
if (a.Length == 0 && b.Length == 0)
{
return 0;
}
@ -473,7 +473,7 @@ namespace MathNet.Numerics
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;
}

2
src/Numerics/Optimization/NelderMeadSimplex.cs

@ -113,7 +113,7 @@ namespace MathNet.Numerics.Optimization
if (initialGuess == null)
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()");
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);
}
if (y.Length != x.Length)
{
throw new ArgumentException(Resources.ArgumentVectorsSameLength);
}
if (alpha.IsZero())
{
y.Copy(result);

Loading…
Cancel
Save