Browse Source

Get rid of resources

pull/729/head
Christoph Ruegg 6 years ago
parent
commit
43297a0366
  1. 9
      src/Numerics.Tests/LinearAlgebraTests/VectorTests.cs
  2. 37
      src/Numerics/Combinatorics.cs
  3. 2
      src/Numerics/Compatibility.cs
  4. 33
      src/Numerics/Distance.cs
  5. 23
      src/Numerics/Distributions/Bernoulli.cs
  6. 25
      src/Numerics/Distributions/Beta.cs
  7. 19
      src/Numerics/Distributions/BetaBinomial.cs
  8. 27
      src/Numerics/Distributions/BetaScaled.cs
  9. 23
      src/Numerics/Distributions/Binomial.cs
  10. 17
      src/Numerics/Distributions/Burr.cs
  11. 37
      src/Numerics/Distributions/Categorical.cs
  12. 25
      src/Numerics/Distributions/Cauchy.cs
  13. 23
      src/Numerics/Distributions/Chi.cs
  14. 25
      src/Numerics/Distributions/ChiSquared.cs
  15. 25
      src/Numerics/Distributions/ContinuousUniform.cs
  16. 23
      src/Numerics/Distributions/ConwayMaxwellPoisson.cs
  17. 11
      src/Numerics/Distributions/Dirichlet.cs
  18. 23
      src/Numerics/Distributions/DiscreteUniform.cs
  19. 11
      src/Numerics/Distributions/Erlang.cs
  20. 25
      src/Numerics/Distributions/Exponential.cs
  21. 23
      src/Numerics/Distributions/FisherSnedecor.cs
  22. 25
      src/Numerics/Distributions/Gamma.cs
  23. 23
      src/Numerics/Distributions/Geometric.cs
  24. 23
      src/Numerics/Distributions/Hypergeometric.cs
  25. 21
      src/Numerics/Distributions/InverseGamma.cs
  26. 19
      src/Numerics/Distributions/InverseGaussian.cs
  27. 9
      src/Numerics/Distributions/InverseWishart.cs
  28. 23
      src/Numerics/Distributions/Laplace.cs
  29. 25
      src/Numerics/Distributions/LogNormal.cs
  30. 7
      src/Numerics/Distributions/MatrixNormal.cs
  31. 15
      src/Numerics/Distributions/Multinomial.cs
  32. 21
      src/Numerics/Distributions/NegativeBinomial.cs
  33. 25
      src/Numerics/Distributions/Normal.cs
  34. 9
      src/Numerics/Distributions/NormalGamma.cs
  35. 25
      src/Numerics/Distributions/Pareto.cs
  36. 23
      src/Numerics/Distributions/Poisson.cs
  37. 25
      src/Numerics/Distributions/Rayleigh.cs
  38. 23
      src/Numerics/Distributions/SkewedGeneralizedError.cs
  39. 23
      src/Numerics/Distributions/SkewedGeneralizedT.cs
  40. 23
      src/Numerics/Distributions/Stable.cs
  41. 25
      src/Numerics/Distributions/StudentT.cs
  42. 23
      src/Numerics/Distributions/Triangular.cs
  43. 17
      src/Numerics/Distributions/TruncatedPareto.cs
  44. 23
      src/Numerics/Distributions/Weibull.cs
  45. 7
      src/Numerics/Distributions/Wishart.cs
  46. 23
      src/Numerics/Distributions/Zipf.cs
  47. 21
      src/Numerics/Exceptions.cs
  48. 9
      src/Numerics/FindRoots.cs
  49. 3
      src/Numerics/Generate.cs
  50. 9
      src/Numerics/GoodnessOfFit.cs
  51. 17
      src/Numerics/IntegralTransforms/Fourier.cs
  52. 7
      src/Numerics/Integration/NewtonCotesTrapeziumRule.cs
  53. 5
      src/Numerics/Integration/SimpsonRule.cs
  54. 17
      src/Numerics/Interpolation/Barycentric.cs
  55. 7
      src/Numerics/Interpolation/BulirschStoerRationalInterpolation.cs
  56. 29
      src/Numerics/Interpolation/CubicSpline.cs
  57. 11
      src/Numerics/Interpolation/LinearSpline.cs
  58. 5
      src/Numerics/Interpolation/LogLinear.cs
  59. 9
      src/Numerics/Interpolation/NevillePolynomialInterpolation.cs
  60. 5
      src/Numerics/Interpolation/QuadraticSpline.cs
  61. 7
      src/Numerics/Interpolation/StepInterpolation.cs
  62. 5
      src/Numerics/Interpolation/TransformedInterpolation.cs
  63. 3
      src/Numerics/LinearAlgebra/Complex/DenseMatrix.cs
  64. 11
      src/Numerics/LinearAlgebra/Complex/DiagonalMatrix.cs
  65. 11
      src/Numerics/LinearAlgebra/Complex/Factorization/DenseCholesky.cs
  66. 15
      src/Numerics/LinearAlgebra/Complex/Factorization/DenseEvd.cs
  67. 11
      src/Numerics/LinearAlgebra/Complex/Factorization/DenseGramSchmidt.cs
  68. 9
      src/Numerics/LinearAlgebra/Complex/Factorization/DenseLU.cs
  69. 9
      src/Numerics/LinearAlgebra/Complex/Factorization/DenseQR.cs
  70. 13
      src/Numerics/LinearAlgebra/Complex/Factorization/DenseSvd.cs
  71. 3
      src/Numerics/LinearAlgebra/Complex/Factorization/GramSchmidt.cs
  72. 3
      src/Numerics/LinearAlgebra/Complex/Factorization/QR.cs
  73. 3
      src/Numerics/LinearAlgebra/Complex/Factorization/Svd.cs
  74. 11
      src/Numerics/LinearAlgebra/Complex/Factorization/UserCholesky.cs
  75. 15
      src/Numerics/LinearAlgebra/Complex/Factorization/UserEvd.cs
  76. 11
      src/Numerics/LinearAlgebra/Complex/Factorization/UserGramSchmidt.cs
  77. 9
      src/Numerics/LinearAlgebra/Complex/Factorization/UserLU.cs
  78. 9
      src/Numerics/LinearAlgebra/Complex/Factorization/UserQR.cs
  79. 13
      src/Numerics/LinearAlgebra/Complex/Factorization/UserSvd.cs
  80. 7
      src/Numerics/LinearAlgebra/Complex/Matrix.cs
  81. 5
      src/Numerics/LinearAlgebra/Complex/Solvers/BiCgStab.cs
  82. 5
      src/Numerics/LinearAlgebra/Complex/Solvers/CompositeSolver.cs
  83. 7
      src/Numerics/LinearAlgebra/Complex/Solvers/DiagonalPreconditioner.cs
  84. 3
      src/Numerics/LinearAlgebra/Complex/Solvers/GpBiCg.cs
  85. 7
      src/Numerics/LinearAlgebra/Complex/Solvers/ILU0Preconditioner.cs
  86. 7
      src/Numerics/LinearAlgebra/Complex/Solvers/ILUTPPreconditioner.cs
  87. 9
      src/Numerics/LinearAlgebra/Complex/Solvers/MILU0Preconditioner.cs
  88. 3
      src/Numerics/LinearAlgebra/Complex/Solvers/MlkBiCgStab.cs
  89. 3
      src/Numerics/LinearAlgebra/Complex/Solvers/TFQMR.cs
  90. 3
      src/Numerics/LinearAlgebra/Complex32/DenseMatrix.cs
  91. 11
      src/Numerics/LinearAlgebra/Complex32/DiagonalMatrix.cs
  92. 11
      src/Numerics/LinearAlgebra/Complex32/Factorization/DenseCholesky.cs
  93. 17
      src/Numerics/LinearAlgebra/Complex32/Factorization/DenseEvd.cs
  94. 11
      src/Numerics/LinearAlgebra/Complex32/Factorization/DenseGramSchmidt.cs
  95. 9
      src/Numerics/LinearAlgebra/Complex32/Factorization/DenseLU.cs
  96. 9
      src/Numerics/LinearAlgebra/Complex32/Factorization/DenseQR.cs
  97. 13
      src/Numerics/LinearAlgebra/Complex32/Factorization/DenseSvd.cs
  98. 3
      src/Numerics/LinearAlgebra/Complex32/Factorization/GramSchmidt.cs
  99. 3
      src/Numerics/LinearAlgebra/Complex32/Factorization/QR.cs
  100. 3
      src/Numerics/LinearAlgebra/Complex32/Factorization/Svd.cs

9
src/Numerics.Tests/LinearAlgebraTests/VectorTests.cs

@ -30,7 +30,6 @@
using System;
using MathNet.Numerics.LinearAlgebra;
using MathNet.Numerics.LinearAlgebra.Storage;
using MathNet.Numerics.Properties;
using NUnit.Framework;
namespace MathNet.Numerics.UnitTests.LinearAlgebraTests
@ -77,7 +76,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests
{
Assert.That(() => DenseVectorStorage<double>.OfInit(-1, index => 42),
Throws.TypeOf<ArgumentOutOfRangeException>()
.With.Message.Contains(Resources.ArgumentNotNegative));
.With.Message.Contains("Value must not be negative (zero is ok)."));
}
[Test]
@ -85,7 +84,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests
{
Assert.That(() => DenseVectorStorage<double>.OfValue(-1, 42),
Throws.TypeOf<ArgumentOutOfRangeException>()
.With.Message.Contains(Resources.ArgumentNotNegative));
.With.Message.Contains("Value must not be negative (zero is ok)."));
}
[Test]
@ -93,7 +92,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests
{
Assert.That(() => SparseVectorStorage<double>.OfInit(-1, index => 42),
Throws.TypeOf<ArgumentOutOfRangeException>()
.With.Message.Contains(Resources.ArgumentNotNegative));
.With.Message.Contains("Value must not be negative (zero is ok)."));
}
[Test]
@ -101,7 +100,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests
{
Assert.That(() => SparseVectorStorage<double>.OfValue(-1, 42),
Throws.TypeOf<ArgumentOutOfRangeException>()
.With.Message.Contains(Resources.ArgumentNotNegative));
.With.Message.Contains("Value must not be negative (zero is ok)."));
}
}
}

37
src/Numerics/Combinatorics.cs

@ -30,7 +30,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using MathNet.Numerics.Properties;
using MathNet.Numerics.Random;
namespace MathNet.Numerics
@ -134,7 +133,7 @@ namespace MathNet.Numerics
/// <param name="randomSource">The random number generator to use. Optional; the default random source will be used if null.</param>
public static int[] GeneratePermutation(int n, System.Random randomSource = null)
{
if (n < 0) throw new ArgumentOutOfRangeException(nameof(n), Resources.ArgumentNotNegative);
if (n < 0) throw new ArgumentOutOfRangeException(nameof(n), "Value must not be negative (zero is ok).");
int[] indices = new int[n];
for (int i = 0; i < indices.Length; i++)
@ -194,7 +193,7 @@ namespace MathNet.Numerics
/// <returns>Boolean mask array of length <c>N</c>, for each item true if it is selected.</returns>
public static bool[] GenerateCombination(int n, System.Random randomSource = null)
{
if (n < 0) throw new ArgumentOutOfRangeException(nameof(n), Resources.ArgumentNotNegative);
if (n < 0) throw new ArgumentOutOfRangeException(nameof(n), "Value must not be negative (zero is ok).");
var random = randomSource ?? SystemRandomSource.Default;
@ -216,9 +215,9 @@ namespace MathNet.Numerics
/// <returns>Boolean mask array of length <c>N</c>, for each item true if it is selected.</returns>
public static bool[] GenerateCombination(int n, int k, System.Random randomSource = null)
{
if (n < 0) throw new ArgumentOutOfRangeException(nameof(n), Resources.ArgumentNotNegative);
if (k < 0) throw new ArgumentOutOfRangeException(nameof(k), Resources.ArgumentNotNegative);
if (k > n) throw new ArgumentOutOfRangeException(nameof(k), string.Format(Resources.ArgumentOutOfRangeSmallerEqual, "k", "n"));
if (n < 0) throw new ArgumentOutOfRangeException(nameof(n), "Value must not be negative (zero is ok).");
if (k < 0) throw new ArgumentOutOfRangeException(nameof(k), "Value must not be negative (zero is ok).");
if (k > n) throw new ArgumentOutOfRangeException(nameof(k), $"{"k"} must be smaller than or equal to {"n"}.");
var random = randomSource ?? SystemRandomSource.Default;
@ -261,8 +260,8 @@ namespace MathNet.Numerics
{
T[] array = data as T[] ?? data.ToArray();
if (elementsToChoose < 0) throw new ArgumentOutOfRangeException(nameof(elementsToChoose), Resources.ArgumentNotNegative);
if (elementsToChoose > array.Length) throw new ArgumentOutOfRangeException(nameof(elementsToChoose), string.Format(Resources.ArgumentOutOfRangeSmallerEqual, "elementsToChoose", "data.Count"));
if (elementsToChoose < 0) throw new ArgumentOutOfRangeException(nameof(elementsToChoose), "Value must not be negative (zero is ok).");
if (elementsToChoose > array.Length) throw new ArgumentOutOfRangeException(nameof(elementsToChoose), $"elementsToChoose must be smaller than or equal to data.Count.");
bool[] mask = GenerateCombination(array.Length, elementsToChoose, randomSource);
@ -284,8 +283,8 @@ namespace MathNet.Numerics
/// <returns>Integer mask array of length <c>N</c>, for each item the number of times it was selected.</returns>
public static int[] GenerateCombinationWithRepetition(int n, int k, System.Random randomSource = null)
{
if (n < 0) throw new ArgumentOutOfRangeException(nameof(n), Resources.ArgumentNotNegative);
if (k < 0) throw new ArgumentOutOfRangeException(nameof(k), Resources.ArgumentNotNegative);
if (n < 0) throw new ArgumentOutOfRangeException(nameof(n), "Value must not be negative (zero is ok).");
if (k < 0) throw new ArgumentOutOfRangeException(nameof(k), "Value must not be negative (zero is ok).");
var random = randomSource ?? SystemRandomSource.Default;
@ -307,7 +306,7 @@ namespace MathNet.Numerics
/// <returns>The chosen combination with repetition, in the original order.</returns>
public static IEnumerable<T> SelectCombinationWithRepetition<T>(this IEnumerable<T> data, int elementsToChoose, System.Random randomSource = null)
{
if (elementsToChoose < 0) throw new ArgumentOutOfRangeException(nameof(elementsToChoose), Resources.ArgumentNotNegative);
if (elementsToChoose < 0) throw new ArgumentOutOfRangeException(nameof(elementsToChoose), "Value must not be negative (zero is ok).");
T[] array = data as T[] ?? data.ToArray();
int[] mask = GenerateCombinationWithRepetition(array.Length, elementsToChoose, randomSource);
@ -331,9 +330,9 @@ namespace MathNet.Numerics
/// <returns>An array of length <c>K</c> that contains the indices of the selections as integers of the interval <c>[0, N)</c>.</returns>
public static int[] GenerateVariation(int n, int k, System.Random randomSource = null)
{
if (n < 0) throw new ArgumentOutOfRangeException(nameof(n), Resources.ArgumentNotNegative);
if (k < 0) throw new ArgumentOutOfRangeException(nameof(k), Resources.ArgumentNotNegative);
if (k > n) throw new ArgumentOutOfRangeException(nameof(k), string.Format(Resources.ArgumentOutOfRangeSmallerEqual, "k", "n"));
if (n < 0) throw new ArgumentOutOfRangeException(nameof(n), "Value must not be negative (zero is ok).");
if (k < 0) throw new ArgumentOutOfRangeException(nameof(k), "Value must not be negative (zero is ok).");
if (k > n) throw new ArgumentOutOfRangeException(nameof(k), $"k must be smaller than or equal to n.");
var random = randomSource ?? SystemRandomSource.Default;
@ -368,8 +367,8 @@ namespace MathNet.Numerics
var random = randomSource ?? SystemRandomSource.Default;
T[] array = data.ToArray();
if (elementsToChoose < 0) throw new ArgumentOutOfRangeException(nameof(elementsToChoose), Resources.ArgumentNotNegative);
if (elementsToChoose > array.Length) throw new ArgumentOutOfRangeException(nameof(elementsToChoose), string.Format(Resources.ArgumentOutOfRangeSmallerEqual, "elementsToChoose", "data.Count"));
if (elementsToChoose < 0) throw new ArgumentOutOfRangeException(nameof(elementsToChoose), "Value must not be negative (zero is ok).");
if (elementsToChoose > array.Length) throw new ArgumentOutOfRangeException(nameof(elementsToChoose), "elementsToChoose must be smaller than or equal to data.Count.");
// Partial Fisher-Yates Shuffling
for (int i = array.Length - 1; i >= array.Length - elementsToChoose; i--)
@ -389,8 +388,8 @@ namespace MathNet.Numerics
/// <returns>An array of length <c>K</c> that contains the indices of the selections as integers of the interval <c>[0, N)</c>.</returns>
public static int[] GenerateVariationWithRepetition(int n, int k, System.Random randomSource = null)
{
if (n < 0) throw new ArgumentOutOfRangeException(nameof(n), Resources.ArgumentNotNegative);
if (k < 0) throw new ArgumentOutOfRangeException(nameof(k), Resources.ArgumentNotNegative);
if (n < 0) throw new ArgumentOutOfRangeException(nameof(n), "Value must not be negative (zero is ok).");
if (k < 0) throw new ArgumentOutOfRangeException(nameof(k), "Value must not be negative (zero is ok).");
var random = randomSource ?? SystemRandomSource.Default;
@ -408,7 +407,7 @@ namespace MathNet.Numerics
/// <returns>The chosen variation with repetition, in random order.</returns>
public static IEnumerable<T> SelectVariationWithRepetition<T>(this IEnumerable<T> data, int elementsToChoose, System.Random randomSource = null)
{
if (elementsToChoose < 0) throw new ArgumentOutOfRangeException(nameof(elementsToChoose), Resources.ArgumentNotNegative);
if (elementsToChoose < 0) throw new ArgumentOutOfRangeException(nameof(elementsToChoose), "Value must not be negative (zero is ok).");
T[] array = data as T[] ?? data.ToArray();
int[] indices = GenerateVariationWithRepetition(array.Length, elementsToChoose, randomSource);

2
src/Numerics/Compatibility.cs

@ -104,7 +104,7 @@ namespace MathNet.Numerics
var action = actions[i];
if (action == null)
{
throw new ArgumentException(String.Format(Properties.Resources.ArgumentItemNull, nameof(actions)), nameof(actions));
throw new ArgumentException($"At least one item of {nameof(actions)} is a null reference (Nothing in Visual Basic).", nameof(actions));
}
tasks[i] = Task.Factory.StartNew(action, parallelOptions.CancellationToken, TaskCreationOptions.None, parallelOptions.TaskScheduler);

33
src/Numerics/Distance.cs

@ -30,7 +30,6 @@
using System;
using System.Collections.Generic;
using MathNet.Numerics.LinearAlgebra;
using MathNet.Numerics.Properties;
using MathNet.Numerics.Providers.LinearAlgebra;
using MathNet.Numerics.Statistics;
@ -56,7 +55,7 @@ namespace MathNet.Numerics
{
if (a.Length != b.Length)
{
throw new ArgumentException(Resources.ArgumentVectorsSameLength);
throw new ArgumentException("All vectors must have the same dimensionality.");
}
double sum = 0d;
@ -74,7 +73,7 @@ namespace MathNet.Numerics
{
if (a.Length != b.Length)
{
throw new ArgumentException(Resources.ArgumentVectorsSameLength);
throw new ArgumentException("All vectors must have the same dimensionality.");
}
float sum = 0f;
@ -125,7 +124,7 @@ namespace MathNet.Numerics
{
if (a.Length != b.Length)
{
throw new ArgumentException(Resources.ArgumentVectorsSameLength);
throw new ArgumentException("All vectors must have the same dimensionality.");
}
var diff = new double[a.Length];
@ -140,7 +139,7 @@ namespace MathNet.Numerics
{
if (a.Length != b.Length)
{
throw new ArgumentException(Resources.ArgumentVectorsSameLength);
throw new ArgumentException("All vectors must have the same dimensionality.");
}
var diff = new float[a.Length];
@ -236,7 +235,7 @@ namespace MathNet.Numerics
{
if (a.Length != b.Length)
{
throw new ArgumentException(Resources.ArgumentVectorsSameLength);
throw new ArgumentException("All vectors must have the same dimensionality.");
}
double max = Math.Abs(a[0] - b[0]);
@ -258,7 +257,7 @@ namespace MathNet.Numerics
{
if (a.Length != b.Length)
{
throw new ArgumentException(Resources.ArgumentVectorsSameLength);
throw new ArgumentException("All vectors must have the same dimensionality.");
}
float max = Math.Abs(a[0] - b[0]);
@ -288,7 +287,7 @@ namespace MathNet.Numerics
{
if (a.Length != b.Length)
{
throw new ArgumentException(Resources.ArgumentVectorsSameLength);
throw new ArgumentException("All vectors must have the same dimensionality.");
}
if (p < 0d)
@ -326,7 +325,7 @@ namespace MathNet.Numerics
{
if (a.Length != b.Length)
{
throw new ArgumentException(Resources.ArgumentVectorsSameLength);
throw new ArgumentException("All vectors must have the same dimensionality.");
}
if (p < 0d)
@ -364,7 +363,7 @@ namespace MathNet.Numerics
{
if (a.Length != b.Length)
{
throw new ArgumentException(Resources.ArgumentVectorsSameLength);
throw new ArgumentException("All vectors must have the same dimensionality.");
}
double sum = 0d;
@ -382,7 +381,7 @@ namespace MathNet.Numerics
{
if (a.Length != b.Length)
{
throw new ArgumentException(Resources.ArgumentVectorsSameLength);
throw new ArgumentException("All vectors must have the same dimensionality.");
}
float sum = 0f;
@ -400,7 +399,7 @@ namespace MathNet.Numerics
{
if (a.Length != b.Length)
{
throw new ArgumentException(Resources.ArgumentVectorsSameLength);
throw new ArgumentException("All vectors must have the same dimensionality.");
}
var ab = LinearAlgebraControl.Provider.DotProduct(a, b);
@ -416,7 +415,7 @@ namespace MathNet.Numerics
{
if (a.Length != b.Length)
{
throw new ArgumentException(Resources.ArgumentVectorsSameLength);
throw new ArgumentException("All vectors must have the same dimensionality.");
}
var ab = LinearAlgebraControl.Provider.DotProduct(a, b);
@ -432,7 +431,7 @@ namespace MathNet.Numerics
{
if (a.Length != b.Length)
{
throw new ArgumentException(Resources.ArgumentVectorsSameLength);
throw new ArgumentException("All vectors must have the same dimensionality.");
}
int count = 0;
@ -453,7 +452,7 @@ namespace MathNet.Numerics
{
if (a.Length != b.Length)
{
throw new ArgumentException(Resources.ArgumentVectorsSameLength);
throw new ArgumentException("All vectors must have the same dimensionality.");
}
int count = 0;
@ -497,7 +496,7 @@ namespace MathNet.Numerics
if (a.Length != b.Length)
{
throw new ArgumentException(Resources.ArgumentVectorsSameLength);
throw new ArgumentException("All vectors must have the same dimensionality.");
}
if (a.Length == 0 && b.Length == 0)
@ -543,7 +542,7 @@ namespace MathNet.Numerics
if (a.Length != b.Length)
{
throw new ArgumentException(Resources.ArgumentVectorsSameLength);
throw new ArgumentException("All vectors must have the same dimensionality.");
}
if (a.Length == 0 && b.Length == 0)

23
src/Numerics/Distributions/Bernoulli.cs

@ -30,7 +30,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using MathNet.Numerics.Properties;
using MathNet.Numerics.Random;
using MathNet.Numerics.Threading;
@ -57,7 +56,7 @@ namespace MathNet.Numerics.Distributions
{
if (!IsValidParameterSet(p))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
_random = SystemRandomSource.Default;
@ -74,7 +73,7 @@ namespace MathNet.Numerics.Distributions
{
if (!IsValidParameterSet(p))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
_random = randomSource ?? SystemRandomSource.Default;
@ -231,7 +230,7 @@ namespace MathNet.Numerics.Distributions
{
if (!(p >= 0.0 && p <= 1.0))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
if (k == 0)
@ -257,7 +256,7 @@ namespace MathNet.Numerics.Distributions
{
if (!(p >= 0.0 && p <= 1.0))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
if (k == 0)
@ -279,7 +278,7 @@ namespace MathNet.Numerics.Distributions
{
if (!(p >= 0.0 && p <= 1.0))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
if (x < 0.0)
@ -367,7 +366,7 @@ namespace MathNet.Numerics.Distributions
{
if (!(p >= 0.0 && p <= 1.0))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SampleUnchecked(rnd, p);
@ -383,7 +382,7 @@ namespace MathNet.Numerics.Distributions
{
if (!(p >= 0.0 && p <= 1.0))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SamplesUnchecked(rnd, p);
@ -400,7 +399,7 @@ namespace MathNet.Numerics.Distributions
{
if (!(p >= 0.0 && p <= 1.0))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
SamplesUnchecked(rnd, values, p);
@ -415,7 +414,7 @@ namespace MathNet.Numerics.Distributions
{
if (!(p >= 0.0 && p <= 1.0))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SampleUnchecked(SystemRandomSource.Default, p);
@ -430,7 +429,7 @@ namespace MathNet.Numerics.Distributions
{
if (!(p >= 0.0 && p <= 1.0))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SamplesUnchecked(SystemRandomSource.Default, p);
@ -446,7 +445,7 @@ namespace MathNet.Numerics.Distributions
{
if (!(p >= 0.0 && p <= 1.0))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
SamplesUnchecked(SystemRandomSource.Default, values, p);

25
src/Numerics/Distributions/Beta.cs

@ -29,7 +29,6 @@
using System;
using System.Collections.Generic;
using MathNet.Numerics.Properties;
using MathNet.Numerics.Random;
using MathNet.Numerics.RootFinding;
using MathNet.Numerics.Threading;
@ -65,7 +64,7 @@ namespace MathNet.Numerics.Distributions
{
if (!IsValidParameterSet(a, b))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
_random = SystemRandomSource.Default;
@ -83,7 +82,7 @@ namespace MathNet.Numerics.Distributions
{
if (!IsValidParameterSet(a, b))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
_random = randomSource ?? SystemRandomSource.Default;
@ -432,7 +431,7 @@ namespace MathNet.Numerics.Distributions
{
if (a < 0.0 || b < 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
if (x < 0.0 || x > 1.0)
@ -501,7 +500,7 @@ namespace MathNet.Numerics.Distributions
{
if (a < 0.0 || b < 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
if (x < 0.0 || x > 1.0)
@ -563,7 +562,7 @@ namespace MathNet.Numerics.Distributions
{
if (a < 0.0 || b < 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
if (x < 0.0)
@ -633,7 +632,7 @@ namespace MathNet.Numerics.Distributions
{
if (a < 0.0 || b < 0.0 || p < 0.0 || p > 1.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return Brent.FindRoot(x => SpecialFunctions.BetaRegularized(a, b, x) - p, 0.0, 1.0, accuracy: 1e-12);
@ -650,7 +649,7 @@ namespace MathNet.Numerics.Distributions
{
if (a < 0.0 || b < 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SampleUnchecked(rnd, a, b);
@ -667,7 +666,7 @@ namespace MathNet.Numerics.Distributions
{
if (a < 0.0 || b < 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SamplesUnchecked(rnd, a, b);
@ -685,7 +684,7 @@ namespace MathNet.Numerics.Distributions
{
if (a < 0.0 || b < 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
SamplesUnchecked(rnd, values, a, b);
@ -701,7 +700,7 @@ namespace MathNet.Numerics.Distributions
{
if (a < 0.0 || b < 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SampleUnchecked(SystemRandomSource.Default, a, b);
@ -717,7 +716,7 @@ namespace MathNet.Numerics.Distributions
{
if (a < 0.0 || b < 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SamplesUnchecked(SystemRandomSource.Default, a, b);
@ -734,7 +733,7 @@ namespace MathNet.Numerics.Distributions
{
if (a < 0.0 || b < 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
SamplesUnchecked(SystemRandomSource.Default, values, a, b);

19
src/Numerics/Distributions/BetaBinomial.cs

@ -34,7 +34,6 @@
using System;
using System.Collections.Generic;
using MathNet.Numerics.Properties;
using MathNet.Numerics.Random;
namespace MathNet.Numerics.Distributions
@ -65,7 +64,7 @@ namespace MathNet.Numerics.Distributions
{
if (!IsValidParameterSet(n, a, b))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
_random = SystemRandomSource.Default;
@ -85,7 +84,7 @@ namespace MathNet.Numerics.Distributions
{
if (!IsValidParameterSet(n,a,b))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
_random = randomSource ?? SystemRandomSource.Default;
@ -226,7 +225,7 @@ namespace MathNet.Numerics.Distributions
{
if (!IsValidParameterSet(n, a, b, k))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
if (k > n)
@ -251,7 +250,7 @@ namespace MathNet.Numerics.Distributions
{
if (!IsValidParameterSet(n, a, b, k))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SpecialFunctions.BinomialLn((n), k)
@ -272,7 +271,7 @@ namespace MathNet.Numerics.Distributions
{
if (!IsValidParameterSet(n,a,b,x))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
double accumulator = 0;
@ -357,7 +356,7 @@ namespace MathNet.Numerics.Distributions
{
if (!IsValidParameterSet(n,a,b))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SampleUnchecked(rnd, n, a, b);
}
@ -374,7 +373,7 @@ namespace MathNet.Numerics.Distributions
{
if (!IsValidParameterSet(n, a, b))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
SamplesUnchecked(rnd, values, n, a, b);
@ -391,7 +390,7 @@ namespace MathNet.Numerics.Distributions
{
if (!IsValidParameterSet(n, a, b))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SamplesUnchecked(_random, n, a, b);
}
@ -407,7 +406,7 @@ namespace MathNet.Numerics.Distributions
{
if (!IsValidParameterSet(n, a, b))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
SamplesUnchecked(_random, values, n, a, b);

27
src/Numerics/Distributions/BetaScaled.cs

@ -29,7 +29,6 @@
using System;
using System.Collections.Generic;
using MathNet.Numerics.Properties;
using MathNet.Numerics.Random;
using MathNet.Numerics.Threading;
@ -55,7 +54,7 @@ namespace MathNet.Numerics.Distributions
{
if (!IsValidParameterSet(a, b, location, scale))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
_random = SystemRandomSource.Default;
@ -77,7 +76,7 @@ namespace MathNet.Numerics.Distributions
{
if (!IsValidParameterSet(a, b, location, scale))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
_random = randomSource ?? SystemRandomSource.Default;
@ -100,7 +99,7 @@ namespace MathNet.Numerics.Distributions
{
if (min > max || likely > max || likely < min)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
// specified to make the formulas match the literature;
@ -413,7 +412,7 @@ namespace MathNet.Numerics.Distributions
{
if (!(a > 0.0 && b > 0.0 && scale > 0.0) || double.IsNaN(location))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return Beta.PDF(a, b, (x - location)/scale)/Math.Abs(scale);
@ -433,7 +432,7 @@ namespace MathNet.Numerics.Distributions
{
if (!(a > 0.0 && b > 0.0 && scale > 0.0) || double.IsNaN(location))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return Beta.PDFLn(a, b, (x - location)/scale) - Math.Log(Math.Abs(scale));
@ -453,7 +452,7 @@ namespace MathNet.Numerics.Distributions
{
if (!(a > 0.0 && b > 0.0 && scale > 0.0) || double.IsNaN(location))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return Beta.CDF(a, b, (x - location) / scale);
@ -475,7 +474,7 @@ namespace MathNet.Numerics.Distributions
{
if (!(a > 0.0 && b > 0.0 && scale > 0.0) || double.IsNaN(location))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return Beta.InvCDF(a, b, p)*scale + location;
@ -494,7 +493,7 @@ namespace MathNet.Numerics.Distributions
{
if (!(a > 0.0 && b > 0.0 && scale > 0.0) || double.IsNaN(location))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SampleUnchecked(rnd, a, b, location, scale);
@ -513,7 +512,7 @@ namespace MathNet.Numerics.Distributions
{
if (!(a > 0.0 && b > 0.0 && scale > 0.0) || double.IsNaN(location))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SamplesUnchecked(rnd, a, b, location, scale);
@ -533,7 +532,7 @@ namespace MathNet.Numerics.Distributions
{
if (!(a > 0.0 && b > 0.0 && scale > 0.0) || double.IsNaN(location))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
SamplesUnchecked(rnd, values, a, b, location, scale);
@ -551,7 +550,7 @@ namespace MathNet.Numerics.Distributions
{
if (!(a > 0.0 && b > 0.0 && scale > 0.0) || double.IsNaN(location))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SampleUnchecked(SystemRandomSource.Default, a, b, location, scale);
@ -569,7 +568,7 @@ namespace MathNet.Numerics.Distributions
{
if (!(a > 0.0 && b > 0.0 && scale > 0.0) || double.IsNaN(location))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SamplesUnchecked(SystemRandomSource.Default, a, b, location, scale);
@ -588,7 +587,7 @@ namespace MathNet.Numerics.Distributions
{
if (!(a > 0.0 && b > 0.0 && scale > 0.0) || double.IsNaN(location))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
SamplesUnchecked(SystemRandomSource.Default, values, a, b, location, scale);

23
src/Numerics/Distributions/Binomial.cs

@ -29,7 +29,6 @@
using System;
using System.Collections.Generic;
using MathNet.Numerics.Properties;
using MathNet.Numerics.Random;
using MathNet.Numerics.Threading;
@ -61,7 +60,7 @@ namespace MathNet.Numerics.Distributions
{
if (!IsValidParameterSet(p, n))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
_random = SystemRandomSource.Default;
@ -81,7 +80,7 @@ namespace MathNet.Numerics.Distributions
{
if (!IsValidParameterSet(p, n))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
_random = randomSource ?? SystemRandomSource.Default;
@ -270,7 +269,7 @@ namespace MathNet.Numerics.Distributions
{
if (!(p >= 0.0 && p <= 1.0 && n >= 0))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
if (k < 0 || k > n)
@ -302,7 +301,7 @@ namespace MathNet.Numerics.Distributions
{
if (!(p >= 0.0 && p <= 1.0 && n >= 0))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
if (k < 0 || k > n)
@ -335,7 +334,7 @@ namespace MathNet.Numerics.Distributions
{
if (!(p >= 0.0 && p <= 1.0 && n >= 0))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
if (x < 0.0)
@ -434,7 +433,7 @@ namespace MathNet.Numerics.Distributions
{
if (!(p >= 0.0 && p <= 1.0 && n >= 0))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SampleUnchecked(rnd, p, n);
@ -451,7 +450,7 @@ namespace MathNet.Numerics.Distributions
{
if (!(p >= 0.0 && p <= 1.0 && n >= 0))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SamplesUnchecked(rnd, p, n);
@ -469,7 +468,7 @@ namespace MathNet.Numerics.Distributions
{
if (!(p >= 0.0 && p <= 1.0 && n >= 0))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
SamplesUnchecked(rnd, values, p, n);
@ -485,7 +484,7 @@ namespace MathNet.Numerics.Distributions
{
if (!(p >= 0.0 && p <= 1.0 && n >= 0))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SampleUnchecked(SystemRandomSource.Default, p, n);
@ -501,7 +500,7 @@ namespace MathNet.Numerics.Distributions
{
if (!(p >= 0.0 && p <= 1.0 && n >= 0))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SamplesUnchecked(SystemRandomSource.Default, p, n);
@ -518,7 +517,7 @@ namespace MathNet.Numerics.Distributions
{
if (!(p >= 0.0 && p <= 1.0 && n >= 0))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
SamplesUnchecked(SystemRandomSource.Default, values, p, n);

17
src/Numerics/Distributions/Burr.cs

@ -27,7 +27,6 @@
// OTHER DEALINGS IN THE SOFTWARE.
// </copyright>
using MathNet.Numerics.Properties;
using MathNet.Numerics.Random;
using System;
using System.Collections.Generic;
@ -64,7 +63,7 @@ namespace MathNet.Numerics.Distributions
{
if (!IsValidParameterSet(a, c, k))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
_random = randomSource ?? SystemRandomSource.Default;
this.a = a;
@ -197,7 +196,7 @@ namespace MathNet.Numerics.Distributions
{
if (!IsValidParameterSet(a, c, k))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SampleUnchecked(rnd, a, c, k);
}
@ -214,7 +213,7 @@ namespace MathNet.Numerics.Distributions
{
if (!IsValidParameterSet(a, c, k))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
SamplesUnchecked(rnd, values, a, c, k);
}
@ -231,7 +230,7 @@ namespace MathNet.Numerics.Distributions
{
if (!IsValidParameterSet(a, c, k))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SamplesUnchecked(rnd, a, c, k);
}
@ -277,7 +276,7 @@ namespace MathNet.Numerics.Distributions
{
if (n > k * c)
{
throw new ArgumentException(Resources.ArgumentParameterSetInvalid);
throw new ArgumentException("The chosen parameter set is invalid (probably some value is out of range).");
}
var lambda_n = (n / c) * SpecialFunctions.Gamma(n / c) * SpecialFunctions.Gamma(k - n / c);
return Math.Pow(a, n) * lambda_n / SpecialFunctions.Gamma(k);
@ -329,7 +328,7 @@ namespace MathNet.Numerics.Distributions
{
if (!IsValidParameterSet(a, c, k))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return DensityImpl(a, c, k, x);
}
@ -347,7 +346,7 @@ namespace MathNet.Numerics.Distributions
{
if (!IsValidParameterSet(a, c, k))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return DensityLnImpl(a, c, k, x);
}
@ -365,7 +364,7 @@ namespace MathNet.Numerics.Distributions
{
if (!IsValidParameterSet(a, c, k))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return CumulativeDistributionImpl(a, c, k, x);
}

37
src/Numerics/Distributions/Categorical.cs

@ -30,7 +30,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using MathNet.Numerics.Properties;
using MathNet.Numerics.Random;
using MathNet.Numerics.Statistics;
using MathNet.Numerics.Threading;
@ -80,7 +79,7 @@ namespace MathNet.Numerics.Distributions
{
if (Control.CheckDistributionParameters && !IsValidProbabilityMass(probabilityMass))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
_random = randomSource ?? SystemRandomSource.Default;
@ -128,7 +127,7 @@ namespace MathNet.Numerics.Distributions
if (Control.CheckDistributionParameters && !IsValidProbabilityMass(p))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
// Extract unnormalized cumulative distribution
@ -389,7 +388,7 @@ namespace MathNet.Numerics.Distributions
{
if (Control.CheckDistributionParameters && !IsValidProbabilityMass(probabilityMass))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
if (k < 0)
@ -429,7 +428,7 @@ namespace MathNet.Numerics.Distributions
{
if (Control.CheckDistributionParameters && !IsValidProbabilityMass(probabilityMass))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
if (x < 0.0)
@ -458,7 +457,7 @@ namespace MathNet.Numerics.Distributions
{
if (Control.CheckDistributionParameters && !IsValidProbabilityMass(probabilityMass))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
if (probability < 0.0 || probability > 1.0 || double.IsNaN(probability))
@ -488,7 +487,7 @@ namespace MathNet.Numerics.Distributions
{
if (Control.CheckDistributionParameters && !IsValidCumulativeDistribution(cdfUnnormalized))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
if (probability < 0.0 || probability > 1.0 || double.IsNaN(probability))
@ -629,7 +628,7 @@ namespace MathNet.Numerics.Distributions
{
if (Control.CheckDistributionParameters && !IsValidProbabilityMass(probabilityMass))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
var cdf = ProbabilityMassToCumulativeDistribution(probabilityMass);
@ -646,7 +645,7 @@ namespace MathNet.Numerics.Distributions
{
if (Control.CheckDistributionParameters && !IsValidProbabilityMass(probabilityMass))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
var cdf = ProbabilityMassToCumulativeDistribution(probabilityMass);
@ -664,7 +663,7 @@ namespace MathNet.Numerics.Distributions
{
if (Control.CheckDistributionParameters && !IsValidProbabilityMass(probabilityMass))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
var cdf = ProbabilityMassToCumulativeDistribution(probabilityMass);
@ -680,7 +679,7 @@ namespace MathNet.Numerics.Distributions
{
if (Control.CheckDistributionParameters && !IsValidProbabilityMass(probabilityMass))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
var cdf = ProbabilityMassToCumulativeDistribution(probabilityMass);
@ -696,7 +695,7 @@ namespace MathNet.Numerics.Distributions
{
if (Control.CheckDistributionParameters && !IsValidProbabilityMass(probabilityMass))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
var cdf = ProbabilityMassToCumulativeDistribution(probabilityMass);
@ -713,7 +712,7 @@ namespace MathNet.Numerics.Distributions
{
if (Control.CheckDistributionParameters && !IsValidProbabilityMass(probabilityMass))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
var cdf = ProbabilityMassToCumulativeDistribution(probabilityMass);
@ -730,7 +729,7 @@ namespace MathNet.Numerics.Distributions
{
if (Control.CheckDistributionParameters && !IsValidCumulativeDistribution(cdfUnnormalized))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SampleUnchecked(rnd, cdfUnnormalized);
@ -746,7 +745,7 @@ namespace MathNet.Numerics.Distributions
{
if (Control.CheckDistributionParameters && !IsValidCumulativeDistribution(cdfUnnormalized))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SamplesUnchecked(rnd, cdfUnnormalized);
@ -763,7 +762,7 @@ namespace MathNet.Numerics.Distributions
{
if (Control.CheckDistributionParameters && !IsValidCumulativeDistribution(cdfUnnormalized))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
SamplesUnchecked(rnd, values, cdfUnnormalized);
@ -778,7 +777,7 @@ namespace MathNet.Numerics.Distributions
{
if (Control.CheckDistributionParameters && !IsValidCumulativeDistribution(cdfUnnormalized))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SampleUnchecked(SystemRandomSource.Default, cdfUnnormalized);
@ -793,7 +792,7 @@ namespace MathNet.Numerics.Distributions
{
if (Control.CheckDistributionParameters && !IsValidCumulativeDistribution(cdfUnnormalized))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SamplesUnchecked(SystemRandomSource.Default, cdfUnnormalized);
@ -809,7 +808,7 @@ namespace MathNet.Numerics.Distributions
{
if (Control.CheckDistributionParameters && !IsValidCumulativeDistribution(cdfUnnormalized))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
SamplesUnchecked(SystemRandomSource.Default, values, cdfUnnormalized);

25
src/Numerics/Distributions/Cauchy.cs

@ -29,7 +29,6 @@
using System;
using System.Collections.Generic;
using MathNet.Numerics.Properties;
using MathNet.Numerics.Random;
using MathNet.Numerics.Threading;
@ -63,7 +62,7 @@ namespace MathNet.Numerics.Distributions
{
if (!IsValidParameterSet(location, scale))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
_random = SystemRandomSource.Default;
@ -81,7 +80,7 @@ namespace MathNet.Numerics.Distributions
{
if (!IsValidParameterSet(location, scale))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
_random = randomSource ?? SystemRandomSource.Default;
@ -281,7 +280,7 @@ namespace MathNet.Numerics.Distributions
{
if (scale <= 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return 1.0/(Constants.Pi*scale*(1.0 + (((x - location)/scale)*((x - location)/scale))));
@ -299,7 +298,7 @@ namespace MathNet.Numerics.Distributions
{
if (scale <= 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return -Math.Log(Constants.Pi*scale*(1.0 + (((x - location)/scale)*((x - location)/scale))));
@ -317,7 +316,7 @@ namespace MathNet.Numerics.Distributions
{
if (scale <= 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return Math.Atan((x - location)/scale)/Constants.Pi + 0.5;
@ -336,7 +335,7 @@ namespace MathNet.Numerics.Distributions
{
if (scale <= 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return p <= 0.0 ? double.NegativeInfinity : p >= 1.0 ? double.PositiveInfinity
@ -354,7 +353,7 @@ namespace MathNet.Numerics.Distributions
{
if (scale <= 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SampleUnchecked(rnd, location, scale);
@ -371,7 +370,7 @@ namespace MathNet.Numerics.Distributions
{
if (scale <= 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SamplesUnchecked(rnd, location, scale);
@ -389,7 +388,7 @@ namespace MathNet.Numerics.Distributions
{
if (scale <= 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
SamplesUnchecked(rnd, values, location, scale);
@ -405,7 +404,7 @@ namespace MathNet.Numerics.Distributions
{
if (scale <= 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SampleUnchecked(SystemRandomSource.Default, location, scale);
@ -421,7 +420,7 @@ namespace MathNet.Numerics.Distributions
{
if (scale <= 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SamplesUnchecked(SystemRandomSource.Default, location, scale);
@ -438,7 +437,7 @@ namespace MathNet.Numerics.Distributions
{
if (scale <= 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
SamplesUnchecked(SystemRandomSource.Default, values, location, scale);

23
src/Numerics/Distributions/Chi.cs

@ -29,7 +29,6 @@
using System;
using System.Collections.Generic;
using MathNet.Numerics.Properties;
using MathNet.Numerics.Random;
using MathNet.Numerics.Threading;
@ -56,7 +55,7 @@ namespace MathNet.Numerics.Distributions
{
if (!IsValidParameterSet(freedom))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
_random = SystemRandomSource.Default;
@ -72,7 +71,7 @@ namespace MathNet.Numerics.Distributions
{
if (!IsValidParameterSet(freedom))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
_random = randomSource ?? SystemRandomSource.Default;
@ -289,7 +288,7 @@ namespace MathNet.Numerics.Distributions
{
if (freedom <= 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
if (double.IsPositiveInfinity(freedom) || double.IsPositiveInfinity(x) || x == 0.0)
@ -316,7 +315,7 @@ namespace MathNet.Numerics.Distributions
{
if (freedom <= 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
if (double.IsPositiveInfinity(freedom) || double.IsPositiveInfinity(x) || x == 0.0)
@ -338,7 +337,7 @@ namespace MathNet.Numerics.Distributions
{
if (freedom <= 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
if (double.IsPositiveInfinity(x))
@ -364,7 +363,7 @@ namespace MathNet.Numerics.Distributions
{
if (freedom <= 0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SampleUnchecked(rnd, freedom);
@ -380,7 +379,7 @@ namespace MathNet.Numerics.Distributions
{
if (freedom <= 0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SamplesUnchecked(rnd, freedom);
@ -397,7 +396,7 @@ namespace MathNet.Numerics.Distributions
{
if (freedom <= 0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
SamplesUnchecked(rnd, values, freedom);
@ -412,7 +411,7 @@ namespace MathNet.Numerics.Distributions
{
if (freedom <= 0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SampleUnchecked(SystemRandomSource.Default, freedom);
@ -427,7 +426,7 @@ namespace MathNet.Numerics.Distributions
{
if (freedom <= 0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SamplesUnchecked(SystemRandomSource.Default, freedom);
@ -443,7 +442,7 @@ namespace MathNet.Numerics.Distributions
{
if (freedom <= 0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
SamplesUnchecked(SystemRandomSource.Default, values, freedom);

25
src/Numerics/Distributions/ChiSquared.cs

@ -29,7 +29,6 @@
using System;
using System.Collections.Generic;
using MathNet.Numerics.Properties;
using MathNet.Numerics.Random;
using MathNet.Numerics.Threading;
@ -54,7 +53,7 @@ namespace MathNet.Numerics.Distributions
{
if (!IsValidParameterSet(freedom))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
_random = SystemRandomSource.Default;
@ -70,7 +69,7 @@ namespace MathNet.Numerics.Distributions
{
if (!IsValidParameterSet(freedom))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
_random = randomSource ?? SystemRandomSource.Default;
@ -300,7 +299,7 @@ namespace MathNet.Numerics.Distributions
{
if (freedom <= 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
if (double.IsPositiveInfinity(freedom) || double.IsPositiveInfinity(x) || x == 0.0)
@ -327,7 +326,7 @@ namespace MathNet.Numerics.Distributions
{
if (freedom <= 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
if (double.IsPositiveInfinity(freedom) || double.IsPositiveInfinity(x) || x == 0.0)
@ -349,7 +348,7 @@ namespace MathNet.Numerics.Distributions
{
if (freedom <= 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
if (double.IsPositiveInfinity(x))
@ -376,7 +375,7 @@ namespace MathNet.Numerics.Distributions
{
if(!IsValidParameterSet(freedom))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SpecialFunctions.GammaLowerRegularizedInv(freedom / 2.0, p) / 0.5;
@ -392,7 +391,7 @@ namespace MathNet.Numerics.Distributions
{
if (freedom <= 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SampleUnchecked(rnd, freedom);
@ -408,7 +407,7 @@ namespace MathNet.Numerics.Distributions
{
if (freedom <= 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SamplesUnchecked(rnd, freedom);
@ -425,7 +424,7 @@ namespace MathNet.Numerics.Distributions
{
if (freedom <= 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
SamplesUnchecked(rnd, values, freedom);
@ -440,7 +439,7 @@ namespace MathNet.Numerics.Distributions
{
if (freedom <= 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SampleUnchecked(SystemRandomSource.Default, freedom);
@ -455,7 +454,7 @@ namespace MathNet.Numerics.Distributions
{
if (freedom <= 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SamplesUnchecked(SystemRandomSource.Default, freedom);
@ -471,7 +470,7 @@ namespace MathNet.Numerics.Distributions
{
if (freedom <= 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
SamplesUnchecked(SystemRandomSource.Default, values, freedom);

25
src/Numerics/Distributions/ContinuousUniform.cs

@ -29,7 +29,6 @@
using System;
using System.Collections.Generic;
using MathNet.Numerics.Properties;
using MathNet.Numerics.Random;
using MathNet.Numerics.Threading;
@ -64,7 +63,7 @@ namespace MathNet.Numerics.Distributions
{
if (!IsValidParameterSet(lower, upper))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
_random = SystemRandomSource.Default;
@ -83,7 +82,7 @@ namespace MathNet.Numerics.Distributions
{
if (!IsValidParameterSet(lower, upper))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
_random = randomSource ?? SystemRandomSource.Default;
@ -287,7 +286,7 @@ namespace MathNet.Numerics.Distributions
{
if (upper < lower)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return x < lower || x > upper ? 0.0 : 1.0/(upper - lower);
@ -305,7 +304,7 @@ namespace MathNet.Numerics.Distributions
{
if (upper < lower)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return x < lower || x > upper ? double.NegativeInfinity : -Math.Log(upper - lower);
@ -323,7 +322,7 @@ namespace MathNet.Numerics.Distributions
{
if (upper < lower)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return x <= lower ? 0.0 : x >= upper ? 1.0 : (x - lower)/(upper - lower);
@ -342,7 +341,7 @@ namespace MathNet.Numerics.Distributions
{
if (upper < lower)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return p <= 0.0 ? lower : p >= 1.0 ? upper : lower*(1.0 - p) + upper*p;
@ -359,7 +358,7 @@ namespace MathNet.Numerics.Distributions
{
if (upper < lower)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SampleUnchecked(rnd, lower, upper);
@ -376,7 +375,7 @@ namespace MathNet.Numerics.Distributions
{
if (upper < lower)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SamplesUnchecked(rnd, lower, upper);
@ -394,7 +393,7 @@ namespace MathNet.Numerics.Distributions
{
if (upper < lower)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
SamplesUnchecked(rnd, values, lower, upper);
@ -410,7 +409,7 @@ namespace MathNet.Numerics.Distributions
{
if (upper < lower)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SampleUnchecked(SystemRandomSource.Default, lower, upper);
@ -426,7 +425,7 @@ namespace MathNet.Numerics.Distributions
{
if (upper < lower)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SamplesUnchecked(SystemRandomSource.Default, lower, upper);
@ -443,7 +442,7 @@ namespace MathNet.Numerics.Distributions
{
if (upper < lower)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
SamplesUnchecked(SystemRandomSource.Default, values, lower, upper);

23
src/Numerics/Distributions/ConwayMaxwellPoisson.cs

@ -29,7 +29,6 @@
using System;
using System.Collections.Generic;
using MathNet.Numerics.Properties;
using MathNet.Numerics.Random;
using MathNet.Numerics.Threading;
@ -84,7 +83,7 @@ namespace MathNet.Numerics.Distributions
{
if (!IsValidParameterSet(lambda, nu))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
_random = SystemRandomSource.Default;
@ -102,7 +101,7 @@ namespace MathNet.Numerics.Distributions
{
if (!IsValidParameterSet(lambda, nu))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
_random = randomSource ?? SystemRandomSource.Default;
@ -354,7 +353,7 @@ namespace MathNet.Numerics.Distributions
{
if (!(lambda > 0.0 && nu >= 0.0))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
var z = Normalization(lambda, nu);
@ -372,7 +371,7 @@ namespace MathNet.Numerics.Distributions
{
if (!(lambda > 0.0 && nu >= 0.0))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
var z = Normalization(lambda, nu);
@ -391,7 +390,7 @@ namespace MathNet.Numerics.Distributions
{
if (!(lambda > 0.0 && nu >= 0.0))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
var z = Normalization(lambda, nu);
@ -558,7 +557,7 @@ namespace MathNet.Numerics.Distributions
{
if (!(lambda > 0.0 && nu >= 0.0))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
var z = Normalization(lambda, nu);
@ -575,7 +574,7 @@ namespace MathNet.Numerics.Distributions
{
if (!(lambda > 0.0 && nu >= 0.0))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
var z = Normalization(lambda, nu);
@ -593,7 +592,7 @@ namespace MathNet.Numerics.Distributions
{
if (!(lambda > 0.0 && nu >= 0.0))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
var z = Normalization(lambda, nu);
@ -609,7 +608,7 @@ namespace MathNet.Numerics.Distributions
{
if (!(lambda > 0.0 && nu >= 0.0))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
var z = Normalization(lambda, nu);
@ -625,7 +624,7 @@ namespace MathNet.Numerics.Distributions
{
if (!(lambda > 0.0 && nu >= 0.0))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
var z = Normalization(lambda, nu);
@ -642,7 +641,7 @@ namespace MathNet.Numerics.Distributions
{
if (!(lambda > 0.0 && nu >= 0.0))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
var z = Normalization(lambda, nu);

11
src/Numerics/Distributions/Dirichlet.cs

@ -29,7 +29,6 @@
using System;
using System.Linq;
using MathNet.Numerics.Properties;
using MathNet.Numerics.Random;
namespace MathNet.Numerics.Distributions
@ -53,7 +52,7 @@ namespace MathNet.Numerics.Distributions
{
if (Control.CheckDistributionParameters && !IsValidParameterSet(alpha))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
_random = SystemRandomSource.Default;
@ -70,7 +69,7 @@ namespace MathNet.Numerics.Distributions
{
if (Control.CheckDistributionParameters && !IsValidParameterSet(alpha))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
_random = randomSource ?? SystemRandomSource.Default;
@ -94,7 +93,7 @@ namespace MathNet.Numerics.Distributions
_random = SystemRandomSource.Default;
if (Control.CheckDistributionParameters && !IsValidParameterSet(parm))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
_alpha = (double[])parm.Clone();
@ -118,7 +117,7 @@ namespace MathNet.Numerics.Distributions
_random = randomSource ?? SystemRandomSource.Default;
if (Control.CheckDistributionParameters && !IsValidParameterSet(parm))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
_alpha = (double[])parm.Clone();
@ -317,7 +316,7 @@ namespace MathNet.Numerics.Distributions
{
if (Control.CheckDistributionParameters && !IsValidParameterSet(alpha))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
var n = alpha.Length;

23
src/Numerics/Distributions/DiscreteUniform.cs

@ -29,7 +29,6 @@
using System;
using System.Collections.Generic;
using MathNet.Numerics.Properties;
using MathNet.Numerics.Random;
namespace MathNet.Numerics.Distributions
@ -56,7 +55,7 @@ namespace MathNet.Numerics.Distributions
{
if (!IsValidParameterSet(lower, upper))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
_random = SystemRandomSource.Default;
@ -74,7 +73,7 @@ namespace MathNet.Numerics.Distributions
{
if (!IsValidParameterSet(lower, upper))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
_random = randomSource ?? SystemRandomSource.Default;
@ -208,7 +207,7 @@ namespace MathNet.Numerics.Distributions
{
if (!(lower <= upper))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return k >= lower && k <= upper ? 1.0/(upper - lower + 1) : 0.0;
@ -225,7 +224,7 @@ namespace MathNet.Numerics.Distributions
{
if (!(lower <= upper))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return k >= lower && k <= upper ? -Math.Log(upper - lower + 1) : double.NegativeInfinity;
@ -243,7 +242,7 @@ namespace MathNet.Numerics.Distributions
{
if (!(lower <= upper))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
if (x < lower)
@ -318,7 +317,7 @@ namespace MathNet.Numerics.Distributions
{
if (!(lower <= upper))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SampleUnchecked(rnd, lower, upper);
@ -335,7 +334,7 @@ namespace MathNet.Numerics.Distributions
{
if (!(lower <= upper))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SamplesUnchecked(rnd, lower, upper);
@ -353,7 +352,7 @@ namespace MathNet.Numerics.Distributions
{
if (!(lower <= upper))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
SamplesUnchecked(rnd, values, lower, upper);
@ -369,7 +368,7 @@ namespace MathNet.Numerics.Distributions
{
if (!(lower <= upper))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SampleUnchecked(SystemRandomSource.Default, lower, upper);
@ -385,7 +384,7 @@ namespace MathNet.Numerics.Distributions
{
if (!(lower <= upper))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SamplesUnchecked(SystemRandomSource.Default, lower, upper);
@ -402,7 +401,7 @@ namespace MathNet.Numerics.Distributions
{
if (!(lower <= upper))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
SamplesUnchecked(SystemRandomSource.Default, values, lower, upper);

11
src/Numerics/Distributions/Erlang.cs

@ -29,7 +29,6 @@
using System;
using System.Collections.Generic;
using MathNet.Numerics.Properties;
using MathNet.Numerics.Random;
namespace MathNet.Numerics.Distributions
@ -56,7 +55,7 @@ namespace MathNet.Numerics.Distributions
{
if (!IsValidParameterSet(shape, rate))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
_random = SystemRandomSource.Default;
@ -74,7 +73,7 @@ namespace MathNet.Numerics.Distributions
{
if (!IsValidParameterSet(shape, rate))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
_random = randomSource ?? SystemRandomSource.Default;
@ -369,7 +368,7 @@ namespace MathNet.Numerics.Distributions
{
if (shape < 0.0 || rate < 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
if (double.IsPositiveInfinity(rate))
@ -407,7 +406,7 @@ namespace MathNet.Numerics.Distributions
{
if (shape < 0.0 || rate < 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
if (double.IsPositiveInfinity(rate))
@ -440,7 +439,7 @@ namespace MathNet.Numerics.Distributions
{
if (shape < 0.0 || rate < 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
if (double.IsPositiveInfinity(rate))

25
src/Numerics/Distributions/Exponential.cs

@ -30,7 +30,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using MathNet.Numerics.Properties;
using MathNet.Numerics.Random;
using MathNet.Numerics.Threading;
@ -55,7 +54,7 @@ namespace MathNet.Numerics.Distributions
{
if (!IsValidParameterSet(rate))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
_random = SystemRandomSource.Default;
@ -71,7 +70,7 @@ namespace MathNet.Numerics.Distributions
{
if (!IsValidParameterSet(rate))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
_random = randomSource ?? SystemRandomSource.Default;
@ -272,7 +271,7 @@ namespace MathNet.Numerics.Distributions
{
if (rate < 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return x < 0.0 ? 0.0 : rate*Math.Exp(-rate*x);
@ -289,7 +288,7 @@ namespace MathNet.Numerics.Distributions
{
if (rate < 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return Math.Log(rate) - (rate*x);
@ -306,7 +305,7 @@ namespace MathNet.Numerics.Distributions
{
if (rate < 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return x < 0.0 ? 0.0 : 1.0 - Math.Exp(-rate*x);
@ -324,7 +323,7 @@ namespace MathNet.Numerics.Distributions
{
if (rate < 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return p >= 1.0 ? double.PositiveInfinity : -Math.Log(1 - p)/rate;
@ -340,7 +339,7 @@ namespace MathNet.Numerics.Distributions
{
if (rate < 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SampleUnchecked(rnd, rate);
@ -357,7 +356,7 @@ namespace MathNet.Numerics.Distributions
{
if (rate < 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
SamplesUnchecked(rnd, values, rate);
@ -373,7 +372,7 @@ namespace MathNet.Numerics.Distributions
{
if (rate < 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SamplesUnchecked(rnd, rate);
@ -388,7 +387,7 @@ namespace MathNet.Numerics.Distributions
{
if (rate < 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SampleUnchecked(SystemRandomSource.Default, rate);
@ -404,7 +403,7 @@ namespace MathNet.Numerics.Distributions
{
if (rate < 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
SamplesUnchecked(SystemRandomSource.Default, values, rate);
@ -419,7 +418,7 @@ namespace MathNet.Numerics.Distributions
{
if (rate < 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SamplesUnchecked(SystemRandomSource.Default, rate);

23
src/Numerics/Distributions/FisherSnedecor.cs

@ -29,7 +29,6 @@
using System;
using System.Collections.Generic;
using MathNet.Numerics.Properties;
using MathNet.Numerics.Random;
using MathNet.Numerics.RootFinding;
using MathNet.Numerics.Threading;
@ -57,7 +56,7 @@ namespace MathNet.Numerics.Distributions
{
if (!IsValidParameterSet(d1, d2))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
_random = SystemRandomSource.Default;
@ -75,7 +74,7 @@ namespace MathNet.Numerics.Distributions
{
if (!IsValidParameterSet(d1, d2))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
_random = randomSource ?? SystemRandomSource.Default;
@ -328,7 +327,7 @@ namespace MathNet.Numerics.Distributions
{
if (d1 <= 0.0 || d2 <= 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return Math.Sqrt(Math.Pow(d1*x, d1)*Math.Pow(d2, d2)/Math.Pow((d1*x) + d2, d1 + d2))/(x*SpecialFunctions.Beta(d1/2.0, d2/2.0));
@ -359,7 +358,7 @@ namespace MathNet.Numerics.Distributions
{
if (d1 <= 0.0 || d2 <= 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SpecialFunctions.BetaRegularized(d1/2.0, d2/2.0, d1*x/(d1*x + d2));
@ -379,7 +378,7 @@ namespace MathNet.Numerics.Distributions
{
if (d1 <= 0.0 || d2 <= 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return Brent.FindRoot(
@ -398,7 +397,7 @@ namespace MathNet.Numerics.Distributions
{
if (d1 <= 0.0 || d2 <= 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SampleUnchecked(rnd, d1, d2);
@ -415,7 +414,7 @@ namespace MathNet.Numerics.Distributions
{
if (d1 <= 0.0 || d2 <= 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SamplesUnchecked(rnd, d1, d2);
@ -433,7 +432,7 @@ namespace MathNet.Numerics.Distributions
{
if (d1 <= 0.0 || d2 <= 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
SamplesUnchecked(rnd, values, d1, d2);
@ -449,7 +448,7 @@ namespace MathNet.Numerics.Distributions
{
if (d1 <= 0.0 || d2 <= 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SampleUnchecked(SystemRandomSource.Default, d1, d2);
@ -465,7 +464,7 @@ namespace MathNet.Numerics.Distributions
{
if (d1 <= 0.0 || d2 <= 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SamplesUnchecked(SystemRandomSource.Default, d1, d2);
@ -482,7 +481,7 @@ namespace MathNet.Numerics.Distributions
{
if (d1 <= 0.0 || d2 <= 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
SamplesUnchecked(SystemRandomSource.Default, values, d1, d2);

25
src/Numerics/Distributions/Gamma.cs

@ -29,7 +29,6 @@
using System;
using System.Collections.Generic;
using MathNet.Numerics.Properties;
using MathNet.Numerics.Random;
namespace MathNet.Numerics.Distributions
@ -65,7 +64,7 @@ namespace MathNet.Numerics.Distributions
{
if (!IsValidParameterSet(shape, rate))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
_random = SystemRandomSource.Default;
@ -83,7 +82,7 @@ namespace MathNet.Numerics.Distributions
{
if (!IsValidParameterSet(shape, rate))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
_random = randomSource ?? SystemRandomSource.Default;
@ -452,7 +451,7 @@ namespace MathNet.Numerics.Distributions
{
if (shape < 0.0 || rate < 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
if (double.IsPositiveInfinity(rate))
@ -490,7 +489,7 @@ namespace MathNet.Numerics.Distributions
{
if (shape < 0.0 || rate < 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
if (double.IsPositiveInfinity(rate))
@ -523,7 +522,7 @@ namespace MathNet.Numerics.Distributions
{
if (shape < 0.0 || rate < 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
if (double.IsPositiveInfinity(rate))
@ -552,7 +551,7 @@ namespace MathNet.Numerics.Distributions
{
if (shape < 0.0 || rate < 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SpecialFunctions.GammaLowerRegularizedInv(shape, p)/rate;
@ -569,7 +568,7 @@ namespace MathNet.Numerics.Distributions
{
if (shape < 0.0 || rate < 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SampleUnchecked(rnd, shape, rate);
@ -586,7 +585,7 @@ namespace MathNet.Numerics.Distributions
{
if (shape < 0.0 || rate < 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SamplesUnchecked(rnd, shape, rate);
@ -604,7 +603,7 @@ namespace MathNet.Numerics.Distributions
{
if (shape < 0.0 || rate < 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
SamplesUnchecked(rnd, values, shape, rate);
@ -620,7 +619,7 @@ namespace MathNet.Numerics.Distributions
{
if (shape < 0.0 || rate < 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SampleUnchecked(SystemRandomSource.Default, shape, rate);
@ -636,7 +635,7 @@ namespace MathNet.Numerics.Distributions
{
if (shape < 0.0 || rate < 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SamplesUnchecked(SystemRandomSource.Default, shape, rate);
@ -653,7 +652,7 @@ namespace MathNet.Numerics.Distributions
{
if (shape < 0.0 || rate < 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
SamplesUnchecked(SystemRandomSource.Default, values, shape, rate);

23
src/Numerics/Distributions/Geometric.cs

@ -30,7 +30,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using MathNet.Numerics.Properties;
using MathNet.Numerics.Random;
using MathNet.Numerics.Threading;
@ -56,7 +55,7 @@ namespace MathNet.Numerics.Distributions
{
if (!IsValidParameterSet(p))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
_random = SystemRandomSource.Default;
@ -72,7 +71,7 @@ namespace MathNet.Numerics.Distributions
{
if (!IsValidParameterSet(p))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
_random = randomSource ?? SystemRandomSource.Default;
@ -207,7 +206,7 @@ namespace MathNet.Numerics.Distributions
{
if (!(p >= 0.0 && p <= 1.0))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
if (k <= 0)
@ -228,7 +227,7 @@ namespace MathNet.Numerics.Distributions
{
if (!(p >= 0.0 && p <= 1.0))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
if (k <= 0)
@ -250,7 +249,7 @@ namespace MathNet.Numerics.Distributions
{
if (!(p >= 0.0 && p <= 1.0))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return 1.0 - Math.Pow(1.0 - p, x);
@ -338,7 +337,7 @@ namespace MathNet.Numerics.Distributions
{
if (!(p >= 0.0 && p <= 1.0))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SampleUnchecked(rnd, p);
@ -353,7 +352,7 @@ namespace MathNet.Numerics.Distributions
{
if (!(p >= 0.0 && p <= 1.0))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SamplesUnchecked(rnd, p);
@ -369,7 +368,7 @@ namespace MathNet.Numerics.Distributions
{
if (!(p >= 0.0 && p <= 1.0))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
SamplesUnchecked(rnd, values, p);
@ -383,7 +382,7 @@ namespace MathNet.Numerics.Distributions
{
if (!(p >= 0.0 && p <= 1.0))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SampleUnchecked(SystemRandomSource.Default, p);
@ -397,7 +396,7 @@ namespace MathNet.Numerics.Distributions
{
if (!(p >= 0.0 && p <= 1.0))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SamplesUnchecked(SystemRandomSource.Default, p);
@ -412,7 +411,7 @@ namespace MathNet.Numerics.Distributions
{
if (!(p >= 0.0 && p <= 1.0))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
SamplesUnchecked(SystemRandomSource.Default, values, p);

23
src/Numerics/Distributions/Hypergeometric.cs

@ -29,7 +29,6 @@
using System;
using System.Collections.Generic;
using MathNet.Numerics.Properties;
using MathNet.Numerics.Random;
namespace MathNet.Numerics.Distributions
@ -59,7 +58,7 @@ namespace MathNet.Numerics.Distributions
{
if (!IsValidParameterSet(population, success, draws))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
_random = SystemRandomSource.Default;
@ -79,7 +78,7 @@ namespace MathNet.Numerics.Distributions
{
if (!IsValidParameterSet(population, success, draws))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
_random = randomSource ?? SystemRandomSource.Default;
@ -221,7 +220,7 @@ namespace MathNet.Numerics.Distributions
{
if (!(population >= 0 && success >= 0 && draws >= 0 && success <= population && draws <= population))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SpecialFunctions.Binomial(success, k)*SpecialFunctions.Binomial(population - success, draws - k)/SpecialFunctions.Binomial(population, draws);
@ -239,7 +238,7 @@ namespace MathNet.Numerics.Distributions
{
if (!(population >= 0 && success >= 0 && draws >= 0 && success <= population && draws <= population))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SpecialFunctions.BinomialLn(success, k) + SpecialFunctions.BinomialLn(population - success, draws - k) - SpecialFunctions.BinomialLn(population, draws);
@ -258,7 +257,7 @@ namespace MathNet.Numerics.Distributions
{
if (!(population >= 0 && success >= 0 && draws >= 0 && success <= population && draws <= population))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
if (x < Math.Max(0, draws + success - population))
@ -365,7 +364,7 @@ namespace MathNet.Numerics.Distributions
{
if (!(population >= 0 && success >= 0 && draws >= 0 && success <= population && draws <= population))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SampleUnchecked(rnd, population, success, draws);
@ -382,7 +381,7 @@ namespace MathNet.Numerics.Distributions
{
if (!(population >= 0 && success >= 0 && draws >= 0 && success <= population && draws <= population))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SamplesUnchecked(rnd, population, success, draws);
@ -400,7 +399,7 @@ namespace MathNet.Numerics.Distributions
{
if (!(population >= 0 && success >= 0 && draws >= 0 && success <= population && draws <= population))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
SamplesUnchecked(rnd, values, population, success, draws);
@ -416,7 +415,7 @@ namespace MathNet.Numerics.Distributions
{
if (!(population >= 0 && success >= 0 && draws >= 0 && success <= population && draws <= population))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SampleUnchecked(SystemRandomSource.Default, population, success, draws);
@ -432,7 +431,7 @@ namespace MathNet.Numerics.Distributions
{
if (!(population >= 0 && success >= 0 && draws >= 0 && success <= population && draws <= population))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SamplesUnchecked(SystemRandomSource.Default, population, success, draws);
@ -449,7 +448,7 @@ namespace MathNet.Numerics.Distributions
{
if (!(population >= 0 && success >= 0 && draws >= 0 && success <= population && draws <= population))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
SamplesUnchecked(SystemRandomSource.Default, values, population, success, draws);

21
src/Numerics/Distributions/InverseGamma.cs

@ -30,7 +30,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using MathNet.Numerics.Properties;
using MathNet.Numerics.Random;
using MathNet.Numerics.Threading;
@ -58,7 +57,7 @@ namespace MathNet.Numerics.Distributions
{
if (!IsValidParameterSet(shape, scale))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
_random = SystemRandomSource.Default;
@ -76,7 +75,7 @@ namespace MathNet.Numerics.Distributions
{
if (!IsValidParameterSet(shape, scale))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
_random = randomSource ?? SystemRandomSource.Default;
@ -294,7 +293,7 @@ namespace MathNet.Numerics.Distributions
{
if (shape <= 0.0 || scale <= 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return x < 0.0 ? 0.0 : Math.Pow(scale, shape)*Math.Pow(x, -shape - 1.0)*Math.Exp(-scale/x)/SpecialFunctions.Gamma(shape);
@ -325,7 +324,7 @@ namespace MathNet.Numerics.Distributions
{
if (shape <= 0.0 || scale <= 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SpecialFunctions.GammaUpperRegularized(shape, scale/x);
@ -342,7 +341,7 @@ namespace MathNet.Numerics.Distributions
{
if (shape <= 0.0 || scale <= 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SampleUnchecked(rnd, shape, scale);
@ -359,7 +358,7 @@ namespace MathNet.Numerics.Distributions
{
if (shape <= 0.0 || scale <= 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SamplesUnchecked(rnd, shape, scale);
@ -377,7 +376,7 @@ namespace MathNet.Numerics.Distributions
{
if (shape <= 0.0 || scale <= 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
SamplesUnchecked(rnd, values, shape, scale);
@ -393,7 +392,7 @@ namespace MathNet.Numerics.Distributions
{
if (shape <= 0.0 || scale <= 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SampleUnchecked(SystemRandomSource.Default, shape, scale);
@ -409,7 +408,7 @@ namespace MathNet.Numerics.Distributions
{
if (shape <= 0.0 || scale <= 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SamplesUnchecked(SystemRandomSource.Default, shape, scale);
@ -426,7 +425,7 @@ namespace MathNet.Numerics.Distributions
{
if (shape <= 0.0 || scale <= 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
SamplesUnchecked(SystemRandomSource.Default, values, shape, scale);

19
src/Numerics/Distributions/InverseGaussian.cs

@ -27,7 +27,6 @@
// OTHER DEALINGS IN THE SOFTWARE.
// </copyright>
using MathNet.Numerics.Properties;
using MathNet.Numerics.Random;
using MathNet.Numerics.Statistics;
using System;
@ -60,7 +59,7 @@ namespace MathNet.Numerics.Distributions
{
if (!IsValidParameterSet(mu, lambda))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
_random = randomSource ?? SystemRandomSource.Default;
Mu = mu;
@ -185,7 +184,7 @@ namespace MathNet.Numerics.Distributions
{
if (!IsValidParameterSet(mu, lambda))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SampleUnchecked(rnd, mu, lambda);
}
@ -201,7 +200,7 @@ namespace MathNet.Numerics.Distributions
{
if (!IsValidParameterSet(mu, lambda))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
SamplesUnchecked(rnd, values, mu, lambda);
}
@ -217,7 +216,7 @@ namespace MathNet.Numerics.Distributions
{
if (!IsValidParameterSet(mu, lambda))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SamplesUnchecked(rnd, mu, lambda);
}
@ -306,7 +305,7 @@ namespace MathNet.Numerics.Distributions
if (RootFinding.NewtonRaphson.TryFindRoot(equationToSolve, Density, Mode, 0, double.PositiveInfinity, 1e-8, 100, out double quantile))
return quantile;
else
throw new NonConvergenceException(Resources.NumericalEstimationFailed);
throw new NonConvergenceException("Numerical estimation of the statistic has failed. The used solver did not succeed in finding a root.");
}
/// <summary>
@ -321,7 +320,7 @@ namespace MathNet.Numerics.Distributions
{
if (!IsValidParameterSet(mu, lambda))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return DensityImpl(mu, lambda, x);
}
@ -338,7 +337,7 @@ namespace MathNet.Numerics.Distributions
{
if (!IsValidParameterSet(mu, lambda))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return DensityLnImpl(mu, lambda, x);
}
@ -355,7 +354,7 @@ namespace MathNet.Numerics.Distributions
{
if (!IsValidParameterSet(mu, lambda))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return CumulativeDistributionImpl(mu, lambda, x);
}
@ -372,7 +371,7 @@ namespace MathNet.Numerics.Distributions
{
if (!IsValidParameterSet(mu, lambda))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
var igDist = new InverseGaussian(mu, lambda);
return igDist.InvCDF(p);

9
src/Numerics/Distributions/InverseWishart.cs

@ -30,7 +30,6 @@
using System;
using MathNet.Numerics.LinearAlgebra;
using MathNet.Numerics.LinearAlgebra.Factorization;
using MathNet.Numerics.Properties;
using MathNet.Numerics.Random;
namespace MathNet.Numerics.Distributions
@ -62,7 +61,7 @@ namespace MathNet.Numerics.Distributions
{
if (Control.CheckDistributionParameters && !IsValidParameterSet(degreesOfFreedom, scale))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
_random = SystemRandomSource.Default;
@ -81,7 +80,7 @@ namespace MathNet.Numerics.Distributions
{
if (Control.CheckDistributionParameters && !IsValidParameterSet(degreesOfFreedom, scale))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
_random = randomSource ?? SystemRandomSource.Default;
@ -184,7 +183,7 @@ namespace MathNet.Numerics.Distributions
if (x.RowCount != p || x.ColumnCount != p)
{
throw new ArgumentOutOfRangeException(nameof(x), Resources.ArgumentMatrixDimensions);
throw new ArgumentOutOfRangeException(nameof(x), "Matrix dimensions must agree.");
}
var chol = x.Cholesky();
@ -227,7 +226,7 @@ namespace MathNet.Numerics.Distributions
{
if (Control.CheckDistributionParameters && !IsValidParameterSet(degreesOfFreedom, scale))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
var r = Wishart.Sample(rnd, degreesOfFreedom, scale.Inverse());

23
src/Numerics/Distributions/Laplace.cs

@ -29,7 +29,6 @@
using System;
using System.Collections.Generic;
using MathNet.Numerics.Properties;
using MathNet.Numerics.Random;
using MathNet.Numerics.Threading;
@ -67,7 +66,7 @@ namespace MathNet.Numerics.Distributions
{
if (!IsValidParameterSet(location, scale))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
_random = SystemRandomSource.Default;
@ -86,7 +85,7 @@ namespace MathNet.Numerics.Distributions
{
if (!IsValidParameterSet(location, scale))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
_random = randomSource ?? SystemRandomSource.Default;
@ -275,7 +274,7 @@ namespace MathNet.Numerics.Distributions
{
if (scale <= 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return Math.Exp(-Math.Abs(x - location)/scale)/(2.0*scale);
@ -293,7 +292,7 @@ namespace MathNet.Numerics.Distributions
{
if (scale <= 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return -Math.Abs(x - location)/scale - Math.Log(2.0*scale);
@ -311,7 +310,7 @@ namespace MathNet.Numerics.Distributions
{
if (scale <= 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return 0.5*(1.0 + (Math.Sign(x - location)*(1.0 - Math.Exp(-Math.Abs(x - location)/scale))));
@ -328,7 +327,7 @@ namespace MathNet.Numerics.Distributions
{
if (scale <= 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SampleUnchecked(rnd, location, scale);
@ -345,7 +344,7 @@ namespace MathNet.Numerics.Distributions
{
if (scale <= 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SamplesUnchecked(rnd, location, scale);
@ -363,7 +362,7 @@ namespace MathNet.Numerics.Distributions
{
if (scale <= 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
SamplesUnchecked(rnd, values, location, scale);
@ -379,7 +378,7 @@ namespace MathNet.Numerics.Distributions
{
if (scale <= 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SampleUnchecked(SystemRandomSource.Default, location, scale);
@ -395,7 +394,7 @@ namespace MathNet.Numerics.Distributions
{
if (scale <= 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SamplesUnchecked(SystemRandomSource.Default, location, scale);
@ -412,7 +411,7 @@ namespace MathNet.Numerics.Distributions
{
if (scale <= 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
SamplesUnchecked(SystemRandomSource.Default, values, location, scale);

25
src/Numerics/Distributions/LogNormal.cs

@ -30,7 +30,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using MathNet.Numerics.Properties;
using MathNet.Numerics.Random;
using MathNet.Numerics.Statistics;
using MathNet.Numerics.Threading;
@ -60,7 +59,7 @@ namespace MathNet.Numerics.Distributions
{
if (!IsValidParameterSet(mu, sigma))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
_random = SystemRandomSource.Default;
@ -80,7 +79,7 @@ namespace MathNet.Numerics.Distributions
{
if (!IsValidParameterSet(mu, sigma))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
_random = randomSource ?? SystemRandomSource.Default;
@ -350,7 +349,7 @@ namespace MathNet.Numerics.Distributions
{
if (sigma < 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
if (x < 0.0)
@ -374,7 +373,7 @@ namespace MathNet.Numerics.Distributions
{
if (sigma < 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
if (x < 0.0)
@ -399,7 +398,7 @@ namespace MathNet.Numerics.Distributions
{
if (sigma < 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return x < 0.0 ? 0.0
@ -420,7 +419,7 @@ namespace MathNet.Numerics.Distributions
{
if (sigma < 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return p <= 0.0 ? 0.0 : p >= 1.0 ? double.PositiveInfinity
@ -438,7 +437,7 @@ namespace MathNet.Numerics.Distributions
{
if (sigma < 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SampleUnchecked(rnd, mu, sigma);
@ -455,7 +454,7 @@ namespace MathNet.Numerics.Distributions
{
if (sigma < 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SamplesUnchecked(rnd, mu, sigma);
@ -473,7 +472,7 @@ namespace MathNet.Numerics.Distributions
{
if (sigma < 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
SamplesUnchecked(rnd, values, mu, sigma);
@ -489,7 +488,7 @@ namespace MathNet.Numerics.Distributions
{
if (sigma < 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SampleUnchecked(SystemRandomSource.Default, mu, sigma);
@ -505,7 +504,7 @@ namespace MathNet.Numerics.Distributions
{
if (sigma < 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SamplesUnchecked(SystemRandomSource.Default, mu, sigma);
@ -522,7 +521,7 @@ namespace MathNet.Numerics.Distributions
{
if (sigma < 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
SamplesUnchecked(SystemRandomSource.Default, values, mu, sigma);

7
src/Numerics/Distributions/MatrixNormal.cs

@ -30,7 +30,6 @@
using System;
using MathNet.Numerics.LinearAlgebra;
using MathNet.Numerics.LinearAlgebra.Double;
using MathNet.Numerics.Properties;
using MathNet.Numerics.Random;
namespace MathNet.Numerics.Distributions
@ -71,7 +70,7 @@ namespace MathNet.Numerics.Distributions
{
if (Control.CheckDistributionParameters && !IsValidParameterSet(m, v, k))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
_random = SystemRandomSource.Default;
@ -92,7 +91,7 @@ namespace MathNet.Numerics.Distributions
{
if (Control.CheckDistributionParameters && !IsValidParameterSet(m, v, k))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
_random = randomSource ?? SystemRandomSource.Default;
@ -223,7 +222,7 @@ namespace MathNet.Numerics.Distributions
{
if (Control.CheckDistributionParameters && !IsValidParameterSet(m, v, k))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
var n = m.RowCount;

15
src/Numerics/Distributions/Multinomial.cs

@ -32,7 +32,6 @@ using System.Collections.Generic;
using System.Linq;
using MathNet.Numerics.LinearAlgebra;
using MathNet.Numerics.LinearAlgebra.Double;
using MathNet.Numerics.Properties;
using MathNet.Numerics.Random;
using MathNet.Numerics.Statistics;
@ -73,7 +72,7 @@ namespace MathNet.Numerics.Distributions
{
if (Control.CheckDistributionParameters && !IsValidParameterSet(p, n))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
_random = SystemRandomSource.Default;
@ -94,7 +93,7 @@ namespace MathNet.Numerics.Distributions
{
if (Control.CheckDistributionParameters && !IsValidParameterSet(p, n))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
_random = randomSource ?? SystemRandomSource.Default;
@ -128,7 +127,7 @@ namespace MathNet.Numerics.Distributions
if (Control.CheckDistributionParameters && !IsValidParameterSet(p, n))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
_p = (double[])p.Clone();
@ -250,7 +249,7 @@ namespace MathNet.Numerics.Distributions
if (x.Length != _p.Length)
{
throw new ArgumentException(Resources.ArgumentVectorsSameLength, nameof(x));
throw new ArgumentException("All vectors must have the same dimensionality.", nameof(x));
}
if (x.Sum() == _trials)
@ -284,7 +283,7 @@ namespace MathNet.Numerics.Distributions
if (x.Length != _p.Length)
{
throw new ArgumentException(Resources.ArgumentVectorsSameLength, nameof(x));
throw new ArgumentException("All vectors must have the same dimensionality.", nameof(x));
}
if (x.Sum() == _trials)
@ -330,7 +329,7 @@ namespace MathNet.Numerics.Distributions
{
if (Control.CheckDistributionParameters && !IsValidParameterSet(p, n))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
// The cumulative density of p.
@ -359,7 +358,7 @@ namespace MathNet.Numerics.Distributions
{
if (Control.CheckDistributionParameters && !IsValidParameterSet(p, n))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
// The cumulative density of p.

21
src/Numerics/Distributions/NegativeBinomial.cs

@ -29,7 +29,6 @@
using System;
using System.Collections.Generic;
using MathNet.Numerics.Properties;
using MathNet.Numerics.Random;
namespace MathNet.Numerics.Distributions
@ -57,7 +56,7 @@ namespace MathNet.Numerics.Distributions
{
if (!IsValidParameterSet(r, p))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
_random = SystemRandomSource.Default;
@ -75,7 +74,7 @@ namespace MathNet.Numerics.Distributions
{
if (!IsValidParameterSet(r, p))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
_random = randomSource ?? SystemRandomSource.Default;
@ -221,7 +220,7 @@ namespace MathNet.Numerics.Distributions
{
if (!(r >= 0.0 && p >= 0.0 && p <= 1.0))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SpecialFunctions.GammaLn(r + k)
@ -243,7 +242,7 @@ namespace MathNet.Numerics.Distributions
{
if (!(r >= 0.0 && p >= 0.0 && p <= 1.0))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return 1 - SpecialFunctions.BetaRegularized(x + 1, r, 1 - p);
@ -323,7 +322,7 @@ namespace MathNet.Numerics.Distributions
{
if (!(r >= 0.0 && p >= 0.0 && p <= 1.0))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SampleUnchecked(rnd, r, p);
@ -339,7 +338,7 @@ namespace MathNet.Numerics.Distributions
{
if (!(r >= 0.0 && p >= 0.0 && p <= 1.0))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SamplesUnchecked(rnd, r, p);
@ -356,7 +355,7 @@ namespace MathNet.Numerics.Distributions
{
if (!(r >= 0.0 && p >= 0.0 && p <= 1.0))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
SamplesUnchecked(rnd, values, r, p);
@ -371,7 +370,7 @@ namespace MathNet.Numerics.Distributions
{
if (!(r >= 0.0 && p >= 0.0 && p <= 1.0))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SampleUnchecked(SystemRandomSource.Default, r, p);
@ -386,7 +385,7 @@ namespace MathNet.Numerics.Distributions
{
if (!(r >= 0.0 && p >= 0.0 && p <= 1.0))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SamplesUnchecked(SystemRandomSource.Default, r, p);
@ -402,7 +401,7 @@ namespace MathNet.Numerics.Distributions
{
if (!(r >= 0.0 && p >= 0.0 && p <= 1.0))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
SamplesUnchecked(SystemRandomSource.Default, values, r, p);

25
src/Numerics/Distributions/Normal.cs

@ -29,7 +29,6 @@
using System;
using System.Collections.Generic;
using MathNet.Numerics.Properties;
using MathNet.Numerics.Random;
using MathNet.Numerics.Statistics;
@ -78,7 +77,7 @@ namespace MathNet.Numerics.Distributions
{
if (!IsValidParameterSet(mean, stddev))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
_random = SystemRandomSource.Default;
@ -97,7 +96,7 @@ namespace MathNet.Numerics.Distributions
{
if (!IsValidParameterSet(mean, stddev))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
_random = randomSource ?? SystemRandomSource.Default;
@ -423,7 +422,7 @@ namespace MathNet.Numerics.Distributions
{
if (stddev < 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
var d = (x - mean)/stddev;
@ -442,7 +441,7 @@ namespace MathNet.Numerics.Distributions
{
if (stddev < 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
var d = (x - mean)/stddev;
@ -462,7 +461,7 @@ namespace MathNet.Numerics.Distributions
{
if (stddev < 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return 0.5*SpecialFunctions.Erfc((mean - x)/(stddev*Constants.Sqrt2));
@ -482,7 +481,7 @@ namespace MathNet.Numerics.Distributions
{
if (stddev < 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return mean - (stddev*Constants.Sqrt2*SpecialFunctions.ErfcInv(2.0*p));
@ -499,7 +498,7 @@ namespace MathNet.Numerics.Distributions
{
if (stddev < 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SampleUnchecked(rnd, mean, stddev);
@ -516,7 +515,7 @@ namespace MathNet.Numerics.Distributions
{
if (stddev < 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SamplesUnchecked(rnd, mean, stddev);
@ -534,7 +533,7 @@ namespace MathNet.Numerics.Distributions
{
if (stddev < 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
SamplesUnchecked(rnd, values, mean, stddev);
@ -550,7 +549,7 @@ namespace MathNet.Numerics.Distributions
{
if (stddev < 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SampleUnchecked(SystemRandomSource.Default, mean, stddev);
@ -566,7 +565,7 @@ namespace MathNet.Numerics.Distributions
{
if (stddev < 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SamplesUnchecked(SystemRandomSource.Default, mean, stddev);
@ -583,7 +582,7 @@ namespace MathNet.Numerics.Distributions
{
if (stddev < 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
SamplesUnchecked(SystemRandomSource.Default, values, mean, stddev);

9
src/Numerics/Distributions/NormalGamma.cs

@ -29,7 +29,6 @@
using System;
using System.Collections.Generic;
using MathNet.Numerics.Properties;
using MathNet.Numerics.Random;
namespace MathNet.Numerics.Distributions
@ -95,7 +94,7 @@ namespace MathNet.Numerics.Distributions
{
if (Control.CheckDistributionParameters && !IsValidParameterSet(meanLocation, meanScale, precisionShape, precisionInverseScale))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
_random = SystemRandomSource.Default;
@ -117,7 +116,7 @@ namespace MathNet.Numerics.Distributions
{
if (Control.CheckDistributionParameters && !IsValidParameterSet(meanLocation, meanScale, precisionShape, precisionInverseScale))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
_random = randomSource ?? SystemRandomSource.Default;
@ -330,7 +329,7 @@ namespace MathNet.Numerics.Distributions
{
if (Control.CheckDistributionParameters && !IsValidParameterSet(meanLocation, meanScale, precisionShape, precisionInverseScale))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
var mp = new MeanPrecisionPair();
@ -357,7 +356,7 @@ namespace MathNet.Numerics.Distributions
{
if (Control.CheckDistributionParameters && !IsValidParameterSet(meanLocation, meanScale, precisionShape, precisionInvScale))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
while (true)

25
src/Numerics/Distributions/Pareto.cs

@ -30,7 +30,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using MathNet.Numerics.Properties;
using MathNet.Numerics.Random;
using MathNet.Numerics.Threading;
@ -60,7 +59,7 @@ namespace MathNet.Numerics.Distributions
{
if (!IsValidParameterSet(scale, shape))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
_random = SystemRandomSource.Default;
@ -79,7 +78,7 @@ namespace MathNet.Numerics.Distributions
{
if (!IsValidParameterSet(scale, shape))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
_random = randomSource ?? SystemRandomSource.Default;
@ -299,7 +298,7 @@ namespace MathNet.Numerics.Distributions
{
if (scale <= 0.0 || shape <= 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return shape*Math.Pow(scale, shape)/Math.Pow(x, shape + 1.0);
@ -317,7 +316,7 @@ namespace MathNet.Numerics.Distributions
{
if (scale <= 0.0 || shape <= 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return Math.Log(shape) + shape*Math.Log(scale) - (shape + 1.0)*Math.Log(x);
@ -335,7 +334,7 @@ namespace MathNet.Numerics.Distributions
{
if (scale <= 0.0 || shape <= 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return 1.0 - Math.Pow(scale/x, shape);
@ -354,7 +353,7 @@ namespace MathNet.Numerics.Distributions
{
if (scale <= 0.0 || shape <= 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return scale*Math.Pow(1.0 - p, -1.0/shape);
@ -371,7 +370,7 @@ namespace MathNet.Numerics.Distributions
{
if (scale <= 0.0 || shape <= 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return scale*Math.Pow(rnd.NextDouble(), -1.0/shape);
@ -388,7 +387,7 @@ namespace MathNet.Numerics.Distributions
{
if (scale <= 0.0 || shape <= 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SamplesUnchecked(rnd, scale, shape);
@ -406,7 +405,7 @@ namespace MathNet.Numerics.Distributions
{
if (scale <= 0.0 || shape <= 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
SamplesUnchecked(rnd, values, scale, shape);
@ -422,7 +421,7 @@ namespace MathNet.Numerics.Distributions
{
if (scale <= 0.0 || shape <= 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SampleUnchecked(SystemRandomSource.Default, scale, shape);
@ -438,7 +437,7 @@ namespace MathNet.Numerics.Distributions
{
if (scale <= 0.0 || shape <= 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SamplesUnchecked(SystemRandomSource.Default, scale, shape);
@ -455,7 +454,7 @@ namespace MathNet.Numerics.Distributions
{
if (scale <= 0.0 || shape <= 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
SamplesUnchecked(SystemRandomSource.Default, values, scale, shape);

23
src/Numerics/Distributions/Poisson.cs

@ -29,7 +29,6 @@
using System;
using System.Collections.Generic;
using MathNet.Numerics.Properties;
using MathNet.Numerics.Random;
namespace MathNet.Numerics.Distributions
@ -57,7 +56,7 @@ namespace MathNet.Numerics.Distributions
{
if (!IsValidParameterSet(lambda))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
_random = SystemRandomSource.Default;
@ -74,7 +73,7 @@ namespace MathNet.Numerics.Distributions
{
if (!IsValidParameterSet(lambda))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
_random = randomSource ?? SystemRandomSource.Default;
@ -202,7 +201,7 @@ namespace MathNet.Numerics.Distributions
{
if (!(lambda > 0.0))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return Math.Exp(-lambda + (k*Math.Log(lambda)) - SpecialFunctions.FactorialLn(k));
@ -218,7 +217,7 @@ namespace MathNet.Numerics.Distributions
{
if (!(lambda > 0.0))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return -lambda + (k*Math.Log(lambda)) - SpecialFunctions.FactorialLn(k);
@ -235,7 +234,7 @@ namespace MathNet.Numerics.Distributions
{
if (!(lambda > 0.0))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return 1.0 - SpecialFunctions.GammaLowerRegularized(x + 1, lambda);
@ -411,7 +410,7 @@ namespace MathNet.Numerics.Distributions
{
if (!(lambda > 0.0))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SampleUnchecked(rnd, lambda);
@ -427,7 +426,7 @@ namespace MathNet.Numerics.Distributions
{
if (!(lambda > 0.0))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SamplesUnchecked(rnd, lambda);
@ -444,7 +443,7 @@ namespace MathNet.Numerics.Distributions
{
if (!(lambda > 0.0))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
SamplesUnchecked(rnd, values, lambda);
@ -459,7 +458,7 @@ namespace MathNet.Numerics.Distributions
{
if (!(lambda > 0.0))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SampleUnchecked(SystemRandomSource.Default, lambda);
@ -474,7 +473,7 @@ namespace MathNet.Numerics.Distributions
{
if (!(lambda > 0.0))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SamplesUnchecked(SystemRandomSource.Default, lambda);
@ -490,7 +489,7 @@ namespace MathNet.Numerics.Distributions
{
if (!(lambda > 0.0))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
SamplesUnchecked(SystemRandomSource.Default, values, lambda);

25
src/Numerics/Distributions/Rayleigh.cs

@ -30,7 +30,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using MathNet.Numerics.Properties;
using MathNet.Numerics.Random;
using MathNet.Numerics.Threading;
@ -59,7 +58,7 @@ namespace MathNet.Numerics.Distributions
{
if (!IsValidParameterSet(scale))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
_random = SystemRandomSource.Default;
@ -76,7 +75,7 @@ namespace MathNet.Numerics.Distributions
{
if (!IsValidParameterSet(scale))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
_random = randomSource ?? SystemRandomSource.Default;
@ -264,7 +263,7 @@ namespace MathNet.Numerics.Distributions
{
if (scale <= 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return (x/(scale*scale))*Math.Exp(-x*x/(2.0*scale*scale));
@ -281,7 +280,7 @@ namespace MathNet.Numerics.Distributions
{
if (scale <= 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return Math.Log(x/(scale*scale)) - (x*x/(2.0*scale*scale));
@ -298,7 +297,7 @@ namespace MathNet.Numerics.Distributions
{
if (scale <= 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return 1.0 - Math.Exp(-x*x/(2.0*scale*scale));
@ -316,7 +315,7 @@ namespace MathNet.Numerics.Distributions
{
if (scale <= 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return scale*Math.Sqrt(-2*Math.Log(1 - p));
@ -332,7 +331,7 @@ namespace MathNet.Numerics.Distributions
{
if (scale <= 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SampleUnchecked(rnd, scale);
@ -348,7 +347,7 @@ namespace MathNet.Numerics.Distributions
{
if (scale <= 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SamplesUnchecked(rnd, scale);
@ -365,7 +364,7 @@ namespace MathNet.Numerics.Distributions
{
if (scale <= 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
SamplesUnchecked(rnd, values, scale);
@ -380,7 +379,7 @@ namespace MathNet.Numerics.Distributions
{
if (scale <= 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SampleUnchecked(SystemRandomSource.Default, scale);
@ -395,7 +394,7 @@ namespace MathNet.Numerics.Distributions
{
if (scale <= 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SamplesUnchecked(SystemRandomSource.Default, scale);
@ -411,7 +410,7 @@ namespace MathNet.Numerics.Distributions
{
if (scale <= 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
SamplesUnchecked(SystemRandomSource.Default, values, scale);

23
src/Numerics/Distributions/SkewedGeneralizedError.cs

@ -27,7 +27,6 @@
// OTHER DEALINGS IN THE SOFTWARE.
// </copyright>
using MathNet.Numerics.Properties;
using MathNet.Numerics.Random;
using System;
using System.Collections.Generic;
@ -85,7 +84,7 @@ namespace MathNet.Numerics.Distributions
{
if (!IsValidParameterSet(location, scale, skew, p))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
_random = SystemRandomSource.Default;
@ -220,7 +219,7 @@ namespace MathNet.Numerics.Distributions
{
if (!IsValidParameterSet(location, scale, skew, p))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
scale = AdjustScale(scale, skew, p);
@ -237,7 +236,7 @@ namespace MathNet.Numerics.Distributions
{
if (!IsValidParameterSet(location, scale, skew, p))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
scale = AdjustScale(scale, skew, p);
@ -251,7 +250,7 @@ namespace MathNet.Numerics.Distributions
{
if (!IsValidParameterSet(location, scale, skew, p))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
scale = AdjustScale(scale, skew, p);
@ -272,7 +271,7 @@ namespace MathNet.Numerics.Distributions
{
if (!IsValidParameterSet(location, scale, skew, p))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
scale = AdjustScale(scale, skew, p);
@ -363,7 +362,7 @@ namespace MathNet.Numerics.Distributions
{
if (!IsValidParameterSet(location, scale, skew, p))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SampleUnchecked(rnd, location, scale, skew, p);
@ -382,7 +381,7 @@ namespace MathNet.Numerics.Distributions
{
if (!IsValidParameterSet(location, scale, skew, p))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SamplesUnchecked(rnd, location, scale, skew, p);
@ -402,7 +401,7 @@ namespace MathNet.Numerics.Distributions
{
if (!IsValidParameterSet(location, scale, skew, p))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
SamplesUnchecked(rnd, values, location, scale, skew, p);
@ -420,7 +419,7 @@ namespace MathNet.Numerics.Distributions
{
if (!IsValidParameterSet(location, scale, skew, p))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SampleUnchecked(SystemRandomSource.Default, location, scale, skew, p);
@ -438,7 +437,7 @@ namespace MathNet.Numerics.Distributions
{
if (!IsValidParameterSet(location, scale, skew, p))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SamplesUnchecked(SystemRandomSource.Default, location, scale, skew, p);
@ -457,7 +456,7 @@ namespace MathNet.Numerics.Distributions
{
if (!IsValidParameterSet(location, scale, skew, p))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
SamplesUnchecked(SystemRandomSource.Default, values, location, scale, skew, p);

23
src/Numerics/Distributions/SkewedGeneralizedT.cs

@ -29,7 +29,6 @@
using System;
using System.Collections.Generic;
using MathNet.Numerics.Properties;
using MathNet.Numerics.Random;
namespace MathNet.Numerics.Distributions
@ -95,7 +94,7 @@ namespace MathNet.Numerics.Distributions
{
if (!IsValidParameterSet(location, scale, skew, p, q))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
_random = SystemRandomSource.Default;
@ -277,7 +276,7 @@ namespace MathNet.Numerics.Distributions
{
if (!IsValidParameterSet(location, scale, skew, p, q))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
var fn = PDFunc(location, scale, skew, p, q, false);
@ -299,7 +298,7 @@ namespace MathNet.Numerics.Distributions
{
if (!IsValidParameterSet(location, scale, skew, p, q))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
var fn = PDFunc(location, scale, skew, p, q, true);
@ -366,7 +365,7 @@ namespace MathNet.Numerics.Distributions
{
if (!IsValidParameterSet(location, scale, skew, p, q))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
// Note: Adapted from the R package,
@ -403,7 +402,7 @@ namespace MathNet.Numerics.Distributions
{
if (!IsValidParameterSet(location, scale, skew, p, q))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
// If parameters represent a specialized distribution, then we use that distribution to avoid
@ -533,7 +532,7 @@ namespace MathNet.Numerics.Distributions
{
if (!IsValidParameterSet(location, scale, skew, p, q))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SampleUnchecked(rnd, location, scale, skew, p, q);
@ -553,7 +552,7 @@ namespace MathNet.Numerics.Distributions
{
if (!IsValidParameterSet(location, scale, skew, p, q))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SamplesUnchecked(rnd, location, scale, skew, p, q);
@ -574,7 +573,7 @@ namespace MathNet.Numerics.Distributions
{
if (!IsValidParameterSet(location, scale, skew, p, q))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
SamplesUnchecked(rnd, values, location, scale, skew, p, q);
@ -593,7 +592,7 @@ namespace MathNet.Numerics.Distributions
{
if (!IsValidParameterSet(location, scale, skew, p, q))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SampleUnchecked(SystemRandomSource.Default, location, scale, skew, p, q);
@ -612,7 +611,7 @@ namespace MathNet.Numerics.Distributions
{
if (!IsValidParameterSet(location, scale, skew, p, q))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SamplesUnchecked(SystemRandomSource.Default, location, scale, skew, p, q);
@ -632,7 +631,7 @@ namespace MathNet.Numerics.Distributions
{
if (!IsValidParameterSet(location, scale, skew, p, q))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
SamplesUnchecked(SystemRandomSource.Default, values, location, scale, skew, p, q);

23
src/Numerics/Distributions/Stable.cs

@ -29,7 +29,6 @@
using System;
using System.Collections.Generic;
using MathNet.Numerics.Properties;
using MathNet.Numerics.Random;
namespace MathNet.Numerics.Distributions
@ -62,7 +61,7 @@ namespace MathNet.Numerics.Distributions
{
if (!IsValidParameterSet(alpha, beta, scale, location))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
_random = SystemRandomSource.Default;
@ -84,7 +83,7 @@ namespace MathNet.Numerics.Distributions
{
if (!IsValidParameterSet(alpha, beta, scale, location))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
_random = randomSource ?? SystemRandomSource.Default;
@ -424,7 +423,7 @@ namespace MathNet.Numerics.Distributions
{
if (alpha <= 0.0 || alpha > 2.0 || beta < -1.0 || beta > 1.0 || scale <= 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
if (alpha == 2d)
@ -459,7 +458,7 @@ namespace MathNet.Numerics.Distributions
{
if (alpha <= 0.0 || alpha > 2.0 || beta < -1.0 || beta > 1.0 || scale <= 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
if (alpha == 2d)
@ -494,7 +493,7 @@ namespace MathNet.Numerics.Distributions
{
if (alpha <= 0.0 || alpha > 2.0 || beta < -1.0 || beta > 1.0 || scale <= 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
if (alpha == 2d)
@ -528,7 +527,7 @@ namespace MathNet.Numerics.Distributions
{
if (alpha <= 0.0 || alpha > 2.0 || beta < -1.0 || beta > 1.0 || scale <= 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SampleUnchecked(rnd, alpha, beta, scale, location);
@ -547,7 +546,7 @@ namespace MathNet.Numerics.Distributions
{
if (alpha <= 0.0 || alpha > 2.0 || beta < -1.0 || beta > 1.0 || scale <= 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SamplesUnchecked(rnd, alpha, beta, scale, location);
@ -567,7 +566,7 @@ namespace MathNet.Numerics.Distributions
{
if (alpha <= 0.0 || alpha > 2.0 || beta < -1.0 || beta > 1.0 || scale <= 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
SamplesUnchecked(rnd, values, alpha, beta, scale, location);
@ -585,7 +584,7 @@ namespace MathNet.Numerics.Distributions
{
if (alpha <= 0.0 || alpha > 2.0 || beta < -1.0 || beta > 1.0 || scale <= 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SampleUnchecked(SystemRandomSource.Default, alpha, beta, scale, location);
@ -603,7 +602,7 @@ namespace MathNet.Numerics.Distributions
{
if (alpha <= 0.0 || alpha > 2.0 || beta < -1.0 || beta > 1.0 || scale <= 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SamplesUnchecked(SystemRandomSource.Default, alpha, beta, scale, location);
@ -622,7 +621,7 @@ namespace MathNet.Numerics.Distributions
{
if (alpha <= 0.0 || alpha > 2.0 || beta < -1.0 || beta > 1.0 || scale <= 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
SamplesUnchecked(SystemRandomSource.Default, values, alpha, beta, scale, location);

25
src/Numerics/Distributions/StudentT.cs

@ -29,7 +29,6 @@
using System;
using System.Collections.Generic;
using MathNet.Numerics.Properties;
using MathNet.Numerics.Random;
using MathNet.Numerics.RootFinding;
@ -87,7 +86,7 @@ namespace MathNet.Numerics.Distributions
{
if (!IsValidParameterSet(location, scale, freedom))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
_random = SystemRandomSource.Default;
@ -108,7 +107,7 @@ namespace MathNet.Numerics.Distributions
{
if (!IsValidParameterSet(location, scale, freedom))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
_random = randomSource ?? SystemRandomSource.Default;
@ -376,7 +375,7 @@ namespace MathNet.Numerics.Distributions
{
if (scale <= 0.0 || freedom <= 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
// TODO JVG we can probably do a better job for Cauchy special case
@ -405,7 +404,7 @@ namespace MathNet.Numerics.Distributions
{
if (scale <= 0.0 || freedom <= 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
// TODO JVG we can probably do a better job for Cauchy special case
@ -434,7 +433,7 @@ namespace MathNet.Numerics.Distributions
{
if (scale <= 0.0 || freedom <= 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
// TODO JVG we can probably do a better job for Cauchy special case
@ -464,7 +463,7 @@ namespace MathNet.Numerics.Distributions
{
if (scale <= 0.0 || freedom <= 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
// TODO JVG we can probably do a better job for Cauchy special case
@ -500,7 +499,7 @@ namespace MathNet.Numerics.Distributions
{
if (scale <= 0.0 || freedom <= 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SampleUnchecked(rnd, location, scale, freedom);
@ -518,7 +517,7 @@ namespace MathNet.Numerics.Distributions
{
if (scale <= 0.0 || freedom <= 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SamplesUnchecked(rnd, location, scale, freedom);
@ -537,7 +536,7 @@ namespace MathNet.Numerics.Distributions
{
if (scale <= 0.0 || freedom <= 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
SamplesUnchecked(rnd, values, location, scale, freedom);
@ -554,7 +553,7 @@ namespace MathNet.Numerics.Distributions
{
if (scale <= 0.0 || freedom <= 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SampleUnchecked(SystemRandomSource.Default, location, scale, freedom);
@ -571,7 +570,7 @@ namespace MathNet.Numerics.Distributions
{
if (scale <= 0.0 || freedom <= 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SamplesUnchecked(SystemRandomSource.Default, location, scale, freedom);
@ -589,7 +588,7 @@ namespace MathNet.Numerics.Distributions
{
if (scale <= 0.0 || freedom <= 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
SamplesUnchecked(SystemRandomSource.Default, values, location, scale, freedom);

23
src/Numerics/Distributions/Triangular.cs

@ -30,7 +30,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using MathNet.Numerics.Properties;
using MathNet.Numerics.Random;
using MathNet.Numerics.Threading;
@ -63,7 +62,7 @@ namespace MathNet.Numerics.Distributions
{
if (!IsValidParameterSet(lower, upper, mode))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
_random = SystemRandomSource.Default;
@ -84,7 +83,7 @@ namespace MathNet.Numerics.Distributions
{
if (!IsValidParameterSet(lower, upper, mode))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
_random = randomSource ?? SystemRandomSource.Default;
@ -327,7 +326,7 @@ namespace MathNet.Numerics.Distributions
{
if (!(upper >= mode && mode >= lower))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
var a = lower;
@ -374,7 +373,7 @@ namespace MathNet.Numerics.Distributions
{
if (!(upper >= mode && mode >= lower))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
var a = lower;
@ -413,7 +412,7 @@ namespace MathNet.Numerics.Distributions
{
if (!(upper >= mode && mode >= lower))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
var a = lower;
@ -451,7 +450,7 @@ namespace MathNet.Numerics.Distributions
{
if (!(upper >= mode && mode >= lower))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SampleUnchecked(rnd, lower, upper, mode);
@ -469,7 +468,7 @@ namespace MathNet.Numerics.Distributions
{
if (!(upper >= mode && mode >= lower))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SamplesUnchecked(rnd, lower, upper, mode);
@ -488,7 +487,7 @@ namespace MathNet.Numerics.Distributions
{
if (!(upper >= mode && mode >= lower))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
SamplesUnchecked(rnd, values, lower, upper, mode);
@ -505,7 +504,7 @@ namespace MathNet.Numerics.Distributions
{
if (!(upper >= mode && mode >= lower))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SampleUnchecked(SystemRandomSource.Default, lower, upper, mode);
@ -522,7 +521,7 @@ namespace MathNet.Numerics.Distributions
{
if (!(upper >= mode && mode >= lower))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SamplesUnchecked(SystemRandomSource.Default, lower, upper, mode);
@ -540,7 +539,7 @@ namespace MathNet.Numerics.Distributions
{
if (!(upper >= mode && mode >= lower))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
SamplesUnchecked(SystemRandomSource.Default, values, lower, upper, mode);

17
src/Numerics/Distributions/TruncatedPareto.cs

@ -27,7 +27,6 @@
// OTHER DEALINGS IN THE SOFTWARE.
// </copyright>
using MathNet.Numerics.Properties;
using MathNet.Numerics.Random;
using System;
using System.Collections.Generic;
@ -50,7 +49,7 @@ namespace MathNet.Numerics.Distributions
{
if (!IsValidParameterSet(scale, shape, truncation))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
_random = randomSource ?? SystemRandomSource.Default;
Scale = scale;
@ -216,7 +215,7 @@ namespace MathNet.Numerics.Distributions
{
if (!IsValidParameterSet(scale, shape, truncation))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SampleUnchecked(rnd, scale, shape, truncation);
}
@ -233,7 +232,7 @@ namespace MathNet.Numerics.Distributions
{
if (!IsValidParameterSet(scale, shape, truncation))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
SamplesUnchecked(rnd, values, scale, shape, truncation);
}
@ -250,7 +249,7 @@ namespace MathNet.Numerics.Distributions
{
if (!IsValidParameterSet(scale, shape, truncation))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SamplesUnchecked(rnd, scale, shape, truncation);
}
@ -338,7 +337,7 @@ namespace MathNet.Numerics.Distributions
{
if (!IsValidParameterSet(scale, shape, truncation))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return InvCDFUncheckedImpl(scale, shape, truncation, p);
}
@ -356,7 +355,7 @@ namespace MathNet.Numerics.Distributions
{
if (!IsValidParameterSet(scale, shape, truncation))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return DensityImpl(scale, shape, truncation, x);
}
@ -374,7 +373,7 @@ namespace MathNet.Numerics.Distributions
{
if (!IsValidParameterSet(scale, shape, truncation))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return DensityLnImpl(scale, shape, truncation, x);
}
@ -392,7 +391,7 @@ namespace MathNet.Numerics.Distributions
{
if (!IsValidParameterSet(scale, shape, truncation))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return CumulativeDistributionImpl(scale, shape, truncation, x);
}

23
src/Numerics/Distributions/Weibull.cs

@ -30,7 +30,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using MathNet.Numerics.Properties;
using MathNet.Numerics.Random;
using MathNet.Numerics.Threading;
@ -69,7 +68,7 @@ namespace MathNet.Numerics.Distributions
{
if (!IsValidParameterSet(shape, scale))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
_random = SystemRandomSource.Default;
@ -88,7 +87,7 @@ namespace MathNet.Numerics.Distributions
{
if (!IsValidParameterSet(shape, scale))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
_random = randomSource ?? SystemRandomSource.Default;
@ -319,7 +318,7 @@ namespace MathNet.Numerics.Distributions
{
if (shape <= 0.0 || scale <= 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
if (x >= 0.0)
@ -350,7 +349,7 @@ namespace MathNet.Numerics.Distributions
{
if (shape <= 0.0 || scale <= 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
if (x >= 0.0)
@ -381,7 +380,7 @@ namespace MathNet.Numerics.Distributions
{
if (shape <= 0.0 || scale <= 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
if (x < 0.0)
@ -450,7 +449,7 @@ namespace MathNet.Numerics.Distributions
{
if (shape <= 0.0 || scale <= 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SampleUnchecked(rnd, shape, scale);
@ -467,7 +466,7 @@ namespace MathNet.Numerics.Distributions
{
if (shape <= 0.0 || scale <= 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SamplesUnchecked(rnd, shape, scale);
@ -485,7 +484,7 @@ namespace MathNet.Numerics.Distributions
{
if (shape <= 0.0 || scale <= 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
SamplesUnchecked(rnd, values, shape, scale);
@ -501,7 +500,7 @@ namespace MathNet.Numerics.Distributions
{
if (shape <= 0.0 || scale <= 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SampleUnchecked(SystemRandomSource.Default, shape, scale);
@ -517,7 +516,7 @@ namespace MathNet.Numerics.Distributions
{
if (shape <= 0.0 || scale <= 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SamplesUnchecked(SystemRandomSource.Default, shape, scale);
@ -534,7 +533,7 @@ namespace MathNet.Numerics.Distributions
{
if (shape <= 0.0 || scale <= 0.0)
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
SamplesUnchecked(SystemRandomSource.Default, values, shape, scale);

7
src/Numerics/Distributions/Wishart.cs

@ -31,7 +31,6 @@ using System;
using MathNet.Numerics.LinearAlgebra;
using MathNet.Numerics.LinearAlgebra.Double;
using MathNet.Numerics.LinearAlgebra.Factorization;
using MathNet.Numerics.Properties;
using MathNet.Numerics.Random;
namespace MathNet.Numerics.Distributions
@ -71,7 +70,7 @@ namespace MathNet.Numerics.Distributions
{
if (Control.CheckDistributionParameters && !IsValidParameterSet(degreesOfFreedom, scale))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
_random = SystemRandomSource.Default;
@ -90,7 +89,7 @@ namespace MathNet.Numerics.Distributions
{
if (Control.CheckDistributionParameters && !IsValidParameterSet(degreesOfFreedom, scale))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
_random = randomSource ?? SystemRandomSource.Default;
@ -238,7 +237,7 @@ namespace MathNet.Numerics.Distributions
{
if (Control.CheckDistributionParameters && !IsValidParameterSet(degreesOfFreedom, scale))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return DoSample(rnd, degreesOfFreedom, scale, scale.Cholesky());

23
src/Numerics/Distributions/Zipf.cs

@ -29,7 +29,6 @@
using System;
using System.Collections.Generic;
using MathNet.Numerics.Properties;
using MathNet.Numerics.Random;
namespace MathNet.Numerics.Distributions
@ -65,7 +64,7 @@ namespace MathNet.Numerics.Distributions
{
if (!IsValidParameterSet(s, n))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
_random = SystemRandomSource.Default;
@ -83,7 +82,7 @@ namespace MathNet.Numerics.Distributions
{
if (!IsValidParameterSet(s, n))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
_random = randomSource ?? SystemRandomSource.Default;
@ -256,7 +255,7 @@ namespace MathNet.Numerics.Distributions
{
if (!(n > 0 && s > 0.0))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return (1.0/Math.Pow(k, s))/SpecialFunctions.GeneralHarmonic(n, s);
@ -273,7 +272,7 @@ namespace MathNet.Numerics.Distributions
{
if (!(n > 0 && s > 0.0))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return Math.Log(PMF(s, n, k));
@ -291,7 +290,7 @@ namespace MathNet.Numerics.Distributions
{
if (!(n > 0 && s > 0.0))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
if (x < 1)
@ -384,7 +383,7 @@ namespace MathNet.Numerics.Distributions
{
if (!(n > 0 && s > 0.0))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SampleUnchecked(rnd, s, n);
@ -400,7 +399,7 @@ namespace MathNet.Numerics.Distributions
{
if (!(n > 0 && s > 0.0))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SamplesUnchecked(rnd, s, n);
@ -417,7 +416,7 @@ namespace MathNet.Numerics.Distributions
{
if (!(n > 0 && s > 0.0))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
SamplesUnchecked(rnd, values, s, n);
@ -432,7 +431,7 @@ namespace MathNet.Numerics.Distributions
{
if (!(n > 0 && s > 0.0))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SampleUnchecked(SystemRandomSource.Default, s, n);
@ -447,7 +446,7 @@ namespace MathNet.Numerics.Distributions
{
if (!(n > 0 && s > 0.0))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
return SamplesUnchecked(SystemRandomSource.Default, s, n);
@ -463,7 +462,7 @@ namespace MathNet.Numerics.Distributions
{
if (!(n > 0 && s > 0.0))
{
throw new ArgumentException(Resources.InvalidDistributionParameters);
throw new ArgumentException("Invalid parametrization for the distribution.");
}
SamplesUnchecked(SystemRandomSource.Default, values, s, n);

21
src/Numerics/Exceptions.cs

@ -1,5 +1,4 @@
using System;
using MathNet.Numerics.Properties;
namespace MathNet.Numerics
{
@ -9,7 +8,7 @@ namespace MathNet.Numerics
[Serializable]
public class NonConvergenceException : Exception
{
public NonConvergenceException() : base(Resources.ConvergenceFailed)
public NonConvergenceException() : base("An algorithm failed to converge.")
{
}
@ -35,7 +34,7 @@ namespace MathNet.Numerics
public class NumericalBreakdownException : NonConvergenceException
{
public NumericalBreakdownException()
: base(Resources.NumericalBreakdown)
: base("Algorithm experience a numerical break down.")
{
}
@ -90,17 +89,17 @@ namespace MathNet.Numerics
public class InvalidParameterException : NativeInterfaceException
{
public InvalidParameterException()
: base(Resources.InvalidParameter)
: base("An invalid parameter was passed to a native method.")
{
}
public InvalidParameterException(int parameter)
: base(string.Format(Resources.InvalidParameterWithNumber, parameter))
: base($"An invalid parameter was passed to a native method, parameter number : {parameter}")
{
}
public InvalidParameterException(int parameter, Exception innerException)
: base(string.Format(Resources.InvalidParameterWithNumber, parameter), innerException)
: base($"An invalid parameter was passed to a native method, parameter number : {parameter}", innerException)
{
}
#if !NETSTANDARD1_3
@ -118,12 +117,12 @@ namespace MathNet.Numerics
public class MemoryAllocationException : NativeInterfaceException
{
public MemoryAllocationException()
: base(Resources.MemoryAllocation)
: base("Unable to allocate native memory.")
{
}
public MemoryAllocationException(Exception innerException)
: base(Resources.MemoryAllocation, innerException)
: base("Unable to allocate native memory.", innerException)
{
}
#if !NETSTANDARD1_3
@ -141,17 +140,17 @@ namespace MathNet.Numerics
public class SingularUMatrixException : NativeInterfaceException
{
public SingularUMatrixException()
: base(Resources.SingularUMatrix)
: base("U is singular, and the inversion could not be completed.")
{
}
public SingularUMatrixException(int element)
: base(string.Format(Resources.SingularUMatrixWithElement, element))
: base($"U is singular, and the inversion could not be completed. The {element}-th diagonal element of the factor U is zero.")
{
}
public SingularUMatrixException(int element, Exception innerException)
: base(string.Format(Resources.SingularUMatrixWithElement, element), innerException)
: base($"U is singular, and the inversion could not be completed. The {element}-th diagonal element of the factor U is zero.", innerException)
{
}
#if !NETSTANDARD1_3

9
src/Numerics/FindRoots.cs

@ -28,7 +28,6 @@
// </copyright>
using System;
using MathNet.Numerics.Properties;
using MathNet.Numerics.RootFinding;
using Complex = System.Numerics.Complex;
@ -44,14 +43,12 @@ namespace MathNet.Numerics
/// <param name="maxIterations">Maximum number of iterations. Example: 100.</param>
public static double OfFunction(Func<double, double> f, double lowerBound, double upperBound, double accuracy = 1e-8, int maxIterations = 100)
{
double root;
if (!ZeroCrossingBracketing.ExpandReduce(f, ref lowerBound, ref upperBound, 1.6, maxIterations, maxIterations*10))
{
throw new NonConvergenceException(Resources.RootFindingFailed);
throw new NonConvergenceException("The algorithm has failed, exceeded the number of iterations allowed or there is no root within the provided bounds.");
}
if (Brent.TryFindRoot(f, lowerBound, upperBound, accuracy, maxIterations, out root))
if (Brent.TryFindRoot(f, lowerBound, upperBound, accuracy, maxIterations, out var root))
{
return root;
}
@ -61,7 +58,7 @@ namespace MathNet.Numerics
return root;
}
throw new NonConvergenceException(Resources.RootFindingFailed);
throw new NonConvergenceException("The algorithm has failed, exceeded the number of iterations allowed or there is no root within the provided bounds.");
}
/// <summary>Find a solution of the equation f(x)=0.</summary>

3
src/Numerics/Generate.cs

@ -31,7 +31,6 @@ using System;
using System.Collections.Generic;
using System.Linq;
using MathNet.Numerics.Distributions;
using MathNet.Numerics.Properties;
using MathNet.Numerics.Random;
using MathNet.Numerics.Threading;
using BigInteger = System.Numerics.BigInteger;
@ -69,7 +68,7 @@ namespace MathNet.Numerics
{
if (pointsA.Length != pointsB.Length)
{
throw new ArgumentException(Resources.ArgumentArraysSameLength, nameof(pointsB));
throw new ArgumentException("The array arguments must have the same length.", nameof(pointsB));
}
var res = new T[pointsA.Length];

9
src/Numerics/GoodnessOfFit.cs

@ -29,7 +29,6 @@
using System;
using System.Collections.Generic;
using MathNet.Numerics.Properties;
using MathNet.Numerics.Statistics;
namespace MathNet.Numerics
@ -94,7 +93,7 @@ namespace MathNet.Numerics
{
if (!ieO.MoveNext())
{
throw new ArgumentOutOfRangeException(nameof(modelledValues), Resources.ArgumentArraysSameLength);
throw new ArgumentOutOfRangeException(nameof(modelledValues), "The array arguments must have the same length.");
}
double currentM = ieM.Current;
double currentO = ieO.Current;
@ -105,7 +104,7 @@ namespace MathNet.Numerics
if (degreesOfFreedom >= n)
{
throw new ArgumentOutOfRangeException(nameof(degreesOfFreedom), Resources.DegreesOfFreedomMustBeLessThanSampleSize);
throw new ArgumentOutOfRangeException(nameof(degreesOfFreedom), "The sample size must be larger than the given degrees of freedom.");
}
return Math.Sqrt(accumulator / (n - degreesOfFreedom));
}
@ -135,7 +134,7 @@ namespace MathNet.Numerics
{
if (!ieF.MoveNext())
{
throw new ArgumentOutOfRangeException(nameof(modelledValues), Resources.ArgumentArraysSameLength);
throw new ArgumentOutOfRangeException(nameof(modelledValues), "The array arguments must have the same length.");
}
double currentY = ieY.Current;
@ -165,7 +164,7 @@ namespace MathNet.Numerics
if (ieF.MoveNext())
{
throw new ArgumentOutOfRangeException(nameof(observedValues), Resources.ArgumentArraysSameLength);
throw new ArgumentOutOfRangeException(nameof(observedValues), "The array arguments must have the same length.");
}
}
return 1 - ssRes/ssTot;

17
src/Numerics/IntegralTransforms/Fourier.cs

@ -30,7 +30,6 @@
using System;
using MathNet.Numerics.LinearAlgebra;
using MathNet.Numerics.LinearAlgebra.Storage;
using MathNet.Numerics.Properties;
using MathNet.Numerics.Providers.FourierTransform;
using Complex = System.Numerics.Complex;
@ -121,7 +120,7 @@ namespace MathNet.Numerics.IntegralTransforms
{
if (real.Length != imaginary.Length)
{
throw new ArgumentException(Resources.ArgumentArraysSameLength);
throw new ArgumentException("The array arguments must have the same length.");
}
// TODO: consider to support this natively by the provider, without the need for copying
@ -152,7 +151,7 @@ namespace MathNet.Numerics.IntegralTransforms
{
if (real.Length != imaginary.Length)
{
throw new ArgumentException(Resources.ArgumentArraysSameLength);
throw new ArgumentException("The array arguments must have the same length.");
}
// TODO: consider to support this natively by the provider, without the need for copying
@ -187,7 +186,7 @@ namespace MathNet.Numerics.IntegralTransforms
int length = n.IsEven() ? n + 2 : n + 1;
if (data.Length < length)
{
throw new ArgumentException(string.Format(Resources.ArrayTooSmall, length));
throw new ArgumentException($"The given array is too small. It must be at least {length} long.");
}
if ((options & FourierOptions.InverseExponent) == FourierOptions.InverseExponent)
@ -221,7 +220,7 @@ namespace MathNet.Numerics.IntegralTransforms
int length = n.IsEven() ? n + 2 : n + 1;
if (data.Length < length)
{
throw new ArgumentException(string.Format(Resources.ArrayTooSmall, length));
throw new ArgumentException($"The given array is too small. It must be at least {length} long.");
}
if ((options & FourierOptions.InverseExponent) == FourierOptions.InverseExponent)
@ -471,7 +470,7 @@ namespace MathNet.Numerics.IntegralTransforms
{
if (real.Length != imaginary.Length)
{
throw new ArgumentException(Resources.ArgumentArraysSameLength);
throw new ArgumentException("The array arguments must have the same length.");
}
// TODO: consider to support this natively by the provider, without the need for copying
@ -502,7 +501,7 @@ namespace MathNet.Numerics.IntegralTransforms
{
if (real.Length != imaginary.Length)
{
throw new ArgumentException(Resources.ArgumentArraysSameLength);
throw new ArgumentException("The array arguments must have the same length.");
}
// TODO: consider to support this natively by the provider, without the need for copying
@ -537,7 +536,7 @@ namespace MathNet.Numerics.IntegralTransforms
int length = n.IsEven() ? n + 2 : n + 1;
if (data.Length < length)
{
throw new ArgumentException(string.Format(Resources.ArrayTooSmall, length));
throw new ArgumentException($"The given array is too small. It must be at least {length} long.");
}
if ((options & FourierOptions.InverseExponent) == FourierOptions.InverseExponent)
@ -573,7 +572,7 @@ namespace MathNet.Numerics.IntegralTransforms
int length = n.IsEven() ? n + 2 : n + 1;
if (data.Length < length)
{
throw new ArgumentException(string.Format(Resources.ArrayTooSmall, length));
throw new ArgumentException($"The given array is too small. It must be at least {length} long.");
}
if ((options & FourierOptions.InverseExponent) == FourierOptions.InverseExponent)

7
src/Numerics/Integration/NewtonCotesTrapeziumRule.cs

@ -30,7 +30,6 @@
using System;
using System.Collections.Generic;
using System.Numerics;
using MathNet.Numerics.Properties;
namespace MathNet.Numerics.Integration
{
@ -93,7 +92,7 @@ namespace MathNet.Numerics.Integration
if (numberOfPartitions <= 0)
{
throw new ArgumentOutOfRangeException(nameof(numberOfPartitions), Resources.ArgumentPositive);
throw new ArgumentOutOfRangeException(nameof(numberOfPartitions), "Value must be positive (and not zero).");
}
double step = (intervalEnd - intervalBegin)/numberOfPartitions;
@ -127,7 +126,7 @@ namespace MathNet.Numerics.Integration
if (numberOfPartitions <= 0)
{
throw new ArgumentOutOfRangeException(nameof(numberOfPartitions), Resources.ArgumentPositive);
throw new ArgumentOutOfRangeException(nameof(numberOfPartitions), "Value must be positive (and not zero).");
}
double step = (intervalEnd - intervalBegin) / numberOfPartitions;
@ -143,7 +142,7 @@ namespace MathNet.Numerics.Integration
return step * sum;
}
/// <summary>
/// Adaptive approximation of the definite integral in the provided interval by the trapezium rule.
/// </summary>

5
src/Numerics/Integration/SimpsonRule.cs

@ -28,7 +28,6 @@
// </copyright>
using System;
using MathNet.Numerics.Properties;
namespace MathNet.Numerics.Integration
{
@ -72,12 +71,12 @@ namespace MathNet.Numerics.Integration
if (numberOfPartitions <= 0)
{
throw new ArgumentOutOfRangeException(nameof(numberOfPartitions), Resources.ArgumentPositive);
throw new ArgumentOutOfRangeException(nameof(numberOfPartitions), "Value must be positive (and not zero).");
}
if (numberOfPartitions.IsOdd())
{
throw new ArgumentException(Resources.ArgumentEven, nameof(numberOfPartitions));
throw new ArgumentException("Value must be even.", nameof(numberOfPartitions));
}
double step = (intervalEnd - intervalBegin)/numberOfPartitions;

17
src/Numerics/Interpolation/Barycentric.cs

@ -30,7 +30,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using MathNet.Numerics.Properties;
namespace MathNet.Numerics.Interpolation
{
@ -51,12 +50,12 @@ namespace MathNet.Numerics.Interpolation
{
if (x.Length != y.Length || x.Length != w.Length)
{
throw new ArgumentException(Resources.ArgumentVectorsSameLength);
throw new ArgumentException("All vectors must have the same dimensionality.");
}
if (x.Length < 1)
{
throw new ArgumentException(string.Format(Resources.ArrayTooSmall, 1), nameof(x));
throw new ArgumentException("The given array is too small. It must be at least 1 long.", nameof(x));
}
_x = x;
@ -71,12 +70,12 @@ namespace MathNet.Numerics.Interpolation
{
if (x.Length != y.Length)
{
throw new ArgumentException(Resources.ArgumentVectorsSameLength);
throw new ArgumentException("All vectors must have the same dimensionality.");
}
if (x.Length < 1)
{
throw new ArgumentException(string.Format(Resources.ArrayTooSmall, 1), nameof(x));
throw new ArgumentException("The given array is too small. It must be at least 1 long.", nameof(x));
}
var weights = new double[x.Length];
@ -97,7 +96,7 @@ namespace MathNet.Numerics.Interpolation
{
if (x.Length != y.Length)
{
throw new ArgumentException(Resources.ArgumentVectorsSameLength);
throw new ArgumentException("All vectors must have the same dimensionality.");
}
Sorting.Sort(x, y);
@ -137,12 +136,12 @@ namespace MathNet.Numerics.Interpolation
{
if (x.Length != y.Length)
{
throw new ArgumentException(Resources.ArgumentVectorsSameLength);
throw new ArgumentException("All vectors must have the same dimensionality.");
}
if (x.Length < 1)
{
throw new ArgumentException(string.Format(Resources.ArrayTooSmall, 1), nameof(x));
throw new ArgumentException("The given array is too small. It must be at least 1 long.", nameof(x));
}
if (0 > order || x.Length <= order)
@ -194,7 +193,7 @@ namespace MathNet.Numerics.Interpolation
{
if (x.Length != y.Length)
{
throw new ArgumentException(Resources.ArgumentVectorsSameLength);
throw new ArgumentException("All vectors must have the same dimensionality.");
}
Sorting.Sort(x, y);

7
src/Numerics/Interpolation/BulirschStoerRationalInterpolation.cs

@ -30,7 +30,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using MathNet.Numerics.Properties;
namespace MathNet.Numerics.Interpolation
{
@ -53,12 +52,12 @@ namespace MathNet.Numerics.Interpolation
{
if (x.Length != y.Length)
{
throw new ArgumentException(Resources.ArgumentVectorsSameLength);
throw new ArgumentException("All vectors must have the same dimensionality.");
}
if (x.Length < 1)
{
throw new ArgumentException(string.Format(Resources.ArrayTooSmall, 1), nameof(x));
throw new ArgumentException("The given array is too small. It must be at least 1 long.", nameof(x));
}
_x = x;
@ -81,7 +80,7 @@ namespace MathNet.Numerics.Interpolation
{
if (x.Length != y.Length)
{
throw new ArgumentException(Resources.ArgumentVectorsSameLength);
throw new ArgumentException("All vectors must have the same dimensionality.");
}
Sorting.Sort(x, y);

29
src/Numerics/Interpolation/CubicSpline.cs

@ -30,7 +30,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using MathNet.Numerics.Properties;
namespace MathNet.Numerics.Interpolation
{
@ -56,12 +55,12 @@ namespace MathNet.Numerics.Interpolation
{
if (x.Length != c0.Length + 1 || x.Length != c1.Length + 1 || x.Length != c2.Length + 1 || x.Length != c3.Length + 1)
{
throw new ArgumentException(Resources.ArgumentVectorsSameLength);
throw new ArgumentException("All vectors must have the same dimensionality.");
}
if (x.Length < 2)
{
throw new ArgumentException(string.Format(Resources.ArrayTooSmall, 2), nameof(x));
throw new ArgumentException("The given array is too small. It must be at least 2 long.", nameof(x));
}
_x = x;
@ -79,12 +78,12 @@ namespace MathNet.Numerics.Interpolation
{
if (x.Length != y.Length || x.Length != firstDerivatives.Length)
{
throw new ArgumentException(Resources.ArgumentVectorsSameLength);
throw new ArgumentException("All vectors must have the same dimensionality.");
}
if (x.Length < 2)
{
throw new ArgumentException(string.Format(Resources.ArrayTooSmall, 2), nameof(x));
throw new ArgumentException("The given array is too small. It must be at least 2 long.", nameof(x));
}
var c0 = new double[x.Length - 1];
@ -112,12 +111,12 @@ namespace MathNet.Numerics.Interpolation
{
if (x.Length != y.Length || x.Length != firstDerivatives.Length)
{
throw new ArgumentException(Resources.ArgumentVectorsSameLength);
throw new ArgumentException("All vectors must have the same dimensionality.");
}
if (x.Length < 2)
{
throw new ArgumentException(string.Format(Resources.ArrayTooSmall, 2), nameof(x));
throw new ArgumentException("The given array is too small. It must be at least 2 long.", nameof(x));
}
Sorting.Sort(x, y, firstDerivatives);
@ -141,12 +140,12 @@ namespace MathNet.Numerics.Interpolation
{
if (x.Length != y.Length)
{
throw new ArgumentException(Resources.ArgumentVectorsSameLength);
throw new ArgumentException("All vectors must have the same dimensionality.");
}
if (x.Length < 5)
{
throw new ArgumentException(string.Format(Resources.ArrayTooSmall, 5), nameof(x));
throw new ArgumentException("The given array is too small. It must be at least 5 long.", nameof(x));
}
/* Prepare divided differences (diff) and weights (w) */
@ -194,7 +193,7 @@ namespace MathNet.Numerics.Interpolation
{
if (x.Length != y.Length)
{
throw new ArgumentException(Resources.ArgumentVectorsSameLength);
throw new ArgumentException("All vectors must have the same dimensionality.");
}
Sorting.Sort(x, y);
@ -221,12 +220,12 @@ namespace MathNet.Numerics.Interpolation
{
if (x.Length != y.Length)
{
throw new ArgumentException(Resources.ArgumentVectorsSameLength);
throw new ArgumentException("All vectors must have the same dimensionality.");
}
if (x.Length < 2)
{
throw new ArgumentException(string.Format(Resources.ArrayTooSmall, 2), nameof(x));
throw new ArgumentException("The given array is too small. It must be at least 2 long.", nameof(x));
}
int n = x.Length;
@ -281,7 +280,7 @@ namespace MathNet.Numerics.Interpolation
b[0] = (3*((y[1] - y[0])/(x[1] - x[0]))) - (0.5*leftBoundary*(x[1] - x[0]));
break;
default:
throw new NotSupportedException(Resources.InvalidLeftBoundaryCondition);
throw new NotSupportedException("Invalid Left Boundary Condition.");
}
// Central Conditions
@ -315,7 +314,7 @@ namespace MathNet.Numerics.Interpolation
b[n - 1] = (3*(y[n - 1] - y[n - 2])/(x[n - 1] - x[n - 2])) + (0.5*rightBoundary*(x[n - 1] - x[n - 2]));
break;
default:
throw new NotSupportedException(Resources.InvalidRightBoundaryCondition);
throw new NotSupportedException("Invalid Right Boundary Condition.");
}
// Build Spline
@ -333,7 +332,7 @@ namespace MathNet.Numerics.Interpolation
{
if (x.Length != y.Length)
{
throw new ArgumentException(Resources.ArgumentVectorsSameLength);
throw new ArgumentException("All vectors must have the same dimensionality.");
}
Sorting.Sort(x, y);

11
src/Numerics/Interpolation/LinearSpline.cs

@ -30,7 +30,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using MathNet.Numerics.Properties;
namespace MathNet.Numerics.Interpolation
{
@ -52,12 +51,12 @@ namespace MathNet.Numerics.Interpolation
{
if ((x.Length != c0.Length + 1 && x.Length != c0.Length) || x.Length != c1.Length + 1)
{
throw new ArgumentException(Resources.ArgumentVectorsSameLength);
throw new ArgumentException("All vectors must have the same dimensionality.");
}
if (x.Length < 2)
{
throw new ArgumentException(string.Format(Resources.ArrayTooSmall, 2), nameof(x));
throw new ArgumentException("The given array is too small. It must be at least 2 long.", nameof(x));
}
_x = x;
@ -73,12 +72,12 @@ namespace MathNet.Numerics.Interpolation
{
if (x.Length != y.Length)
{
throw new ArgumentException(Resources.ArgumentVectorsSameLength);
throw new ArgumentException("All vectors must have the same dimensionality.");
}
if (x.Length < 2)
{
throw new ArgumentException(string.Format(Resources.ArrayTooSmall, 2), nameof(x));
throw new ArgumentException("The given array is too small. It must be at least 2 long.", nameof(x));
}
var c1 = new double[x.Length - 1];
@ -98,7 +97,7 @@ namespace MathNet.Numerics.Interpolation
{
if (x.Length != y.Length)
{
throw new ArgumentException(Resources.ArgumentVectorsSameLength);
throw new ArgumentException("All vectors must have the same dimensionality.");
}
Sorting.Sort(x, y);

5
src/Numerics/Interpolation/LogLinear.cs

@ -30,7 +30,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using MathNet.Numerics.Properties;
using MathNet.Numerics.Threading;
namespace MathNet.Numerics.Interpolation
@ -60,7 +59,7 @@ namespace MathNet.Numerics.Interpolation
{
if (x.Length != y.Length)
{
throw new ArgumentException(Resources.ArgumentVectorsSameLength);
throw new ArgumentException("All vectors must have the same dimensionality.");
}
var logy = new double[y.Length];
@ -83,7 +82,7 @@ namespace MathNet.Numerics.Interpolation
{
if (x.Length != y.Length)
{
throw new ArgumentException(Resources.ArgumentVectorsSameLength);
throw new ArgumentException("All vectors must have the same dimensionality.");
}
Sorting.Sort(x, y);

9
src/Numerics/Interpolation/NevillePolynomialInterpolation.cs

@ -30,7 +30,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using MathNet.Numerics.Properties;
namespace MathNet.Numerics.Interpolation
{
@ -58,19 +57,19 @@ namespace MathNet.Numerics.Interpolation
{
if (x.Length != y.Length)
{
throw new ArgumentException(Resources.ArgumentVectorsSameLength);
throw new ArgumentException("All vectors must have the same dimensionality.");
}
if (x.Length < 1)
{
throw new ArgumentException(string.Format(Resources.ArrayTooSmall, 1), nameof(x));
throw new ArgumentException("The given array is too small. It must be at least 1 long.", nameof(x));
}
for (var i = 1; i < x.Length; ++i)
{
if (x[i] == x[i - 1])
{
throw new ArgumentException(Resources.Interpolation_Initialize_SamplePointsNotUnique, nameof(x));
throw new ArgumentException("All sample points should be unique.", nameof(x));
}
}
@ -94,7 +93,7 @@ namespace MathNet.Numerics.Interpolation
{
if (x.Length != y.Length)
{
throw new ArgumentException(Resources.ArgumentVectorsSameLength);
throw new ArgumentException("All vectors must have the same dimensionality.");
}
Sorting.Sort(x, y);

5
src/Numerics/Interpolation/QuadraticSpline.cs

@ -28,7 +28,6 @@
// </copyright>
using System;
using MathNet.Numerics.Properties;
namespace MathNet.Numerics.Interpolation
{
@ -52,12 +51,12 @@ namespace MathNet.Numerics.Interpolation
{
if (x.Length != c0.Length + 1 || x.Length != c1.Length + 1 || x.Length != c2.Length + 1)
{
throw new ArgumentException(Resources.ArgumentVectorsSameLength);
throw new ArgumentException("All vectors must have the same dimensionality.");
}
if (x.Length < 2)
{
throw new ArgumentException(string.Format(Resources.ArrayTooSmall, 2), nameof(x));
throw new ArgumentException("The given array is too small. It must be at least 2 long.", nameof(x));
}
_x = x;

7
src/Numerics/Interpolation/StepInterpolation.cs

@ -30,7 +30,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using MathNet.Numerics.Properties;
namespace MathNet.Numerics.Interpolation
{
@ -52,12 +51,12 @@ namespace MathNet.Numerics.Interpolation
{
if (x.Length != sy.Length)
{
throw new ArgumentException(Resources.ArgumentVectorsSameLength);
throw new ArgumentException("All vectors must have the same dimensionality.");
}
if (x.Length < 1)
{
throw new ArgumentException(string.Format(Resources.ArrayTooSmall, 1), nameof(x));
throw new ArgumentException("The given array is too small. It must be at least 1 long.", nameof(x));
}
_x = x;
@ -81,7 +80,7 @@ namespace MathNet.Numerics.Interpolation
{
if (x.Length != y.Length)
{
throw new ArgumentException(Resources.ArgumentVectorsSameLength);
throw new ArgumentException("All vectors must have the same dimensionality.");
}
Sorting.Sort(x, y);

5
src/Numerics/Interpolation/TransformedInterpolation.cs

@ -30,7 +30,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using MathNet.Numerics.Properties;
using MathNet.Numerics.Threading;
namespace MathNet.Numerics.Interpolation
@ -61,7 +60,7 @@ namespace MathNet.Numerics.Interpolation
{
if (x.Length != y.Length)
{
throw new ArgumentException(Resources.ArgumentVectorsSameLength);
throw new ArgumentException("All vectors must have the same dimensionality.");
}
var yhat = new double[y.Length];
@ -88,7 +87,7 @@ namespace MathNet.Numerics.Interpolation
{
if (x.Length != y.Length)
{
throw new ArgumentException(Resources.ArgumentVectorsSameLength);
throw new ArgumentException("All vectors must have the same dimensionality.");
}
Sorting.Sort(x, y);

3
src/Numerics/LinearAlgebra/Complex/DenseMatrix.cs

@ -35,7 +35,6 @@ using MathNet.Numerics.Distributions;
using MathNet.Numerics.LinearAlgebra.Complex.Factorization;
using MathNet.Numerics.LinearAlgebra.Factorization;
using MathNet.Numerics.LinearAlgebra.Storage;
using MathNet.Numerics.Properties;
using MathNet.Numerics.Providers.LinearAlgebra;
using MathNet.Numerics.Threading;
@ -967,7 +966,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex
{
if (_rowCount != _columnCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSquare);
throw new ArgumentException("Matrix must be square.");
}
var sum = Complex.Zero;

11
src/Numerics/LinearAlgebra/Complex/DiagonalMatrix.cs

@ -33,7 +33,6 @@ using System.Diagnostics;
using System.Linq;
using MathNet.Numerics.Distributions;
using MathNet.Numerics.LinearAlgebra.Storage;
using MathNet.Numerics.Properties;
using MathNet.Numerics.Providers.LinearAlgebra;
using MathNet.Numerics.Threading;
@ -678,7 +677,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex
{
if (RowCount != ColumnCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSquare);
throw new ArgumentException("Matrix must be square.");
}
return _data.Aggregate(Complex.One, (current, t) => current * t);
@ -708,7 +707,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex
{
if (source.Length != _data.Length)
{
throw new ArgumentException(Resources.ArgumentArraysSameLength, nameof(source));
throw new ArgumentException("The array arguments must have the same length.", nameof(source));
}
Array.Copy(source, 0, _data, 0, source.Length);
@ -729,7 +728,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex
{
if (_data.Length != denseSource.Values.Length)
{
throw new ArgumentException(Resources.ArgumentVectorsSameLength, nameof(source));
throw new ArgumentException("All vectors must have the same dimensionality.", nameof(source));
}
Array.Copy(denseSource.Values, 0, _data, 0, denseSource.Values.Length);
@ -791,7 +790,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex
{
if (RowCount != ColumnCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSquare);
throw new ArgumentException("Matrix must be square.");
}
var inverse = (DiagonalMatrix)Clone();
@ -803,7 +802,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex
}
else
{
throw new ArgumentException(Resources.ArgumentMatrixNotSingular);
throw new ArgumentException("Matrix must not be singular.");
}
}

11
src/Numerics/LinearAlgebra/Complex/Factorization/DenseCholesky.cs

@ -28,7 +28,6 @@
// </copyright>
using System;
using MathNet.Numerics.Properties;
using MathNet.Numerics.Providers.LinearAlgebra;
namespace MathNet.Numerics.LinearAlgebra.Complex.Factorization
@ -58,7 +57,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Factorization
{
if (matrix.RowCount != matrix.ColumnCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSquare);
throw new ArgumentException("Matrix must be square.");
}
// Create a new matrix for the Cholesky factor, then perform factorization (while overwriting).
@ -81,12 +80,12 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Factorization
{
if (result.RowCount != input.RowCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSameRowDimension);
throw new ArgumentException("Matrix row dimensions must agree.");
}
if (result.ColumnCount != input.ColumnCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSameColumnDimension);
throw new ArgumentException("Matrix column dimensions must agree.");
}
if (input.RowCount != Factor.RowCount)
@ -118,7 +117,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Factorization
{
if (input.Count != result.Count)
{
throw new ArgumentException(Resources.ArgumentVectorsSameLength);
throw new ArgumentException("All vectors must have the same dimensionality.");
}
if (input.Count != Factor.RowCount)
@ -153,7 +152,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Factorization
{
if (matrix.RowCount != matrix.ColumnCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSquare);
throw new ArgumentException("Matrix must be square.");
}
if (matrix.RowCount != Factor.RowCount || matrix.ColumnCount != Factor.ColumnCount)

15
src/Numerics/LinearAlgebra/Complex/Factorization/DenseEvd.cs

@ -28,7 +28,6 @@
// </copyright>
using System;
using MathNet.Numerics.Properties;
using MathNet.Numerics.Providers.LinearAlgebra;
namespace MathNet.Numerics.LinearAlgebra.Complex.Factorization
@ -64,7 +63,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Factorization
{
if (matrix.RowCount != matrix.ColumnCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSquare);
throw new ArgumentException("Matrix must be square.");
}
var order = matrix.RowCount;
@ -108,19 +107,19 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Factorization
// The solution X should have the same number of columns as B
if (input.ColumnCount != result.ColumnCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSameColumnDimension);
throw new ArgumentException("Matrix column dimensions must agree.");
}
// The dimension compatibility conditions for X = A\B require the two matrices A and B to have the same number of rows
if (EigenValues.Count != input.RowCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSameRowDimension);
throw new ArgumentException("Matrix row dimensions must agree.");
}
// The solution X row dimension is equal to the column dimension of A
if (EigenValues.Count != result.RowCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSameColumnDimension);
throw new ArgumentException("Matrix column dimensions must agree.");
}
if (IsSymmetric)
@ -160,7 +159,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Factorization
}
else
{
throw new ArgumentException(Resources.ArgumentMatrixSymmetric);
throw new ArgumentException("Matrix must be symmetric.");
}
}
@ -175,7 +174,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Factorization
// Check that b is a column vector with m entries
if (EigenValues.Count != input.Count)
{
throw new ArgumentException(Resources.ArgumentVectorsSameLength);
throw new ArgumentException("All vectors must have the same dimensionality.");
}
// Check that x is a column vector with n entries
@ -220,7 +219,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Factorization
}
else
{
throw new ArgumentException(Resources.ArgumentMatrixSymmetric);
throw new ArgumentException("Matrix must be symmetric.");
}
}
}

11
src/Numerics/LinearAlgebra/Complex/Factorization/DenseGramSchmidt.cs

@ -29,7 +29,6 @@
using System;
using MathNet.Numerics.LinearAlgebra.Factorization;
using MathNet.Numerics.Properties;
using MathNet.Numerics.Providers.LinearAlgebra;
namespace MathNet.Numerics.LinearAlgebra.Complex.Factorization
@ -92,7 +91,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Factorization
norm = Math.Sqrt(norm);
if (norm == 0.0)
{
throw new ArgumentException(Resources.ArgumentMatrixNotRankDeficient);
throw new ArgumentException("Matrix must not be rank deficient.");
}
r[(k * columnsQ) + k] = norm;
@ -132,19 +131,19 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Factorization
// The solution X should have the same number of columns as B
if (input.ColumnCount != result.ColumnCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSameColumnDimension);
throw new ArgumentException("Matrix column dimensions must agree.");
}
// The dimension compatibility conditions for X = A\B require the two matrices A and B to have the same number of rows
if (Q.RowCount != input.RowCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSameRowDimension);
throw new ArgumentException("Matrix row dimensions must agree.");
}
// The solution X row dimension is equal to the column dimension of A
if (Q.ColumnCount != result.RowCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSameColumnDimension);
throw new ArgumentException("Matrix column dimensions must agree.");
}
if (input is DenseMatrix dinput && result is DenseMatrix dresult)
@ -168,7 +167,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Factorization
// Check that b is a column vector with m entries
if (Q.RowCount != input.Count)
{
throw new ArgumentException(Resources.ArgumentVectorsSameLength);
throw new ArgumentException("All vectors must have the same dimensionality.");
}
// Check that x is a column vector with n entries

9
src/Numerics/LinearAlgebra/Complex/Factorization/DenseLU.cs

@ -28,7 +28,6 @@
// </copyright>
using System;
using MathNet.Numerics.Properties;
using MathNet.Numerics.Providers.LinearAlgebra;
namespace MathNet.Numerics.LinearAlgebra.Complex.Factorization
@ -61,7 +60,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Factorization
if (matrix.RowCount != matrix.ColumnCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSquare);
throw new ArgumentException("Matrix must be square.");
}
// Create an array for the pivot indices.
@ -100,12 +99,12 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Factorization
// Check for proper dimensions.
if (result.RowCount != input.RowCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSameRowDimension);
throw new ArgumentException("Matrix row dimensions must agree.");
}
if (result.ColumnCount != input.ColumnCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSameColumnDimension);
throw new ArgumentException("Matrix column dimensions must agree.");
}
if (input.RowCount != Factors.RowCount)
@ -149,7 +148,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Factorization
// Check for proper dimensions.
if (input.Count != result.Count)
{
throw new ArgumentException(Resources.ArgumentVectorsSameLength);
throw new ArgumentException("All vectors must have the same dimensionality.");
}
if (input.Count != Factors.RowCount)

9
src/Numerics/LinearAlgebra/Complex/Factorization/DenseQR.cs

@ -29,7 +29,6 @@
using System;
using MathNet.Numerics.LinearAlgebra.Factorization;
using MathNet.Numerics.Properties;
using MathNet.Numerics.Providers.LinearAlgebra;
namespace MathNet.Numerics.LinearAlgebra.Complex.Factorization
@ -103,19 +102,19 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Factorization
// The solution X should have the same number of columns as B
if (input.ColumnCount != result.ColumnCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSameColumnDimension);
throw new ArgumentException("Matrix column dimensions must agree.");
}
// The dimension compatibility conditions for X = A\B require the two matrices A and B to have the same number of rows
if (Q.RowCount != input.RowCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSameRowDimension);
throw new ArgumentException("Matrix row dimensions must agree.");
}
// The solution X row dimension is equal to the column dimension of A
if (FullR.ColumnCount != result.RowCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSameColumnDimension);
throw new ArgumentException("Matrix column dimensions must agree.");
}
if (input is DenseMatrix dinput && result is DenseMatrix dresult)
@ -139,7 +138,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Factorization
// Check that b is a column vector with m entries
if (Q.RowCount != input.Count)
{
throw new ArgumentException(Resources.ArgumentVectorsSameLength);
throw new ArgumentException("All vectors must have the same dimensionality.");
}
// Check that x is a column vector with n entries

13
src/Numerics/LinearAlgebra/Complex/Factorization/DenseSvd.cs

@ -28,7 +28,6 @@
// </copyright>
using System;
using MathNet.Numerics.Properties;
using MathNet.Numerics.Providers.LinearAlgebra;
namespace MathNet.Numerics.LinearAlgebra.Complex.Factorization
@ -84,25 +83,25 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Factorization
{
if (!VectorsComputed)
{
throw new InvalidOperationException(Resources.SingularVectorsNotComputed);
throw new InvalidOperationException("The singular vectors were not computed.");
}
// The solution X should have the same number of columns as B
if (input.ColumnCount != result.ColumnCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSameColumnDimension);
throw new ArgumentException("Matrix column dimensions must agree.");
}
// The dimension compatibility conditions for X = A\B require the two matrices A and B to have the same number of rows
if (U.RowCount != input.RowCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSameRowDimension);
throw new ArgumentException("Matrix row dimensions must agree.");
}
// The solution X row dimension is equal to the column dimension of A
if (VT.ColumnCount != result.RowCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSameColumnDimension);
throw new ArgumentException("Matrix column dimensions must agree.");
}
if (input is DenseMatrix dinput && result is DenseMatrix dresult)
@ -124,14 +123,14 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Factorization
{
if (!VectorsComputed)
{
throw new InvalidOperationException(Resources.SingularVectorsNotComputed);
throw new InvalidOperationException("The singular vectors were not computed.");
}
// Ax=b where A is an m x n matrix
// Check that b is a column vector with m entries
if (U.RowCount != input.Count)
{
throw new ArgumentException(Resources.ArgumentVectorsSameLength);
throw new ArgumentException("All vectors must have the same dimensionality.");
}
// Check that x is a column vector with n entries

3
src/Numerics/LinearAlgebra/Complex/Factorization/GramSchmidt.cs

@ -29,7 +29,6 @@
using System;
using MathNet.Numerics.LinearAlgebra.Factorization;
using MathNet.Numerics.Properties;
namespace MathNet.Numerics.LinearAlgebra.Complex.Factorization
{
@ -58,7 +57,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Factorization
{
if (FullR.RowCount != FullR.ColumnCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSquare);
throw new ArgumentException("Matrix must be square.");
}
var det = Complex.One;

3
src/Numerics/LinearAlgebra/Complex/Factorization/QR.cs

@ -29,7 +29,6 @@
using System;
using MathNet.Numerics.LinearAlgebra.Factorization;
using MathNet.Numerics.Properties;
namespace MathNet.Numerics.LinearAlgebra.Complex.Factorization
{
@ -63,7 +62,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Factorization
{
if (FullR.RowCount != FullR.ColumnCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSquare);
throw new ArgumentException("Matrix must be square.");
}
var det = Complex.One;

3
src/Numerics/LinearAlgebra/Complex/Factorization/Svd.cs

@ -30,7 +30,6 @@
using System;
using System.Linq;
using MathNet.Numerics.LinearAlgebra.Factorization;
using MathNet.Numerics.Properties;
namespace MathNet.Numerics.LinearAlgebra.Complex.Factorization
{
@ -98,7 +97,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Factorization
{
if (U.RowCount != VT.ColumnCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSquare);
throw new ArgumentException("Matrix must be square.");
}
var det = Complex.One;

11
src/Numerics/LinearAlgebra/Complex/Factorization/UserCholesky.cs

@ -28,7 +28,6 @@
// </copyright>
using System;
using MathNet.Numerics.Properties;
using MathNet.Numerics.Threading;
namespace MathNet.Numerics.LinearAlgebra.Complex.Factorization
@ -57,7 +56,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Factorization
{
if (factor.RowCount != factor.ColumnCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSquare);
throw new ArgumentException("Matrix must be square.");
}
// Create a new matrix for the Cholesky factor, then perform factorization (while overwriting).
@ -88,7 +87,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Factorization
}
else
{
throw new ArgumentException(Resources.ArgumentMatrixPositiveDefinite);
throw new ArgumentException("Matrix must be positive definite.");
}
for (var i = ij + 1; i < factor.RowCount; i++)
@ -182,12 +181,12 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Factorization
{
if (result.RowCount != input.RowCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSameRowDimension);
throw new ArgumentException("Matrix row dimensions must agree.");
}
if (result.ColumnCount != input.ColumnCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSameColumnDimension);
throw new ArgumentException("Matrix column dimensions must agree.");
}
if (input.RowCount != Factor.RowCount)
@ -236,7 +235,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Factorization
{
if (input.Count != result.Count)
{
throw new ArgumentException(Resources.ArgumentVectorsSameLength);
throw new ArgumentException("All vectors must have the same dimensionality.");
}
if (input.Count != Factor.RowCount)

15
src/Numerics/LinearAlgebra/Complex/Factorization/UserEvd.cs

@ -28,7 +28,6 @@
// </copyright>
using System;
using MathNet.Numerics.Properties;
namespace MathNet.Numerics.LinearAlgebra.Complex.Factorization
{
@ -63,7 +62,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Factorization
{
if (matrix.RowCount != matrix.ColumnCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSquare);
throw new ArgumentException("Matrix must be square.");
}
var order = matrix.RowCount;
@ -820,19 +819,19 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Factorization
// The solution X should have the same number of columns as B
if (input.ColumnCount != result.ColumnCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSameColumnDimension);
throw new ArgumentException("Matrix column dimensions must agree.");
}
// The dimension compatibility conditions for X = A\B require the two matrices A and B to have the same number of rows
if (EigenValues.Count != input.RowCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSameRowDimension);
throw new ArgumentException("Matrix row dimensions must agree.");
}
// The solution X row dimension is equal to the column dimension of A
if (EigenValues.Count != result.RowCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSameColumnDimension);
throw new ArgumentException("Matrix column dimensions must agree.");
}
if (IsSymmetric)
@ -872,7 +871,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Factorization
}
else
{
throw new ArgumentException(Resources.ArgumentMatrixSymmetric);
throw new ArgumentException("Matrix must be symmetric.");
}
}
@ -887,7 +886,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Factorization
// Check that b is a column vector with m entries
if (EigenValues.Count != input.Count)
{
throw new ArgumentException(Resources.ArgumentVectorsSameLength);
throw new ArgumentException("All vectors must have the same dimensionality.");
}
// Check that x is a column vector with n entries
@ -932,7 +931,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Factorization
}
else
{
throw new ArgumentException(Resources.ArgumentMatrixSymmetric);
throw new ArgumentException("Matrix must be symmetric.");
}
}
}

11
src/Numerics/LinearAlgebra/Complex/Factorization/UserGramSchmidt.cs

@ -28,7 +28,6 @@
// </copyright>
using System;
using MathNet.Numerics.Properties;
namespace MathNet.Numerics.LinearAlgebra.Complex.Factorization
{
@ -66,7 +65,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Factorization
var norm = q.Column(k).L2Norm();
if (norm == 0.0)
{
throw new ArgumentException(Resources.ArgumentMatrixNotRankDeficient);
throw new ArgumentException("Matrix must not be rank deficient.");
}
r.At(k, k, norm);
@ -110,19 +109,19 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Factorization
// The solution X should have the same number of columns as B
if (input.ColumnCount != result.ColumnCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSameColumnDimension);
throw new ArgumentException("Matrix column dimensions must agree.");
}
// The dimension compatibility conditions for X = A\B require the two matrices A and B to have the same number of rows
if (Q.RowCount != input.RowCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSameRowDimension);
throw new ArgumentException("Matrix row dimensions must agree.");
}
// The solution X row dimension is equal to the column dimension of A
if (Q.ColumnCount != result.RowCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSameColumnDimension);
throw new ArgumentException("Matrix column dimensions must agree.");
}
var inputCopy = input.Clone();
@ -185,7 +184,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Factorization
// Check that b is a column vector with m entries
if (Q.RowCount != input.Count)
{
throw new ArgumentException(Resources.ArgumentVectorsSameLength);
throw new ArgumentException("All vectors must have the same dimensionality.");
}
// Check that x is a column vector with n entries

9
src/Numerics/LinearAlgebra/Complex/Factorization/UserLU.cs

@ -28,7 +28,6 @@
// </copyright>
using System;
using MathNet.Numerics.Properties;
namespace MathNet.Numerics.LinearAlgebra.Complex.Factorization
{
@ -60,7 +59,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Factorization
if (matrix.RowCount != matrix.ColumnCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSquare);
throw new ArgumentException("Matrix must be square.");
}
// Create an array for the pivot indices.
@ -158,12 +157,12 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Factorization
// Check for proper dimensions.
if (result.RowCount != input.RowCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSameRowDimension);
throw new ArgumentException("Matrix row dimensions must agree.");
}
if (result.ColumnCount != input.ColumnCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSameColumnDimension);
throw new ArgumentException("Matrix column dimensions must agree.");
}
if (input.RowCount != Factors.RowCount)
@ -244,7 +243,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Factorization
// Check for proper dimensions.
if (input.Count != result.Count)
{
throw new ArgumentException(Resources.ArgumentVectorsSameLength);
throw new ArgumentException("All vectors must have the same dimensionality.");
}
if (input.Count != Factors.RowCount)

9
src/Numerics/LinearAlgebra/Complex/Factorization/UserQR.cs

@ -30,7 +30,6 @@
using System;
using System.Linq;
using MathNet.Numerics.LinearAlgebra.Factorization;
using MathNet.Numerics.Properties;
using MathNet.Numerics.Threading;
namespace MathNet.Numerics.LinearAlgebra.Complex.Factorization
@ -228,19 +227,19 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Factorization
// The solution X should have the same number of columns as B
if (input.ColumnCount != result.ColumnCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSameColumnDimension);
throw new ArgumentException("Matrix column dimensions must agree.");
}
// The dimension compatibility conditions for X = A\B require the two matrices A and B to have the same number of rows
if (FullR.RowCount != input.RowCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSameRowDimension);
throw new ArgumentException("Matrix row dimensions must agree.");
}
// The solution X row dimension is equal to the column dimension of A
if (FullR.ColumnCount != result.RowCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSameColumnDimension);
throw new ArgumentException("Matrix column dimensions must agree.");
}
var inputCopy = input.Clone();
@ -303,7 +302,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Factorization
// Check that b is a column vector with m entries
if (FullR.RowCount != input.Count)
{
throw new ArgumentException(Resources.ArgumentVectorsSameLength);
throw new ArgumentException("All vectors must have the same dimensionality.");
}
// Check that x is a column vector with n entries

13
src/Numerics/LinearAlgebra/Complex/Factorization/UserSvd.cs

@ -28,7 +28,6 @@
// </copyright>
using System;
using MathNet.Numerics.Properties;
namespace MathNet.Numerics.LinearAlgebra.Complex.Factorization
{
@ -804,25 +803,25 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Factorization
{
if (!VectorsComputed)
{
throw new InvalidOperationException(Resources.SingularVectorsNotComputed);
throw new InvalidOperationException("The singular vectors were not computed.");
}
// The solution X should have the same number of columns as B
if (input.ColumnCount != result.ColumnCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSameColumnDimension);
throw new ArgumentException("Matrix column dimensions must agree.");
}
// The dimension compatibility conditions for X = A\B require the two matrices A and B to have the same number of rows
if (U.RowCount != input.RowCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSameRowDimension);
throw new ArgumentException("Matrix row dimensions must agree.");
}
// The solution X row dimension is equal to the column dimension of A
if (VT.ColumnCount != result.RowCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSameColumnDimension);
throw new ArgumentException("Matrix column dimensions must agree.");
}
var mn = Math.Min(U.RowCount, VT.ColumnCount);
@ -870,14 +869,14 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Factorization
{
if (!VectorsComputed)
{
throw new InvalidOperationException(Resources.SingularVectorsNotComputed);
throw new InvalidOperationException("The singular vectors were not computed.");
}
// Ax=b where A is an m x n matrix
// Check that b is a column vector with m entries
if (U.RowCount != input.Count)
{
throw new ArgumentException(Resources.ArgumentVectorsSameLength);
throw new ArgumentException("All vectors must have the same dimensionality.");
}
// Check that x is a column vector with n entries

7
src/Numerics/LinearAlgebra/Complex/Matrix.cs

@ -31,7 +31,6 @@ using System;
using MathNet.Numerics.LinearAlgebra.Complex.Factorization;
using MathNet.Numerics.LinearAlgebra.Factorization;
using MathNet.Numerics.LinearAlgebra.Storage;
using MathNet.Numerics.Properties;
namespace MathNet.Numerics.LinearAlgebra.Complex
{
@ -551,7 +550,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex
{
if (RowCount != ColumnCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSquare);
throw new ArgumentException("Matrix must be square.");
}
var sum = Complex.Zero;
@ -661,7 +660,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex
{
if (norm <= 0.0)
{
throw new ArgumentOutOfRangeException(nameof(norm), Resources.ArgumentMustBePositive);
throw new ArgumentOutOfRangeException(nameof(norm), "Value must be positive.");
}
var ret = new double[RowCount];
@ -693,7 +692,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex
{
if (norm <= 0.0)
{
throw new ArgumentOutOfRangeException(nameof(norm), Resources.ArgumentMustBePositive);
throw new ArgumentOutOfRangeException(nameof(norm), "Value must be positive.");
}
var ret = new double[ColumnCount];

5
src/Numerics/LinearAlgebra/Complex/Solvers/BiCgStab.cs

@ -29,7 +29,6 @@
using System;
using MathNet.Numerics.LinearAlgebra.Solvers;
using MathNet.Numerics.Properties;
namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers
{
@ -98,12 +97,12 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers
{
if (matrix.RowCount != matrix.ColumnCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSquare, nameof(matrix));
throw new ArgumentException("Matrix must be square.", nameof(matrix));
}
if (result.Count != input.Count)
{
throw new ArgumentException(Resources.ArgumentVectorsSameLength);
throw new ArgumentException("All vectors must have the same dimensionality.");
}
if (input.Count != matrix.RowCount)

5
src/Numerics/LinearAlgebra/Complex/Solvers/CompositeSolver.cs

@ -31,7 +31,6 @@ using System;
using System.Collections.Generic;
using System.Linq;
using MathNet.Numerics.LinearAlgebra.Solvers;
using MathNet.Numerics.Properties;
namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers
{
@ -77,12 +76,12 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers
{
if (matrix.RowCount != matrix.ColumnCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSquare, nameof(matrix));
throw new ArgumentException("Matrix must be square.", nameof(matrix));
}
if (result.Count != input.Count)
{
throw new ArgumentException(Resources.ArgumentVectorsSameLength);
throw new ArgumentException("All vectors must have the same dimensionality.");
}
if (iterator == null)

7
src/Numerics/LinearAlgebra/Complex/Solvers/DiagonalPreconditioner.cs

@ -29,7 +29,6 @@
using System;
using MathNet.Numerics.LinearAlgebra.Solvers;
using MathNet.Numerics.Properties;
namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers
{
@ -72,7 +71,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers
{
if (matrix.RowCount != matrix.ColumnCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSquare, nameof(matrix));
throw new ArgumentException("Matrix must be square.", nameof(matrix));
}
_inverseDiagonals = new Complex[matrix.RowCount];
@ -91,12 +90,12 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers
{
if (_inverseDiagonals == null)
{
throw new ArgumentException(Resources.ArgumentMatrixDoesNotExist);
throw new ArgumentException("The requested matrix does not exist.");
}
if ((lhs.Count != rhs.Count) || (lhs.Count != _inverseDiagonals.Length))
{
throw new ArgumentException(Resources.ArgumentVectorsSameLength, nameof(rhs));
throw new ArgumentException("All vectors must have the same dimensionality.", nameof(rhs));
}
for (var i = 0; i < _inverseDiagonals.Length; i++)

3
src/Numerics/LinearAlgebra/Complex/Solvers/GpBiCg.cs

@ -29,7 +29,6 @@
using System;
using MathNet.Numerics.LinearAlgebra.Solvers;
using MathNet.Numerics.Properties;
namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers
{
@ -161,7 +160,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers
{
if (matrix.RowCount != matrix.ColumnCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSquare, nameof(matrix));
throw new ArgumentException("Matrix must be square.", nameof(matrix));
}
if (input.Count != matrix.RowCount || result.Count != input.Count)

7
src/Numerics/LinearAlgebra/Complex/Solvers/ILU0Preconditioner.cs

@ -29,7 +29,6 @@
using System;
using MathNet.Numerics.LinearAlgebra.Solvers;
using MathNet.Numerics.Properties;
namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers
{
@ -110,7 +109,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers
if (matrix.RowCount != matrix.ColumnCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSquare, nameof(matrix));
throw new ArgumentException("Matrix must be square.", nameof(matrix));
}
_decompositionLU = SparseMatrix.OfMatrix(matrix);
@ -167,12 +166,12 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers
{
if (_decompositionLU == null)
{
throw new ArgumentException(Resources.ArgumentMatrixDoesNotExist);
throw new ArgumentException("The requested matrix does not exist.");
}
if ((lhs.Count != rhs.Count) || (lhs.Count != _decompositionLU.RowCount))
{
throw new ArgumentException(Resources.ArgumentVectorsSameLength);
throw new ArgumentException("All vectors must have the same dimensionality.");
}
// Solve:

7
src/Numerics/LinearAlgebra/Complex/Solvers/ILUTPPreconditioner.cs

@ -30,7 +30,6 @@
using System;
using System.Collections.Generic;
using MathNet.Numerics.LinearAlgebra.Solvers;
using MathNet.Numerics.Properties;
namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers
{
@ -300,7 +299,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers
if (matrix.RowCount != matrix.ColumnCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSquare, nameof(matrix));
throw new ArgumentException("Matrix must be square.", nameof(matrix));
}
var sparseMatrix = matrix as SparseMatrix ?? SparseMatrix.OfMatrix(matrix);
@ -612,12 +611,12 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers
{
if (_upper == null)
{
throw new ArgumentException(Resources.ArgumentMatrixDoesNotExist);
throw new ArgumentException("The requested matrix does not exist.");
}
if ((lhs.Count != rhs.Count) || (lhs.Count != _upper.RowCount))
{
throw new ArgumentException(Resources.ArgumentVectorsSameLength, nameof(rhs));
throw new ArgumentException("All vectors must have the same dimensionality.", nameof(rhs));
}
// Solve equation here

9
src/Numerics/LinearAlgebra/Complex/Solvers/MILU0Preconditioner.cs

@ -30,7 +30,6 @@
using System;
using MathNet.Numerics.LinearAlgebra.Solvers;
using MathNet.Numerics.LinearAlgebra.Storage;
using MathNet.Numerics.Properties;
namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers
{
@ -86,14 +85,14 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers
var csr = matrix.Storage as SparseCompressedRowMatrixStorage<Complex>;
if (csr == null)
{
throw new ArgumentException(Resources.MatrixMustBeSparse, nameof(matrix));
throw new ArgumentException("Matrix must be in sparse storage format", nameof(matrix));
}
// Dimension of matrix
int n = csr.RowCount;
if (n != csr.ColumnCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSquare, nameof(matrix));
throw new ArgumentException("Matrix must be square.", nameof(matrix));
}
// Original matrix compressed sparse row storage.
@ -123,12 +122,12 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers
{
if (_alu == null)
{
throw new ArgumentException(Resources.ArgumentMatrixDoesNotExist);
throw new ArgumentException("The requested matrix does not exist.");
}
if ((result.Count != input.Count) || (result.Count != _diag.Length))
{
throw new ArgumentException(Resources.ArgumentVectorsSameLength);
throw new ArgumentException("All vectors must have the same dimensionality.");
}
int n = _diag.Length;

3
src/Numerics/LinearAlgebra/Complex/Solvers/MlkBiCgStab.cs

@ -33,7 +33,6 @@ using System.Diagnostics;
using System.Linq;
using MathNet.Numerics.Distributions;
using MathNet.Numerics.LinearAlgebra.Solvers;
using MathNet.Numerics.Properties;
namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers
{
@ -247,7 +246,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers
{
if (matrix.RowCount != matrix.ColumnCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSquare, nameof(matrix));
throw new ArgumentException("Matrix must be square.", nameof(matrix));
}
if (input.Count != matrix.RowCount || result.Count != input.Count)

3
src/Numerics/LinearAlgebra/Complex/Solvers/TFQMR.cs

@ -29,7 +29,6 @@
using System;
using MathNet.Numerics.LinearAlgebra.Solvers;
using MathNet.Numerics.Properties;
namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers
{
@ -94,7 +93,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers
{
if (matrix.RowCount != matrix.ColumnCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSquare, nameof(matrix));
throw new ArgumentException("Matrix must be square.", nameof(matrix));
}
if (input.Count != matrix.RowCount || result.Count != input.Count)

3
src/Numerics/LinearAlgebra/Complex32/DenseMatrix.cs

@ -35,7 +35,6 @@ using MathNet.Numerics.Distributions;
using MathNet.Numerics.LinearAlgebra.Complex32.Factorization;
using MathNet.Numerics.LinearAlgebra.Factorization;
using MathNet.Numerics.LinearAlgebra.Storage;
using MathNet.Numerics.Properties;
using MathNet.Numerics.Providers.LinearAlgebra;
using MathNet.Numerics.Threading;
@ -968,7 +967,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32
{
if (_rowCount != _columnCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSquare);
throw new ArgumentException("Matrix must be square.");
}
var sum = Complex32.Zero;

11
src/Numerics/LinearAlgebra/Complex32/DiagonalMatrix.cs

@ -33,7 +33,6 @@ using System.Diagnostics;
using System.Linq;
using MathNet.Numerics.Distributions;
using MathNet.Numerics.LinearAlgebra.Storage;
using MathNet.Numerics.Properties;
using MathNet.Numerics.Providers.LinearAlgebra;
using MathNet.Numerics.Threading;
@ -677,7 +676,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32
{
if (RowCount != ColumnCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSquare);
throw new ArgumentException("Matrix must be square.");
}
return _data.Aggregate(Complex32.One, (current, t) => current * t);
@ -707,7 +706,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32
{
if (source.Length != _data.Length)
{
throw new ArgumentException(Resources.ArgumentArraysSameLength, nameof(source));
throw new ArgumentException("The array arguments must have the same length.", nameof(source));
}
Array.Copy(source, 0, _data, 0, source.Length);
@ -728,7 +727,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32
{
if (_data.Length != denseSource.Values.Length)
{
throw new ArgumentException(Resources.ArgumentVectorsSameLength, nameof(source));
throw new ArgumentException("All vectors must have the same dimensionality.", nameof(source));
}
Array.Copy(denseSource.Values, 0, _data, 0, denseSource.Values.Length);
@ -790,7 +789,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32
{
if (RowCount != ColumnCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSquare);
throw new ArgumentException("Matrix must be square.");
}
var inverse = (DiagonalMatrix)Clone();
@ -802,7 +801,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32
}
else
{
throw new ArgumentException(Resources.ArgumentMatrixNotSingular);
throw new ArgumentException("Matrix must not be singular.");
}
}

11
src/Numerics/LinearAlgebra/Complex32/Factorization/DenseCholesky.cs

@ -28,7 +28,6 @@
// </copyright>
using System;
using MathNet.Numerics.Properties;
using MathNet.Numerics.Providers.LinearAlgebra;
namespace MathNet.Numerics.LinearAlgebra.Complex32.Factorization
@ -58,7 +57,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Factorization
{
if (matrix.RowCount != matrix.ColumnCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSquare);
throw new ArgumentException("Matrix must be square.");
}
// Create a new matrix for the Cholesky factor, then perform factorization (while overwriting).
@ -81,12 +80,12 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Factorization
{
if (result.RowCount != input.RowCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSameRowDimension);
throw new ArgumentException("Matrix row dimensions must agree.");
}
if (result.ColumnCount != input.ColumnCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSameColumnDimension);
throw new ArgumentException("Matrix column dimensions must agree.");
}
if (input.RowCount != Factor.RowCount)
@ -118,7 +117,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Factorization
{
if (input.Count != result.Count)
{
throw new ArgumentException(Resources.ArgumentVectorsSameLength);
throw new ArgumentException("All vectors must have the same dimensionality.");
}
if (input.Count != Factor.RowCount)
@ -153,7 +152,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Factorization
{
if (matrix.RowCount != matrix.ColumnCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSquare);
throw new ArgumentException("Matrix must be square.");
}
if (matrix.RowCount != Factor.RowCount || matrix.ColumnCount != Factor.ColumnCount)

17
src/Numerics/LinearAlgebra/Complex32/Factorization/DenseEvd.cs

@ -28,7 +28,6 @@
// </copyright>
using System;
using MathNet.Numerics.Properties;
using MathNet.Numerics.Providers.LinearAlgebra;
namespace MathNet.Numerics.LinearAlgebra.Complex32.Factorization
@ -65,7 +64,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Factorization
{
if (matrix.RowCount != matrix.ColumnCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSquare);
throw new ArgumentException("Matrix must be square.");
}
var order = matrix.RowCount;
@ -109,19 +108,19 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Factorization
// The solution X should have the same number of columns as B
if (input.ColumnCount != result.ColumnCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSameColumnDimension);
throw new ArgumentException("Matrix column dimensions must agree.");
}
// The dimension compatibility conditions for X = A\B require the two matrices A and B to have the same number of rows
if (EigenValues.Count != input.RowCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSameRowDimension);
throw new ArgumentException("Matrix row dimensions must agree.");
}
// The solution X row dimension is equal to the column dimension of A
if (EigenValues.Count != result.RowCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSameColumnDimension);
throw new ArgumentException("Matrix column dimensions must agree.");
}
if (IsSymmetric)
@ -161,7 +160,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Factorization
}
else
{
throw new ArgumentException(Resources.ArgumentMatrixSymmetric);
throw new ArgumentException("Matrix must be symmetric.");
}
}
@ -176,13 +175,13 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Factorization
// Check that b is a column vector with m entries
if (EigenValues.Count != input.Count)
{
throw new ArgumentException(Resources.ArgumentVectorsSameLength);
throw new ArgumentException("All vectors must have the same dimensionality.");
}
// Check that x is a column vector with n entries
if (EigenValues.Count != result.Count)
{
throw new ArgumentException(Resources.ArgumentMatrixDimensions);
throw new ArgumentException("Matrix dimensions must agree.");
}
if (IsSymmetric)
@ -221,7 +220,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Factorization
}
else
{
throw new ArgumentException(Resources.ArgumentMatrixSymmetric);
throw new ArgumentException("Matrix must be symmetric.");
}
}
}

11
src/Numerics/LinearAlgebra/Complex32/Factorization/DenseGramSchmidt.cs

@ -29,7 +29,6 @@
using System;
using MathNet.Numerics.LinearAlgebra.Factorization;
using MathNet.Numerics.Properties;
using MathNet.Numerics.Providers.LinearAlgebra;
namespace MathNet.Numerics.LinearAlgebra.Complex32.Factorization
@ -92,7 +91,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Factorization
norm = (float)Math.Sqrt(norm);
if (norm == 0.0f)
{
throw new ArgumentException(Resources.ArgumentMatrixNotRankDeficient);
throw new ArgumentException("Matrix must not be rank deficient.");
}
r[(k * columnsQ) + k] = norm;
@ -132,19 +131,19 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Factorization
// The solution X should have the same number of columns as B
if (input.ColumnCount != result.ColumnCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSameColumnDimension);
throw new ArgumentException("Matrix column dimensions must agree.");
}
// The dimension compatibility conditions for X = A\B require the two matrices A and B to have the same number of rows
if (Q.RowCount != input.RowCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSameRowDimension);
throw new ArgumentException("Matrix row dimensions must agree.");
}
// The solution X row dimension is equal to the column dimension of A
if (Q.ColumnCount != result.RowCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSameColumnDimension);
throw new ArgumentException("Matrix column dimensions must agree.");
}
if (input is DenseMatrix dinput && result is DenseMatrix dresult)
@ -168,7 +167,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Factorization
// Check that b is a column vector with m entries
if (Q.RowCount != input.Count)
{
throw new ArgumentException(Resources.ArgumentVectorsSameLength);
throw new ArgumentException("All vectors must have the same dimensionality.");
}
// Check that x is a column vector with n entries

9
src/Numerics/LinearAlgebra/Complex32/Factorization/DenseLU.cs

@ -28,7 +28,6 @@
// </copyright>
using System;
using MathNet.Numerics.Properties;
using MathNet.Numerics.Providers.LinearAlgebra;
namespace MathNet.Numerics.LinearAlgebra.Complex32.Factorization
@ -61,7 +60,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Factorization
if (matrix.RowCount != matrix.ColumnCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSquare);
throw new ArgumentException("Matrix must be square.");
}
// Create an array for the pivot indices.
@ -100,12 +99,12 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Factorization
// Check for proper dimensions.
if (result.RowCount != input.RowCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSameRowDimension);
throw new ArgumentException("Matrix row dimensions must agree.");
}
if (result.ColumnCount != input.ColumnCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSameColumnDimension);
throw new ArgumentException("Matrix column dimensions must agree.");
}
if (input.RowCount != Factors.RowCount)
@ -149,7 +148,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Factorization
// Check for proper dimensions.
if (input.Count != result.Count)
{
throw new ArgumentException(Resources.ArgumentVectorsSameLength);
throw new ArgumentException("All vectors must have the same dimensionality.");
}
if (input.Count != Factors.RowCount)

9
src/Numerics/LinearAlgebra/Complex32/Factorization/DenseQR.cs

@ -29,7 +29,6 @@
using System;
using MathNet.Numerics.LinearAlgebra.Factorization;
using MathNet.Numerics.Properties;
using MathNet.Numerics.Providers.LinearAlgebra;
namespace MathNet.Numerics.LinearAlgebra.Complex32.Factorization
@ -103,19 +102,19 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Factorization
// The solution X should have the same number of columns as B
if (input.ColumnCount != result.ColumnCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSameColumnDimension);
throw new ArgumentException("Matrix column dimensions must agree.");
}
// The dimension compatibility conditions for X = A\B require the two matrices A and B to have the same number of rows
if (Q.RowCount != input.RowCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSameRowDimension);
throw new ArgumentException("Matrix row dimensions must agree.");
}
// The solution X row dimension is equal to the column dimension of A
if (FullR.ColumnCount != result.RowCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSameColumnDimension);
throw new ArgumentException("Matrix column dimensions must agree.");
}
if (input is DenseMatrix dinput && result is DenseMatrix dresult)
@ -139,7 +138,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Factorization
// Check that b is a column vector with m entries
if (Q.RowCount != input.Count)
{
throw new ArgumentException(Resources.ArgumentVectorsSameLength);
throw new ArgumentException("All vectors must have the same dimensionality.");
}
// Check that x is a column vector with n entries

13
src/Numerics/LinearAlgebra/Complex32/Factorization/DenseSvd.cs

@ -28,7 +28,6 @@
// </copyright>
using System;
using MathNet.Numerics.Properties;
using MathNet.Numerics.Providers.LinearAlgebra;
namespace MathNet.Numerics.LinearAlgebra.Complex32.Factorization
@ -84,25 +83,25 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Factorization
{
if (!VectorsComputed)
{
throw new InvalidOperationException(Resources.SingularVectorsNotComputed);
throw new InvalidOperationException("The singular vectors were not computed.");
}
// The solution X should have the same number of columns as B
if (input.ColumnCount != result.ColumnCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSameColumnDimension);
throw new ArgumentException("Matrix column dimensions must agree.");
}
// The dimension compatibility conditions for X = A\B require the two matrices A and B to have the same number of rows
if (U.RowCount != input.RowCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSameRowDimension);
throw new ArgumentException("Matrix row dimensions must agree.");
}
// The solution X row dimension is equal to the column dimension of A
if (VT.ColumnCount != result.RowCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSameColumnDimension);
throw new ArgumentException("Matrix column dimensions must agree.");
}
if (input is DenseMatrix dinput && result is DenseMatrix dresult)
@ -124,14 +123,14 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Factorization
{
if (!VectorsComputed)
{
throw new InvalidOperationException(Resources.SingularVectorsNotComputed);
throw new InvalidOperationException("The singular vectors were not computed.");
}
// Ax=b where A is an m x n matrix
// Check that b is a column vector with m entries
if (U.RowCount != input.Count)
{
throw new ArgumentException(Resources.ArgumentVectorsSameLength);
throw new ArgumentException("All vectors must have the same dimensionality.");
}
// Check that x is a column vector with n entries

3
src/Numerics/LinearAlgebra/Complex32/Factorization/GramSchmidt.cs

@ -29,7 +29,6 @@
using System;
using MathNet.Numerics.LinearAlgebra.Factorization;
using MathNet.Numerics.Properties;
namespace MathNet.Numerics.LinearAlgebra.Complex32.Factorization
{
@ -58,7 +57,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Factorization
{
if (FullR.RowCount != FullR.ColumnCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSquare);
throw new ArgumentException("Matrix must be square.");
}
var det = Complex32.One;

3
src/Numerics/LinearAlgebra/Complex32/Factorization/QR.cs

@ -29,7 +29,6 @@
using System;
using MathNet.Numerics.LinearAlgebra.Factorization;
using MathNet.Numerics.Properties;
namespace MathNet.Numerics.LinearAlgebra.Complex32.Factorization
{
@ -63,7 +62,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Factorization
{
if (FullR.RowCount != FullR.ColumnCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSquare);
throw new ArgumentException("Matrix must be square.");
}
var det = Complex32.One;

3
src/Numerics/LinearAlgebra/Complex32/Factorization/Svd.cs

@ -30,7 +30,6 @@
using System;
using System.Linq;
using MathNet.Numerics.LinearAlgebra.Factorization;
using MathNet.Numerics.Properties;
namespace MathNet.Numerics.LinearAlgebra.Complex32.Factorization
{
@ -98,7 +97,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Factorization
{
if (U.RowCount != VT.ColumnCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSquare);
throw new ArgumentException("Matrix must be square.");
}
var det = Complex32.One;

Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save