Browse Source

Cleanup: use nameof where appropriate

pull/587/merge
Christoph Ruegg 8 years ago
parent
commit
968d079805
  1. 2
      MathNet.Numerics.sln.DotSettings
  2. 6
      src/Numerics.Tests/LinearAlgebraTests/MatrixHelpers.cs
  3. 36
      src/Numerics/Combinatorics.cs
  4. 6
      src/Numerics/Compatibility.cs
  5. 2
      src/Numerics/Complex32.cs
  6. 2
      src/Numerics/ComplexExtensions.cs
  7. 6
      src/Numerics/Differentiation/FiniteDifferenceCoefficients.cs
  8. 10
      src/Numerics/Differentiation/NumericalDerivative.cs
  9. 12
      src/Numerics/Distance.cs
  10. 8
      src/Numerics/Distributions/Categorical.cs
  11. 2
      src/Numerics/Distributions/Dirichlet.cs
  12. 2
      src/Numerics/Distributions/InverseWishart.cs
  13. 10
      src/Numerics/Distributions/Multinomial.cs
  14. 16
      src/Numerics/Euclid.cs
  15. 4
      src/Numerics/ExcelFunctions.cs
  16. 6
      src/Numerics/Financial/AbsoluteReturnMeasures.cs
  17. 14
      src/Numerics/Financial/AbsoluteRiskMeasures.cs
  18. 44
      src/Numerics/Generate.cs
  19. 8
      src/Numerics/GoodnessOfFit.cs
  20. 14
      src/Numerics/Integration/NewtonCotesTrapeziumRule.cs
  21. 8
      src/Numerics/Integration/SimpsonRule.cs
  22. 8
      src/Numerics/Interpolation/Barycentric.cs
  23. 2
      src/Numerics/Interpolation/BulirschStoerRationalInterpolation.cs
  24. 10
      src/Numerics/Interpolation/CubicSpline.cs
  25. 4
      src/Numerics/Interpolation/LinearSpline.cs
  26. 4
      src/Numerics/Interpolation/NevillePolynomialInterpolation.cs
  27. 2
      src/Numerics/Interpolation/QuadraticSpline.cs
  28. 2
      src/Numerics/Interpolation/StepInterpolation.cs
  29. 4
      src/Numerics/LinearAlgebra/Builder.cs
  30. 26
      src/Numerics/LinearAlgebra/Complex/DenseMatrix.cs
  31. 24
      src/Numerics/LinearAlgebra/Complex/DenseVector.cs
  32. 4
      src/Numerics/LinearAlgebra/Complex/DiagonalMatrix.cs
  33. 10
      src/Numerics/LinearAlgebra/Complex/Factorization/DenseLU.cs
  34. 10
      src/Numerics/LinearAlgebra/Complex/Factorization/UserLU.cs
  35. 4
      src/Numerics/LinearAlgebra/Complex/Matrix.cs
  36. 2
      src/Numerics/LinearAlgebra/Complex/Solvers/BiCgStab.cs
  37. 2
      src/Numerics/LinearAlgebra/Complex/Solvers/CompositeSolver.cs
  38. 4
      src/Numerics/LinearAlgebra/Complex/Solvers/DiagonalPreconditioner.cs
  39. 6
      src/Numerics/LinearAlgebra/Complex/Solvers/GpBiCg.cs
  40. 4
      src/Numerics/LinearAlgebra/Complex/Solvers/ILU0Preconditioner.cs
  41. 18
      src/Numerics/LinearAlgebra/Complex/Solvers/ILUTPPreconditioner.cs
  42. 4
      src/Numerics/LinearAlgebra/Complex/Solvers/MILU0Preconditioner.cs
  43. 4
      src/Numerics/LinearAlgebra/Complex/Solvers/MlkBiCgStab.cs
  44. 2
      src/Numerics/LinearAlgebra/Complex/Solvers/TFQMR.cs
  45. 38
      src/Numerics/LinearAlgebra/Complex/SparseMatrix.cs
  46. 20
      src/Numerics/LinearAlgebra/Complex/SparseVector.cs
  47. 4
      src/Numerics/LinearAlgebra/Complex/Vector.cs
  48. 26
      src/Numerics/LinearAlgebra/Complex32/DenseMatrix.cs
  49. 24
      src/Numerics/LinearAlgebra/Complex32/DenseVector.cs
  50. 4
      src/Numerics/LinearAlgebra/Complex32/DiagonalMatrix.cs
  51. 10
      src/Numerics/LinearAlgebra/Complex32/Factorization/DenseLU.cs
  52. 10
      src/Numerics/LinearAlgebra/Complex32/Factorization/UserLU.cs
  53. 4
      src/Numerics/LinearAlgebra/Complex32/Matrix.cs
  54. 2
      src/Numerics/LinearAlgebra/Complex32/Solvers/BiCgStab.cs
  55. 2
      src/Numerics/LinearAlgebra/Complex32/Solvers/CompositeSolver.cs
  56. 4
      src/Numerics/LinearAlgebra/Complex32/Solvers/DiagonalPreconditioner.cs
  57. 6
      src/Numerics/LinearAlgebra/Complex32/Solvers/GpBiCg.cs
  58. 4
      src/Numerics/LinearAlgebra/Complex32/Solvers/ILU0Preconditioner.cs
  59. 18
      src/Numerics/LinearAlgebra/Complex32/Solvers/ILUTPPreconditioner.cs
  60. 4
      src/Numerics/LinearAlgebra/Complex32/Solvers/MILU0Preconditioner.cs
  61. 4
      src/Numerics/LinearAlgebra/Complex32/Solvers/MlkBiCgStab.cs
  62. 2
      src/Numerics/LinearAlgebra/Complex32/Solvers/TFQMR.cs
  63. 38
      src/Numerics/LinearAlgebra/Complex32/SparseMatrix.cs
  64. 20
      src/Numerics/LinearAlgebra/Complex32/SparseVector.cs
  65. 4
      src/Numerics/LinearAlgebra/Complex32/Vector.cs
  66. 26
      src/Numerics/LinearAlgebra/Double/DenseMatrix.cs
  67. 30
      src/Numerics/LinearAlgebra/Double/DenseVector.cs
  68. 4
      src/Numerics/LinearAlgebra/Double/DiagonalMatrix.cs
  69. 10
      src/Numerics/LinearAlgebra/Double/Factorization/DenseLU.cs
  70. 10
      src/Numerics/LinearAlgebra/Double/Factorization/UserLU.cs
  71. 4
      src/Numerics/LinearAlgebra/Double/Matrix.cs
  72. 2
      src/Numerics/LinearAlgebra/Double/Solvers/BiCgStab.cs
  73. 2
      src/Numerics/LinearAlgebra/Double/Solvers/CompositeSolver.cs
  74. 4
      src/Numerics/LinearAlgebra/Double/Solvers/DiagonalPreconditioner.cs
  75. 6
      src/Numerics/LinearAlgebra/Double/Solvers/GpBiCg.cs
  76. 4
      src/Numerics/LinearAlgebra/Double/Solvers/ILU0Preconditioner.cs
  77. 18
      src/Numerics/LinearAlgebra/Double/Solvers/ILUTPPreconditioner.cs
  78. 4
      src/Numerics/LinearAlgebra/Double/Solvers/MILU0Preconditioner.cs
  79. 4
      src/Numerics/LinearAlgebra/Double/Solvers/MlkBiCgStab.cs
  80. 2
      src/Numerics/LinearAlgebra/Double/Solvers/TFQMR.cs
  81. 38
      src/Numerics/LinearAlgebra/Double/SparseMatrix.cs
  82. 20
      src/Numerics/LinearAlgebra/Double/SparseVector.cs
  83. 4
      src/Numerics/LinearAlgebra/Double/Vector.cs
  84. 12
      src/Numerics/LinearAlgebra/Matrix.Arithmetic.cs
  85. 88
      src/Numerics/LinearAlgebra/Matrix.cs
  86. 26
      src/Numerics/LinearAlgebra/Single/DenseMatrix.cs
  87. 26
      src/Numerics/LinearAlgebra/Single/DenseVector.cs
  88. 4
      src/Numerics/LinearAlgebra/Single/DiagonalMatrix.cs
  89. 10
      src/Numerics/LinearAlgebra/Single/Factorization/DenseLU.cs
  90. 10
      src/Numerics/LinearAlgebra/Single/Factorization/UserLU.cs
  91. 4
      src/Numerics/LinearAlgebra/Single/Matrix.cs
  92. 2
      src/Numerics/LinearAlgebra/Single/Solvers/BiCgStab.cs
  93. 2
      src/Numerics/LinearAlgebra/Single/Solvers/CompositeSolver.cs
  94. 4
      src/Numerics/LinearAlgebra/Single/Solvers/DiagonalPreconditioner.cs
  95. 6
      src/Numerics/LinearAlgebra/Single/Solvers/GpBiCg.cs
  96. 4
      src/Numerics/LinearAlgebra/Single/Solvers/ILU0Preconditioner.cs
  97. 18
      src/Numerics/LinearAlgebra/Single/Solvers/ILUTPPreconditioner.cs
  98. 4
      src/Numerics/LinearAlgebra/Single/Solvers/MILU0Preconditioner.cs
  99. 4
      src/Numerics/LinearAlgebra/Single/Solvers/MlkBiCgStab.cs
  100. 2
      src/Numerics/LinearAlgebra/Single/Solvers/TFQMR.cs

2
MathNet.Numerics.sln.DotSettings

@ -82,6 +82,8 @@ OTHER DEALINGS IN THE SOFTWARE.
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EMigrateBlankLinesAroundFieldToBlankLinesAroundProperty/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EMigrateThisQualifierSettings/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Chebychev/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Cholesky/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=NONINFRINGEMENT/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Numerics/@EntryIndexedValue">True</s:Boolean>
</wpf:ResourceDictionary>

6
src/Numerics.Tests/LinearAlgebraTests/MatrixHelpers.cs

@ -48,7 +48,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests
{
if (matrix.RowCount != matrix.ColumnCount)
{
throw new ArgumentException("matrix must be square.", "matrix");
throw new ArgumentException("matrix must be square.", nameof(matrix));
}
for (var row = 0; row < matrix.RowCount; row++)
{
@ -68,7 +68,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests
{
if (matrix.RowCount != matrix.ColumnCount)
{
throw new ArgumentException("matrix must be square.", "matrix");
throw new ArgumentException("matrix must be square.", nameof(matrix));
}
for (var row = 0; row < matrix.RowCount; row++)
{
@ -88,7 +88,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests
{
if (matrix.RowCount != matrix.ColumnCount)
{
throw new ArgumentException("matrix must be square.", "matrix");
throw new ArgumentException("matrix must be square.", nameof(matrix));
}
for (var row = 0; row < matrix.RowCount; row++)
{

36
src/Numerics/Combinatorics.cs

@ -134,7 +134,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("n", Resources.ArgumentNotNegative);
if (n < 0) throw new ArgumentOutOfRangeException(nameof(n), Resources.ArgumentNotNegative);
int[] indices = new int[n];
for (int i = 0; i < indices.Length; i++)
@ -194,7 +194,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("n", Resources.ArgumentNotNegative);
if (n < 0) throw new ArgumentOutOfRangeException(nameof(n), Resources.ArgumentNotNegative);
var random = randomSource ?? SystemRandomSource.Default;
@ -216,9 +216,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("n", Resources.ArgumentNotNegative);
if (k < 0) throw new ArgumentOutOfRangeException("k", Resources.ArgumentNotNegative);
if (k > n) throw new ArgumentOutOfRangeException("k", string.Format(Resources.ArgumentOutOfRangeSmallerEqual, "k", "n"));
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"));
var random = randomSource ?? SystemRandomSource.Default;
@ -261,8 +261,8 @@ namespace MathNet.Numerics
{
T[] array = data as T[] ?? data.ToArray();
if (elementsToChoose < 0) throw new ArgumentOutOfRangeException("elementsToChoose", Resources.ArgumentNotNegative);
if (elementsToChoose > array.Length) throw new ArgumentOutOfRangeException("elementsToChoose", string.Format(Resources.ArgumentOutOfRangeSmallerEqual, "elementsToChoose", "data.Count"));
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"));
bool[] mask = GenerateCombination(array.Length, elementsToChoose, randomSource);
@ -284,8 +284,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("n", Resources.ArgumentNotNegative);
if (k < 0) throw new ArgumentOutOfRangeException("k", Resources.ArgumentNotNegative);
if (n < 0) throw new ArgumentOutOfRangeException(nameof(n), Resources.ArgumentNotNegative);
if (k < 0) throw new ArgumentOutOfRangeException(nameof(k), Resources.ArgumentNotNegative);
var random = randomSource ?? SystemRandomSource.Default;
@ -307,7 +307,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("elementsToChoose", Resources.ArgumentNotNegative);
if (elementsToChoose < 0) throw new ArgumentOutOfRangeException(nameof(elementsToChoose), Resources.ArgumentNotNegative);
T[] array = data as T[] ?? data.ToArray();
int[] mask = GenerateCombinationWithRepetition(array.Length, elementsToChoose, randomSource);
@ -331,9 +331,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("n", Resources.ArgumentNotNegative);
if (k < 0) throw new ArgumentOutOfRangeException("k", Resources.ArgumentNotNegative);
if (k > n) throw new ArgumentOutOfRangeException("k", string.Format(Resources.ArgumentOutOfRangeSmallerEqual, "k", "n"));
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"));
var random = randomSource ?? SystemRandomSource.Default;
@ -368,8 +368,8 @@ namespace MathNet.Numerics
var random = randomSource ?? SystemRandomSource.Default;
T[] array = data.ToArray();
if (elementsToChoose < 0) throw new ArgumentOutOfRangeException("elementsToChoose", Resources.ArgumentNotNegative);
if (elementsToChoose > array.Length) throw new ArgumentOutOfRangeException("elementsToChoose", string.Format(Resources.ArgumentOutOfRangeSmallerEqual, "elementsToChoose", "data.Count"));
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"));
// Partial Fisher-Yates Shuffling
for (int i = array.Length - 1; i >= array.Length - elementsToChoose; i--)
@ -389,8 +389,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("n", Resources.ArgumentNotNegative);
if (k < 0) throw new ArgumentOutOfRangeException("k", Resources.ArgumentNotNegative);
if (n < 0) throw new ArgumentOutOfRangeException(nameof(n), Resources.ArgumentNotNegative);
if (k < 0) throw new ArgumentOutOfRangeException(nameof(k), Resources.ArgumentNotNegative);
var random = randomSource ?? SystemRandomSource.Default;
@ -408,7 +408,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("elementsToChoose", Resources.ArgumentNotNegative);
if (elementsToChoose < 0) throw new ArgumentOutOfRangeException(nameof(elementsToChoose), Resources.ArgumentNotNegative);
T[] array = data as T[] ?? data.ToArray();
int[] indices = GenerateVariationWithRepetition(array.Length, elementsToChoose, randomSource);

6
src/Numerics/Compatibility.cs

@ -27,8 +27,8 @@ namespace MathNet.Numerics
public static IEnumerable<Tuple<int, int>> Create(int fromInclusive, int toExclusive, int rangeSize)
{
if (toExclusive <= fromInclusive) throw new ArgumentOutOfRangeException("toExclusive");
if (rangeSize <= 0) throw new ArgumentOutOfRangeException("rangeSize");
if (toExclusive <= fromInclusive) throw new ArgumentOutOfRangeException(nameof(toExclusive));
if (rangeSize <= 0) throw new ArgumentOutOfRangeException(nameof(rangeSize));
return CreateRanges(fromInclusive, toExclusive, rangeSize);
}
@ -102,7 +102,7 @@ namespace MathNet.Numerics
var action = actions[i];
if (action == null)
{
throw new ArgumentException(String.Format(Properties.Resources.ArgumentItemNull, "actions"), "actions");
throw new ArgumentException(String.Format(Properties.Resources.ArgumentItemNull, nameof(actions)), "actions");
}
tasks[i] = Task.Factory.StartNew(action, parallelOptions.CancellationToken, TaskCreationOptions.None, parallelOptions.TaskScheduler);

2
src/Numerics/Complex32.cs

@ -895,7 +895,7 @@ namespace MathNet.Numerics
{
if (value == null)
{
throw new ArgumentNullException("value");
throw new ArgumentNullException(nameof(value));
}
value = value.Trim();

2
src/Numerics/ComplexExtensions.cs

@ -472,7 +472,7 @@ namespace MathNet.Numerics
{
if (value == null)
{
throw new ArgumentNullException("value");
throw new ArgumentNullException(nameof(value));
}
value = value.Trim();

6
src/Numerics/Differentiation/FiniteDifferenceCoefficients.cs

@ -79,9 +79,9 @@ namespace MathNet.Numerics.Differentiation
public double[] GetCoefficients(int center, int order)
{
if (center >= _coefficients.Length)
throw new ArgumentOutOfRangeException("center", "Center position must be within the point range.");
throw new ArgumentOutOfRangeException(nameof(center), "Center position must be within the point range.");
if (order >= _coefficients.Length)
throw new ArgumentOutOfRangeException("order", "Maximum difference order is points-1.");
throw new ArgumentOutOfRangeException(nameof(order), "Maximum difference order is points-1.");
// Return proper row
var columns = _coefficients[center].GetLength(1);
@ -99,7 +99,7 @@ namespace MathNet.Numerics.Differentiation
public double[,] GetCoefficientsForAllOrders(int center)
{
if (center >= _coefficients.Length)
throw new ArgumentOutOfRangeException("center", "Center position must be within the point range.");
throw new ArgumentOutOfRangeException(nameof(center), "Center position must be within the point range.");
return _coefficients[center];
}

10
src/Numerics/Differentiation/NumericalDerivative.cs

@ -91,7 +91,7 @@ namespace MathNet.Numerics.Differentiation
{
if (points < 2)
{
throw new ArgumentOutOfRangeException("points", "Points must be two or greater.");
throw new ArgumentOutOfRangeException(nameof(points), "Points must be two or greater.");
}
_center = center;
@ -158,7 +158,7 @@ namespace MathNet.Numerics.Differentiation
set
{
if (value >= _points || value < 0)
throw new ArgumentOutOfRangeException("value", "Center must lie between 0 and points -1");
throw new ArgumentOutOfRangeException(nameof(value), "Center must lie between 0 and points -1");
_center = value;
}
}
@ -189,10 +189,10 @@ namespace MathNet.Numerics.Differentiation
public double EvaluateDerivative(double[] points, int order, double stepSize)
{
if (points == null)
throw new ArgumentNullException("points");
throw new ArgumentNullException(nameof(points));
if (order >= _points || order < 0)
throw new ArgumentOutOfRangeException("order", "Order must be between zero and points-1.");
throw new ArgumentOutOfRangeException(nameof(order), "Order must be between zero and points-1.");
var c = _coefficients.GetCoefficients(Center, order);
var result = c.Select((t, i) => t*points[i]).Sum();
@ -347,7 +347,7 @@ namespace MathNet.Numerics.Differentiation
int order, double? currentValue = null)
{
if (parameterIndex.Length != order)
throw new ArgumentOutOfRangeException("parameterIndex",
throw new ArgumentOutOfRangeException(nameof(parameterIndex),
"The number of parameters must match derivative order.");
if (order == 1)

12
src/Numerics/Distance.cs

@ -293,7 +293,7 @@ namespace MathNet.Numerics
if (p < 0d)
{
throw new ArgumentOutOfRangeException("p");
throw new ArgumentOutOfRangeException(nameof(p));
}
if (p == 1d)
@ -331,7 +331,7 @@ namespace MathNet.Numerics
if (p < 0d)
{
throw new ArgumentOutOfRangeException("p");
throw new ArgumentOutOfRangeException(nameof(p));
}
if (p == 1d)
@ -487,12 +487,12 @@ namespace MathNet.Numerics
if (a == null)
{
throw new ArgumentNullException("a");
throw new ArgumentNullException(nameof(a));
}
if (b == null)
{
throw new ArgumentNullException("b");
throw new ArgumentNullException(nameof(b));
}
if (a.Length != b.Length)
@ -533,12 +533,12 @@ namespace MathNet.Numerics
if (a == null)
{
throw new ArgumentNullException("a");
throw new ArgumentNullException(nameof(a));
}
if (b == null)
{
throw new ArgumentNullException("b");
throw new ArgumentNullException(nameof(b));
}
if (a.Length != b.Length)

8
src/Numerics/Distributions/Categorical.cs

@ -112,7 +112,7 @@ namespace MathNet.Numerics.Distributions
{
if (histogram == null)
{
throw new ArgumentNullException("histogram");
throw new ArgumentNullException(nameof(histogram));
}
// The probability distribution vector.
@ -386,7 +386,7 @@ namespace MathNet.Numerics.Distributions
{
if (probability < 0.0 || probability > 1.0 || double.IsNaN(probability))
{
throw new ArgumentOutOfRangeException("probability");
throw new ArgumentOutOfRangeException(nameof(probability));
}
var denormalizedProbability = probability*_cdfUnnormalized[_cdfUnnormalized.Length - 1];
@ -484,7 +484,7 @@ namespace MathNet.Numerics.Distributions
if (probability < 0.0 || probability > 1.0 || double.IsNaN(probability))
{
throw new ArgumentOutOfRangeException("probability");
throw new ArgumentOutOfRangeException(nameof(probability));
}
var cdfUnnormalized = ProbabilityMassToCumulativeDistribution(probabilityMass);
@ -514,7 +514,7 @@ namespace MathNet.Numerics.Distributions
if (probability < 0.0 || probability > 1.0 || double.IsNaN(probability))
{
throw new ArgumentOutOfRangeException("probability");
throw new ArgumentOutOfRangeException(nameof(probability));
}
var denormalizedProbability = probability*cdfUnnormalized[cdfUnnormalized.Length - 1];

2
src/Numerics/Distributions/Dirichlet.cs

@ -263,7 +263,7 @@ namespace MathNet.Numerics.Distributions
{
if (x == null)
{
throw new ArgumentNullException("x");
throw new ArgumentNullException(nameof(x));
}
var shortVersion = x.Length == (_alpha.Length - 1);

2
src/Numerics/Distributions/InverseWishart.cs

@ -196,7 +196,7 @@ namespace MathNet.Numerics.Distributions
if (x.RowCount != p || x.ColumnCount != p)
{
throw new ArgumentOutOfRangeException("x", Resources.ArgumentMatrixDimensions);
throw new ArgumentOutOfRangeException(nameof(x), Resources.ArgumentMatrixDimensions);
}
var chol = x.Cholesky();

10
src/Numerics/Distributions/Multinomial.cs

@ -114,7 +114,7 @@ namespace MathNet.Numerics.Distributions
{
if (h == null)
{
throw new ArgumentNullException("h");
throw new ArgumentNullException(nameof(h));
}
// The probability distribution vector.
@ -254,12 +254,12 @@ namespace MathNet.Numerics.Distributions
{
if (null == x)
{
throw new ArgumentNullException("x");
throw new ArgumentNullException(nameof(x));
}
if (x.Length != _p.Length)
{
throw new ArgumentException(Resources.ArgumentVectorsSameLength, "x");
throw new ArgumentException(Resources.ArgumentVectorsSameLength, nameof(x));
}
if (x.Sum() == _trials)
@ -288,12 +288,12 @@ namespace MathNet.Numerics.Distributions
{
if (null == x)
{
throw new ArgumentNullException("x");
throw new ArgumentNullException(nameof(x));
}
if (x.Length != _p.Length)
{
throw new ArgumentException(Resources.ArgumentVectorsSameLength, "x");
throw new ArgumentException(Resources.ArgumentVectorsSameLength, nameof(x));
}
if (x.Sum() == _trials)

16
src/Numerics/Euclid.cs

@ -291,7 +291,7 @@ namespace MathNet.Numerics
{
if (exponent < 0 || exponent >= 31)
{
throw new ArgumentOutOfRangeException("exponent");
throw new ArgumentOutOfRangeException(nameof(exponent));
}
return 1 << exponent;
@ -307,7 +307,7 @@ namespace MathNet.Numerics
{
if (exponent < 0 || exponent >= 63)
{
throw new ArgumentOutOfRangeException("exponent");
throw new ArgumentOutOfRangeException(nameof(exponent));
}
return ((long)1) << (int)exponent;
@ -351,7 +351,7 @@ namespace MathNet.Numerics
const int maxPowerOfTwo = 0x40000000;
if (number > maxPowerOfTwo)
{
throw new ArgumentOutOfRangeException("number");
throw new ArgumentOutOfRangeException(nameof(number));
}
number--;
@ -380,7 +380,7 @@ namespace MathNet.Numerics
const long maxPowerOfTwo = 0x4000000000000000;
if (number > maxPowerOfTwo)
{
throw new ArgumentOutOfRangeException("number");
throw new ArgumentOutOfRangeException(nameof(number));
}
number--;
@ -421,7 +421,7 @@ namespace MathNet.Numerics
{
if (null == integers)
{
throw new ArgumentNullException("integers");
throw new ArgumentNullException(nameof(integers));
}
if (integers.Count == 0)
@ -527,7 +527,7 @@ namespace MathNet.Numerics
{
if (null == integers)
{
throw new ArgumentNullException("integers");
throw new ArgumentNullException(nameof(integers));
}
if (integers.Count == 0)
@ -575,7 +575,7 @@ namespace MathNet.Numerics
{
if (null == integers)
{
throw new ArgumentNullException("integers");
throw new ArgumentNullException(nameof(integers));
}
if (integers.Count == 0)
@ -676,7 +676,7 @@ namespace MathNet.Numerics
{
if (null == integers)
{
throw new ArgumentNullException("integers");
throw new ArgumentNullException(nameof(integers));
}
if (integers.Count == 0)

4
src/Numerics/ExcelFunctions.cs

@ -81,7 +81,7 @@ namespace MathNet.Numerics
case 2:
return 1d - StudentT.CDF(0d, 1d, degreesFreedom, x) + StudentT.CDF(0d, 1d, degreesFreedom, -x);
default:
throw new ArgumentOutOfRangeException("tails");
throw new ArgumentOutOfRangeException(nameof(tails));
}
}
@ -143,7 +143,7 @@ namespace MathNet.Numerics
case 4:
return ArrayStatistics.Maximum(array);
default:
throw new ArgumentOutOfRangeException("quant");
throw new ArgumentOutOfRangeException(nameof(quant));
}
}

6
src/Numerics/Financial/AbsoluteReturnMeasures.cs

@ -43,7 +43,7 @@ namespace MathNet.Numerics.Financial
{
if (data == null)
{
throw new ArgumentNullException("data");
throw new ArgumentNullException(nameof(data));
}
int count = 0;
@ -67,7 +67,7 @@ namespace MathNet.Numerics.Financial
{
if (data == null)
{
throw new ArgumentNullException("data");
throw new ArgumentNullException(nameof(data));
}
return data.Where(x => x >= 0).Mean();
@ -83,7 +83,7 @@ namespace MathNet.Numerics.Financial
{
if (data == null)
{
throw new ArgumentNullException("data");
throw new ArgumentNullException(nameof(data));
}
return data.Where(x => x < 0).Mean();

14
src/Numerics/Financial/AbsoluteRiskMeasures.cs

@ -43,7 +43,7 @@ namespace MathNet.Numerics.Financial
// Kurtosis
/// <summary>
/// Calculation is similar to Standard Deviation , except it calculates an average (mean) return only for periods with a gain
/// Calculation is similar to Standard Deviation , except it calculates an average (mean) return only for periods with a gain
/// and measures the variation of only the gain periods around the gain mean. Measures the volatility of upside performance.
/// © Copyright 1996, 1999 Gary L.Gastineau. First Edition. © 1992 Swiss Bank Corporation.
/// </summary>
@ -51,14 +51,14 @@ namespace MathNet.Numerics.Financial
{
if (data == null)
{
throw new ArgumentNullException("data");
throw new ArgumentNullException(nameof(data));
}
return data.Where(x => x >= 0).StandardDeviation();
}
/// <summary>
/// Similar to standard deviation, except this statistic calculates an average (mean) return for only the periods with a loss and then
/// Similar to standard deviation, except this statistic calculates an average (mean) return for only the periods with a loss and then
/// measures the variation of only the losing periods around this loss mean. This statistic measures the volatility of downside performance.
/// </summary>
/// <remarks>http://www.offshore-library.com/kb/statistics.php</remarks>
@ -66,7 +66,7 @@ namespace MathNet.Numerics.Financial
{
if (data == null)
{
throw new ArgumentNullException("data");
throw new ArgumentNullException(nameof(data));
}
return data.Where(x => x < 0).StandardDeviation();
@ -83,7 +83,7 @@ namespace MathNet.Numerics.Financial
{
if (data == null)
{
throw new ArgumentNullException("data");
throw new ArgumentNullException(nameof(data));
}
return data.Where(x => x < minimalAcceptableReturn).StandardDeviation();
@ -97,7 +97,7 @@ namespace MathNet.Numerics.Financial
{
if (data == null)
{
throw new ArgumentNullException("data");
throw new ArgumentNullException(nameof(data));
}
var mean = data.Mean();
@ -113,7 +113,7 @@ namespace MathNet.Numerics.Financial
{
if (data == null)
{
throw new ArgumentNullException("data");
throw new ArgumentNullException(nameof(data));
}
var gains = data.Where(x => x >= 0);

44
src/Numerics/Generate.cs

@ -68,7 +68,7 @@ namespace MathNet.Numerics
{
if (pointsA.Length != pointsB.Length)
{
throw new ArgumentException(Resources.ArgumentArraysSameLength, "pointsB");
throw new ArgumentException(Resources.ArgumentArraysSameLength, nameof(pointsB));
}
var res = new T[pointsA.Length];
@ -95,7 +95,7 @@ namespace MathNet.Numerics
{
if (length < 0)
{
throw new ArgumentOutOfRangeException("length");
throw new ArgumentOutOfRangeException(nameof(length));
}
if (length == 0) return new double[0];
@ -119,7 +119,7 @@ namespace MathNet.Numerics
{
if (length < 0)
{
throw new ArgumentOutOfRangeException("length");
throw new ArgumentOutOfRangeException(nameof(length));
}
if (length == 0) return new T[0];
@ -144,7 +144,7 @@ namespace MathNet.Numerics
{
if (length < 0)
{
throw new ArgumentOutOfRangeException("length");
throw new ArgumentOutOfRangeException(nameof(length));
}
if (length == 0) return new double[0];
@ -168,7 +168,7 @@ namespace MathNet.Numerics
{
if (length < 0)
{
throw new ArgumentOutOfRangeException("length");
throw new ArgumentOutOfRangeException(nameof(length));
}
if (length == 0) return new T[0];
@ -335,7 +335,7 @@ namespace MathNet.Numerics
{
if (length < 0)
{
throw new ArgumentOutOfRangeException("length");
throw new ArgumentOutOfRangeException(nameof(length));
}
double step = frequency/samplingRate*amplitude;
@ -371,7 +371,7 @@ namespace MathNet.Numerics
{
if (length < 0)
{
throw new ArgumentOutOfRangeException("length");
throw new ArgumentOutOfRangeException(nameof(length));
}
double step = frequency/samplingRate*amplitude;
@ -464,7 +464,7 @@ namespace MathNet.Numerics
{
if (length < 0)
{
throw new ArgumentOutOfRangeException("length");
throw new ArgumentOutOfRangeException(nameof(length));
}
double step = frequency/samplingRate*Constants.Pi2;
@ -602,7 +602,7 @@ namespace MathNet.Numerics
{
if (length < 0)
{
throw new ArgumentOutOfRangeException("length");
throw new ArgumentOutOfRangeException(nameof(length));
}
var data = new T[length];
@ -638,7 +638,7 @@ namespace MathNet.Numerics
{
if (length < 0)
{
throw new ArgumentOutOfRangeException("length");
throw new ArgumentOutOfRangeException(nameof(length));
}
var data = new double[length];
@ -677,7 +677,7 @@ namespace MathNet.Numerics
{
if (length < 0)
{
throw new ArgumentOutOfRangeException("length");
throw new ArgumentOutOfRangeException(nameof(length));
}
var data = new double[length];
@ -722,7 +722,7 @@ namespace MathNet.Numerics
{
if (length < 0)
{
throw new ArgumentOutOfRangeException("length");
throw new ArgumentOutOfRangeException(nameof(length));
}
var data = new double[length];
@ -768,7 +768,7 @@ namespace MathNet.Numerics
{
if (length < 0)
{
throw new ArgumentOutOfRangeException("length");
throw new ArgumentOutOfRangeException(nameof(length));
}
var data = new T[length];
@ -801,7 +801,7 @@ namespace MathNet.Numerics
{
if (length < 0)
{
throw new ArgumentOutOfRangeException("length");
throw new ArgumentOutOfRangeException(nameof(length));
}
var data = new BigInteger[length];
@ -849,7 +849,7 @@ namespace MathNet.Numerics
{
if (length < 0)
{
throw new ArgumentOutOfRangeException("length");
throw new ArgumentOutOfRangeException(nameof(length));
}
return SystemRandomSource.FastDoubles(length);
@ -873,7 +873,7 @@ namespace MathNet.Numerics
{
if (length < 0)
{
throw new ArgumentOutOfRangeException("length");
throw new ArgumentOutOfRangeException(nameof(length));
}
var samples = SystemRandomSource.FastDoubles(length);
@ -897,7 +897,7 @@ namespace MathNet.Numerics
{
if (length < 0)
{
throw new ArgumentOutOfRangeException("length");
throw new ArgumentOutOfRangeException(nameof(length));
}
var samples1 = SystemRandomSource.FastDoubles(length);
@ -947,7 +947,7 @@ namespace MathNet.Numerics
{
if (length < 0)
{
throw new ArgumentOutOfRangeException("length");
throw new ArgumentOutOfRangeException(nameof(length));
}
var samples = new double[length];
@ -970,7 +970,7 @@ namespace MathNet.Numerics
{
if (length < 0)
{
throw new ArgumentOutOfRangeException("length");
throw new ArgumentOutOfRangeException(nameof(length));
}
var samples = new double[length];
@ -993,7 +993,7 @@ namespace MathNet.Numerics
{
if (length < 0)
{
throw new ArgumentOutOfRangeException("length");
throw new ArgumentOutOfRangeException(nameof(length));
}
var samples = new double[length];
@ -1048,7 +1048,7 @@ namespace MathNet.Numerics
{
if (length < 0)
{
throw new ArgumentOutOfRangeException("length");
throw new ArgumentOutOfRangeException(nameof(length));
}
var samples = new double[length];
@ -1071,7 +1071,7 @@ namespace MathNet.Numerics
{
if (length < 0)
{
throw new ArgumentOutOfRangeException("length");
throw new ArgumentOutOfRangeException(nameof(length));
}
var samples1 = new double[length];

8
src/Numerics/GoodnessOfFit.cs

@ -94,7 +94,7 @@ namespace MathNet.Numerics
{
if (!ieO.MoveNext())
{
throw new ArgumentOutOfRangeException("modelledValues", Resources.ArgumentArraysSameLength);
throw new ArgumentOutOfRangeException(nameof(modelledValues), Resources.ArgumentArraysSameLength);
}
double currentM = ieM.Current;
double currentO = ieO.Current;
@ -105,7 +105,7 @@ namespace MathNet.Numerics
if (degreesOfFreedom >= n)
{
throw new ArgumentOutOfRangeException("degreesOfFreedom", Resources.DegreesOfFreedomMustBeLessThanSampleSize);
throw new ArgumentOutOfRangeException(nameof(degreesOfFreedom), Resources.DegreesOfFreedomMustBeLessThanSampleSize);
}
return Math.Sqrt(accumulator / (n - degreesOfFreedom));
}
@ -135,7 +135,7 @@ namespace MathNet.Numerics
{
if (!ieF.MoveNext())
{
throw new ArgumentOutOfRangeException("modelledValues", Resources.ArgumentArraysSameLength);
throw new ArgumentOutOfRangeException(nameof(modelledValues), Resources.ArgumentArraysSameLength);
}
double currentY = ieY.Current;
@ -165,7 +165,7 @@ namespace MathNet.Numerics
if (ieF.MoveNext())
{
throw new ArgumentOutOfRangeException("observedValues", Resources.ArgumentArraysSameLength);
throw new ArgumentOutOfRangeException(nameof(observedValues), Resources.ArgumentArraysSameLength);
}
}
return 1 - ssRes/ssTot;

14
src/Numerics/Integration/NewtonCotesTrapeziumRule.cs

@ -52,7 +52,7 @@ namespace MathNet.Numerics.Integration
{
if (f == null)
{
throw new ArgumentNullException("f");
throw new ArgumentNullException(nameof(f));
}
return (intervalEnd - intervalBegin)/2*(f(intervalBegin) + f(intervalEnd));
@ -70,12 +70,12 @@ namespace MathNet.Numerics.Integration
{
if (f == null)
{
throw new ArgumentNullException("f");
throw new ArgumentNullException(nameof(f));
}
if (numberOfPartitions <= 0)
{
throw new ArgumentOutOfRangeException("numberOfPartitions", Resources.ArgumentPositive);
throw new ArgumentOutOfRangeException(nameof(numberOfPartitions), Resources.ArgumentPositive);
}
double step = (intervalEnd - intervalBegin)/numberOfPartitions;
@ -104,7 +104,7 @@ namespace MathNet.Numerics.Integration
{
if (f == null)
{
throw new ArgumentNullException("f");
throw new ArgumentNullException(nameof(f));
}
int numberOfPartitions = 1;
@ -151,17 +151,17 @@ namespace MathNet.Numerics.Integration
{
if (f == null)
{
throw new ArgumentNullException("f");
throw new ArgumentNullException(nameof(f));
}
if (levelAbscissas == null)
{
throw new ArgumentNullException("levelAbscissas");
throw new ArgumentNullException(nameof(levelAbscissas));
}
if (levelWeights == null)
{
throw new ArgumentNullException("levelWeights");
throw new ArgumentNullException(nameof(levelWeights));
}
double linearSlope = 0.5*(intervalEnd - intervalBegin);

8
src/Numerics/Integration/SimpsonRule.cs

@ -48,7 +48,7 @@ namespace MathNet.Numerics.Integration
{
if (f == null)
{
throw new ArgumentNullException("f");
throw new ArgumentNullException(nameof(f));
}
double midpoint = (intervalEnd + intervalBegin)/2;
@ -67,17 +67,17 @@ namespace MathNet.Numerics.Integration
{
if (f == null)
{
throw new ArgumentNullException("f");
throw new ArgumentNullException(nameof(f));
}
if (numberOfPartitions <= 0)
{
throw new ArgumentOutOfRangeException("numberOfPartitions", Resources.ArgumentPositive);
throw new ArgumentOutOfRangeException(nameof(numberOfPartitions), Resources.ArgumentPositive);
}
if (numberOfPartitions.IsOdd())
{
throw new ArgumentException(Resources.ArgumentEven, "numberOfPartitions");
throw new ArgumentException(Resources.ArgumentEven, nameof(numberOfPartitions));
}
double step = (intervalEnd - intervalBegin)/numberOfPartitions;

8
src/Numerics/Interpolation/Barycentric.cs

@ -56,7 +56,7 @@ namespace MathNet.Numerics.Interpolation
if (x.Length < 1)
{
throw new ArgumentException(string.Format(Resources.ArrayTooSmall, 1), "x");
throw new ArgumentException(string.Format(Resources.ArrayTooSmall, 1), nameof(x));
}
_x = x;
@ -76,7 +76,7 @@ namespace MathNet.Numerics.Interpolation
if (x.Length < 1)
{
throw new ArgumentException(string.Format(Resources.ArrayTooSmall, 1), "x");
throw new ArgumentException(string.Format(Resources.ArrayTooSmall, 1), nameof(x));
}
var weights = new double[x.Length];
@ -142,12 +142,12 @@ namespace MathNet.Numerics.Interpolation
if (x.Length < 1)
{
throw new ArgumentException(string.Format(Resources.ArrayTooSmall, 1), "x");
throw new ArgumentException(string.Format(Resources.ArrayTooSmall, 1), nameof(x));
}
if (0 > order || x.Length <= order)
{
throw new ArgumentOutOfRangeException("order");
throw new ArgumentOutOfRangeException(nameof(order));
}
var weights = new double[x.Length];

2
src/Numerics/Interpolation/BulirschStoerRationalInterpolation.cs

@ -58,7 +58,7 @@ namespace MathNet.Numerics.Interpolation
if (x.Length < 1)
{
throw new ArgumentException(string.Format(Resources.ArrayTooSmall, 1), "x");
throw new ArgumentException(string.Format(Resources.ArrayTooSmall, 1), nameof(x));
}
_x = x;

10
src/Numerics/Interpolation/CubicSpline.cs

@ -61,7 +61,7 @@ namespace MathNet.Numerics.Interpolation
if (x.Length < 2)
{
throw new ArgumentException(string.Format(Resources.ArrayTooSmall, 2), "x");
throw new ArgumentException(string.Format(Resources.ArrayTooSmall, 2), nameof(x));
}
_x = x;
@ -84,7 +84,7 @@ namespace MathNet.Numerics.Interpolation
if (x.Length < 2)
{
throw new ArgumentException(string.Format(Resources.ArrayTooSmall, 2), "x");
throw new ArgumentException(string.Format(Resources.ArrayTooSmall, 2), nameof(x));
}
var c0 = new double[x.Length - 1];
@ -117,7 +117,7 @@ namespace MathNet.Numerics.Interpolation
if (x.Length < 2)
{
throw new ArgumentException(string.Format(Resources.ArrayTooSmall, 2), "x");
throw new ArgumentException(string.Format(Resources.ArrayTooSmall, 2), nameof(x));
}
Sorting.Sort(x, y, firstDerivatives);
@ -146,7 +146,7 @@ namespace MathNet.Numerics.Interpolation
if (x.Length < 5)
{
throw new ArgumentException(string.Format(Resources.ArrayTooSmall, 5), "x");
throw new ArgumentException(string.Format(Resources.ArrayTooSmall, 5), nameof(x));
}
/* Prepare divided differences (diff) and weights (w) */
@ -226,7 +226,7 @@ namespace MathNet.Numerics.Interpolation
if (x.Length < 2)
{
throw new ArgumentException(string.Format(Resources.ArrayTooSmall, 2), "x");
throw new ArgumentException(string.Format(Resources.ArrayTooSmall, 2), nameof(x));
}
int n = x.Length;

4
src/Numerics/Interpolation/LinearSpline.cs

@ -57,7 +57,7 @@ namespace MathNet.Numerics.Interpolation
if (x.Length < 2)
{
throw new ArgumentException(string.Format(Resources.ArrayTooSmall, 2), "x");
throw new ArgumentException(string.Format(Resources.ArrayTooSmall, 2), nameof(x));
}
_x = x;
@ -78,7 +78,7 @@ namespace MathNet.Numerics.Interpolation
if (x.Length < 2)
{
throw new ArgumentException(string.Format(Resources.ArrayTooSmall, 2), "x");
throw new ArgumentException(string.Format(Resources.ArrayTooSmall, 2), nameof(x));
}
var c1 = new double[x.Length - 1];

4
src/Numerics/Interpolation/NevillePolynomialInterpolation.cs

@ -63,14 +63,14 @@ namespace MathNet.Numerics.Interpolation
if (x.Length < 1)
{
throw new ArgumentException(string.Format(Resources.ArrayTooSmall, 1), "x");
throw new ArgumentException(string.Format(Resources.ArrayTooSmall, 1), nameof(x));
}
for (var i = 1; i < x.Length; ++i)
{
if (x[i] == x[i - 1])
{
throw new ArgumentException(Resources.Interpolation_Initialize_SamplePointsNotUnique, "x");
throw new ArgumentException(Resources.Interpolation_Initialize_SamplePointsNotUnique, nameof(x));
}
}

2
src/Numerics/Interpolation/QuadraticSpline.cs

@ -57,7 +57,7 @@ namespace MathNet.Numerics.Interpolation
if (x.Length < 2)
{
throw new ArgumentException(string.Format(Resources.ArrayTooSmall, 2), "x");
throw new ArgumentException(string.Format(Resources.ArrayTooSmall, 2), nameof(x));
}
_x = x;

2
src/Numerics/Interpolation/StepInterpolation.cs

@ -57,7 +57,7 @@ namespace MathNet.Numerics.Interpolation
if (x.Length < 1)
{
throw new ArgumentException(string.Format(Resources.ArrayTooSmall, 1), "x");
throw new ArgumentException(string.Format(Resources.ArrayTooSmall, 1), nameof(x));
}
_x = x;

4
src/Numerics/LinearAlgebra/Builder.cs

@ -362,7 +362,7 @@ namespace MathNet.Numerics.LinearAlgebra
/// </summary>
public Matrix<T> OfStorage(MatrixStorage<T> storage)
{
if (storage == null) throw new ArgumentNullException("storage");
if (storage == null) throw new ArgumentNullException(nameof(storage));
var dense = storage as DenseColumnMajorMatrixStorage<T>;
if (dense != null) return Dense(dense);
@ -1327,7 +1327,7 @@ namespace MathNet.Numerics.LinearAlgebra
/// </summary>
public Vector<T> OfStorage(VectorStorage<T> storage)
{
if (storage == null) throw new ArgumentNullException("storage");
if (storage == null) throw new ArgumentNullException(nameof(storage));
var dense = storage as DenseVectorStorage<T>;
if (dense != null) return Dense(dense);

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

@ -1038,12 +1038,12 @@ namespace MathNet.Numerics.LinearAlgebra.Complex
{
if (rightSide == null)
{
throw new ArgumentNullException("rightSide");
throw new ArgumentNullException(nameof(rightSide));
}
if (leftSide == null)
{
throw new ArgumentNullException("leftSide");
throw new ArgumentNullException(nameof(leftSide));
}
if (leftSide._rowCount != rightSide._rowCount || leftSide._columnCount != rightSide._columnCount)
@ -1064,7 +1064,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex
{
if (rightSide == null)
{
throw new ArgumentNullException("rightSide");
throw new ArgumentNullException(nameof(rightSide));
}
return (DenseMatrix)rightSide.Clone();
@ -1085,12 +1085,12 @@ namespace MathNet.Numerics.LinearAlgebra.Complex
{
if (rightSide == null)
{
throw new ArgumentNullException("rightSide");
throw new ArgumentNullException(nameof(rightSide));
}
if (leftSide == null)
{
throw new ArgumentNullException("leftSide");
throw new ArgumentNullException(nameof(leftSide));
}
if (leftSide._rowCount != rightSide._rowCount || leftSide._columnCount != rightSide._columnCount)
@ -1111,7 +1111,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex
{
if (rightSide == null)
{
throw new ArgumentNullException("rightSide");
throw new ArgumentNullException(nameof(rightSide));
}
return (DenseMatrix)rightSide.Negate();
@ -1128,7 +1128,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex
{
if (leftSide == null)
{
throw new ArgumentNullException("leftSide");
throw new ArgumentNullException(nameof(leftSide));
}
return (DenseMatrix)leftSide.Multiply(rightSide);
@ -1145,7 +1145,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex
{
if (rightSide == null)
{
throw new ArgumentNullException("rightSide");
throw new ArgumentNullException(nameof(rightSide));
}
return (DenseMatrix)rightSide.Multiply(leftSide);
@ -1166,12 +1166,12 @@ namespace MathNet.Numerics.LinearAlgebra.Complex
{
if (leftSide == null)
{
throw new ArgumentNullException("leftSide");
throw new ArgumentNullException(nameof(leftSide));
}
if (rightSide == null)
{
throw new ArgumentNullException("rightSide");
throw new ArgumentNullException(nameof(rightSide));
}
if (leftSide._columnCount != rightSide._rowCount)
@ -1193,7 +1193,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex
{
if (leftSide == null)
{
throw new ArgumentNullException("leftSide");
throw new ArgumentNullException(nameof(leftSide));
}
return (DenseVector)leftSide.Multiply(rightSide);
@ -1210,7 +1210,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex
{
if (rightSide == null)
{
throw new ArgumentNullException("rightSide");
throw new ArgumentNullException(nameof(rightSide));
}
return (DenseVector)rightSide.LeftMultiply(leftSide);
@ -1227,7 +1227,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex
{
if (leftSide == null)
{
throw new ArgumentNullException("leftSide");
throw new ArgumentNullException(nameof(leftSide));
}
return (DenseMatrix)leftSide.Remainder(rightSide);

24
src/Numerics/LinearAlgebra/Complex/DenseVector.cs

@ -45,7 +45,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex
/// A vector using dense storage.
/// </summary>
[Serializable]
[DebuggerDisplay("DenseVector {Count}-Complex")]
[DebuggerDisplay("DenseVector {" + nameof(Count) + "}-Complex")]
public class DenseVector : Vector
{
/// <summary>
@ -180,7 +180,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex
{
if (vector == null)
{
throw new ArgumentNullException("vector");
throw new ArgumentNullException(nameof(vector));
}
return vector.Values;
@ -197,7 +197,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex
{
if (array == null)
{
throw new ArgumentNullException("array");
throw new ArgumentNullException(nameof(array));
}
return new DenseVector(array);
@ -259,7 +259,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex
{
if (leftSide == null)
{
throw new ArgumentNullException("leftSide");
throw new ArgumentNullException(nameof(leftSide));
}
return leftSide.Add(rightSide);
@ -319,7 +319,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex
{
if (rightSide == null)
{
throw new ArgumentNullException("rightSide");
throw new ArgumentNullException(nameof(rightSide));
}
return rightSide.Negate();
@ -337,7 +337,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex
{
if (leftSide == null)
{
throw new ArgumentNullException("leftSide");
throw new ArgumentNullException(nameof(leftSide));
}
return leftSide.Subtract(rightSide);
@ -436,7 +436,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex
{
if (leftSide == null)
{
throw new ArgumentNullException("leftSide");
throw new ArgumentNullException(nameof(leftSide));
}
return (DenseVector)leftSide.Multiply(rightSide);
@ -453,7 +453,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex
{
if (rightSide == null)
{
throw new ArgumentNullException("rightSide");
throw new ArgumentNullException(nameof(rightSide));
}
return (DenseVector)rightSide.Multiply(leftSide);
@ -471,7 +471,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex
{
if (leftSide == null)
{
throw new ArgumentNullException("leftSide");
throw new ArgumentNullException(nameof(leftSide));
}
return leftSide.DotProduct(rightSide);
@ -488,7 +488,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex
{
if (leftSide == null)
{
throw new ArgumentNullException("leftSide");
throw new ArgumentNullException(nameof(leftSide));
}
return (DenseVector)leftSide.Divide(rightSide);
@ -590,7 +590,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex
/// <returns>Scalar <c>ret = ( ∑|this[i]|^p )^(1/p)</c></returns>
public override double Norm(double p)
{
if (p < 0d) throw new ArgumentOutOfRangeException("p");
if (p < 0d) throw new ArgumentOutOfRangeException(nameof(p));
if (p == 1d) return L1Norm();
if (p == 2d) return L2Norm();
@ -684,7 +684,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex
{
if (value == null)
{
throw new ArgumentNullException("value");
throw new ArgumentNullException(nameof(value));
}
value = value.Trim();

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

@ -738,7 +738,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex
{
if (source.Length != _data.Length)
{
throw new ArgumentException(Resources.ArgumentArraysSameLength, "source");
throw new ArgumentException(Resources.ArgumentArraysSameLength, nameof(source));
}
Array.Copy(source, 0, _data, 0, source.Length);
@ -764,7 +764,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex
if (_data.Length != denseSource.Values.Length)
{
throw new ArgumentException(Resources.ArgumentVectorsSameLength, "source");
throw new ArgumentException(Resources.ArgumentVectorsSameLength, nameof(source));
}
Array.Copy(denseSource.Values, 0, _data, 0, denseSource.Values.Length);

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

@ -56,7 +56,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Factorization
{
if (matrix == null)
{
throw new ArgumentNullException("matrix");
throw new ArgumentNullException(nameof(matrix));
}
if (matrix.RowCount != matrix.ColumnCount)
@ -89,12 +89,12 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Factorization
// Check for proper arguments.
if (input == null)
{
throw new ArgumentNullException("input");
throw new ArgumentNullException(nameof(input));
}
if (result == null)
{
throw new ArgumentNullException("result");
throw new ArgumentNullException(nameof(result));
}
// Check for proper dimensions.
@ -143,12 +143,12 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Factorization
// Check for proper arguments.
if (input == null)
{
throw new ArgumentNullException("input");
throw new ArgumentNullException(nameof(input));
}
if (result == null)
{
throw new ArgumentNullException("result");
throw new ArgumentNullException(nameof(result));
}
// Check for proper dimensions.

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

@ -55,7 +55,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Factorization
{
if (matrix == null)
{
throw new ArgumentNullException("matrix");
throw new ArgumentNullException(nameof(matrix));
}
if (matrix.RowCount != matrix.ColumnCount)
@ -147,12 +147,12 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Factorization
// Check for proper arguments.
if (input == null)
{
throw new ArgumentNullException("input");
throw new ArgumentNullException(nameof(input));
}
if (result == null)
{
throw new ArgumentNullException("result");
throw new ArgumentNullException(nameof(result));
}
// Check for proper dimensions.
@ -233,12 +233,12 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Factorization
// Check for proper arguments.
if (input == null)
{
throw new ArgumentNullException("input");
throw new ArgumentNullException(nameof(input));
}
if (result == null)
{
throw new ArgumentNullException("result");
throw new ArgumentNullException(nameof(result));
}
// Check for proper dimensions.

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

@ -661,7 +661,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex
{
if (norm <= 0.0)
{
throw new ArgumentOutOfRangeException("norm", Resources.ArgumentMustBePositive);
throw new ArgumentOutOfRangeException(nameof(norm), Resources.ArgumentMustBePositive);
}
var ret = new double[RowCount];
@ -693,7 +693,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex
{
if (norm <= 0.0)
{
throw new ArgumentOutOfRangeException("norm", Resources.ArgumentMustBePositive);
throw new ArgumentOutOfRangeException(nameof(norm), Resources.ArgumentMustBePositive);
}
var ret = new double[ColumnCount];

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

@ -98,7 +98,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers
{
if (matrix.RowCount != matrix.ColumnCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSquare, "matrix");
throw new ArgumentException(Resources.ArgumentMatrixSquare, nameof(matrix));
}
if (result.Count != input.Count)

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

@ -77,7 +77,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers
{
if (matrix.RowCount != matrix.ColumnCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSquare, "matrix");
throw new ArgumentException(Resources.ArgumentMatrixSquare, nameof(matrix));
}
if (result.Count != input.Count)

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

@ -72,7 +72,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers
{
if (matrix.RowCount != matrix.ColumnCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSquare, "matrix");
throw new ArgumentException(Resources.ArgumentMatrixSquare, nameof(matrix));
}
_inverseDiagonals = new Complex[matrix.RowCount];
@ -96,7 +96,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers
if ((lhs.Count != rhs.Count) || (lhs.Count != _inverseDiagonals.Length))
{
throw new ArgumentException(Resources.ArgumentVectorsSameLength, "rhs");
throw new ArgumentException(Resources.ArgumentVectorsSameLength, nameof(rhs));
}
for (var i = 0; i < _inverseDiagonals.Length; i++)

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

@ -88,7 +88,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers
{
if (value < 0)
{
throw new ArgumentOutOfRangeException("value");
throw new ArgumentOutOfRangeException(nameof(value));
}
_numberOfBiCgStabSteps = value;
@ -107,7 +107,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers
{
if (value < 0)
{
throw new ArgumentOutOfRangeException("value");
throw new ArgumentOutOfRangeException(nameof(value));
}
_numberOfGpbiCgSteps = value;
@ -161,7 +161,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers
{
if (matrix.RowCount != matrix.ColumnCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSquare, "matrix");
throw new ArgumentException(Resources.ArgumentMatrixSquare, nameof(matrix));
}
if (input.Count != matrix.RowCount || result.Count != input.Count)

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

@ -105,12 +105,12 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers
{
if (matrix == null)
{
throw new ArgumentNullException("matrix");
throw new ArgumentNullException(nameof(matrix));
}
if (matrix.RowCount != matrix.ColumnCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSquare, "matrix");
throw new ArgumentException(Resources.ArgumentMatrixSquare, nameof(matrix));
}
_decompositionLU = SparseMatrix.OfMatrix(matrix);

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

@ -122,17 +122,17 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers
{
if (fillLevel < 0)
{
throw new ArgumentOutOfRangeException("fillLevel");
throw new ArgumentOutOfRangeException(nameof(fillLevel));
}
if (dropTolerance < 0)
{
throw new ArgumentOutOfRangeException("dropTolerance");
throw new ArgumentOutOfRangeException(nameof(dropTolerance));
}
if (pivotTolerance < 0)
{
throw new ArgumentOutOfRangeException("pivotTolerance");
throw new ArgumentOutOfRangeException(nameof(pivotTolerance));
}
_fillLevel = fillLevel;
@ -167,7 +167,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers
{
if (value < 0)
{
throw new ArgumentOutOfRangeException("value");
throw new ArgumentOutOfRangeException(nameof(value));
}
_fillLevel = value;
@ -198,7 +198,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers
{
if (value < 0)
{
throw new ArgumentOutOfRangeException("value");
throw new ArgumentOutOfRangeException(nameof(value));
}
_dropTolerance = value;
@ -231,7 +231,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers
{
if (value < 0)
{
throw new ArgumentOutOfRangeException("value");
throw new ArgumentOutOfRangeException(nameof(value));
}
_pivotTolerance = value;
@ -295,12 +295,12 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers
{
if (matrix == null)
{
throw new ArgumentNullException("matrix");
throw new ArgumentNullException(nameof(matrix));
}
if (matrix.RowCount != matrix.ColumnCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSquare, "matrix");
throw new ArgumentException(Resources.ArgumentMatrixSquare, nameof(matrix));
}
var sparseMatrix = matrix as SparseMatrix ?? SparseMatrix.OfMatrix(matrix);
@ -617,7 +617,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers
if ((lhs.Count != rhs.Count) || (lhs.Count != _upper.RowCount))
{
throw new ArgumentException(Resources.ArgumentVectorsSameLength, "rhs");
throw new ArgumentException(Resources.ArgumentVectorsSameLength, nameof(rhs));
}
// Solve equation here

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

@ -86,14 +86,14 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers
var csr = matrix.Storage as SparseCompressedRowMatrixStorage<Complex>;
if (csr == null)
{
throw new ArgumentException(Resources.MatrixMustBeSparse, "matrix");
throw new ArgumentException(Resources.MatrixMustBeSparse, nameof(matrix));
}
// Dimension of matrix
int n = csr.RowCount;
if (n != csr.ColumnCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSquare, "matrix");
throw new ArgumentException(Resources.ArgumentMatrixSquare, nameof(matrix));
}
// Original matrix compressed sparse row storage.

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

@ -96,7 +96,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers
{
if (value <= 1)
{
throw new ArgumentOutOfRangeException("value");
throw new ArgumentOutOfRangeException(nameof(value));
}
_numberOfStartingVectors = value;
@ -247,7 +247,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers
{
if (matrix.RowCount != matrix.ColumnCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSquare, "matrix");
throw new ArgumentException(Resources.ArgumentMatrixSquare, nameof(matrix));
}
if (input.Count != matrix.RowCount || result.Count != input.Count)

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

@ -94,7 +94,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers
{
if (matrix.RowCount != matrix.ColumnCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSquare, "matrix");
throw new ArgumentException(Resources.ArgumentMatrixSquare, nameof(matrix));
}
if (input.Count != matrix.RowCount || result.Count != input.Count)

38
src/Numerics/LinearAlgebra/Complex/SparseMatrix.cs

@ -392,7 +392,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex
{
if (result == null)
{
throw new ArgumentNullException("result");
throw new ArgumentNullException(nameof(result));
}
if (result.RowCount != RowCount || result.ColumnCount != ColumnCount)
@ -457,7 +457,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex
{
if (result == null)
{
throw new ArgumentNullException("result");
throw new ArgumentNullException(nameof(result));
}
if (result.RowCount != RowCount || result.ColumnCount != ColumnCount)
@ -523,7 +523,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex
{
if (result == null)
{
throw new ArgumentNullException("result");
throw new ArgumentNullException(nameof(result));
}
if (result.RowCount != RowCount || result.ColumnCount != ColumnCount)
@ -589,7 +589,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex
{
if (result == null)
{
throw new ArgumentNullException("result");
throw new ArgumentNullException(nameof(result));
}
if (result.RowCount != RowCount || result.ColumnCount != ColumnCount)
@ -1231,12 +1231,12 @@ namespace MathNet.Numerics.LinearAlgebra.Complex
{
if (other == null)
{
throw new ArgumentNullException("other");
throw new ArgumentNullException(nameof(other));
}
if (result == null)
{
throw new ArgumentNullException("result");
throw new ArgumentNullException(nameof(result));
}
if (result.RowCount != (RowCount*other.RowCount) || result.ColumnCount != (ColumnCount*other.ColumnCount))
@ -1350,12 +1350,12 @@ namespace MathNet.Numerics.LinearAlgebra.Complex
{
if (rightSide == null)
{
throw new ArgumentNullException("rightSide");
throw new ArgumentNullException(nameof(rightSide));
}
if (leftSide == null)
{
throw new ArgumentNullException("leftSide");
throw new ArgumentNullException(nameof(leftSide));
}
if (leftSide.RowCount != rightSide.RowCount || leftSide.ColumnCount != rightSide.ColumnCount)
@ -1376,7 +1376,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex
{
if (rightSide == null)
{
throw new ArgumentNullException("rightSide");
throw new ArgumentNullException(nameof(rightSide));
}
return (SparseMatrix)rightSide.Clone();
@ -1397,12 +1397,12 @@ namespace MathNet.Numerics.LinearAlgebra.Complex
{
if (rightSide == null)
{
throw new ArgumentNullException("rightSide");
throw new ArgumentNullException(nameof(rightSide));
}
if (leftSide == null)
{
throw new ArgumentNullException("leftSide");
throw new ArgumentNullException(nameof(leftSide));
}
if (leftSide.RowCount != rightSide.RowCount || leftSide.ColumnCount != rightSide.ColumnCount)
@ -1423,7 +1423,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex
{
if (rightSide == null)
{
throw new ArgumentNullException("rightSide");
throw new ArgumentNullException(nameof(rightSide));
}
return (SparseMatrix)rightSide.Negate();
@ -1440,7 +1440,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex
{
if (leftSide == null)
{
throw new ArgumentNullException("leftSide");
throw new ArgumentNullException(nameof(leftSide));
}
return (SparseMatrix)leftSide.Multiply(rightSide);
@ -1457,7 +1457,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex
{
if (rightSide == null)
{
throw new ArgumentNullException("rightSide");
throw new ArgumentNullException(nameof(rightSide));
}
return (SparseMatrix)rightSide.Multiply(leftSide);
@ -1478,12 +1478,12 @@ namespace MathNet.Numerics.LinearAlgebra.Complex
{
if (leftSide == null)
{
throw new ArgumentNullException("leftSide");
throw new ArgumentNullException(nameof(leftSide));
}
if (rightSide == null)
{
throw new ArgumentNullException("rightSide");
throw new ArgumentNullException(nameof(rightSide));
}
if (leftSide.ColumnCount != rightSide.RowCount)
@ -1505,7 +1505,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex
{
if (leftSide == null)
{
throw new ArgumentNullException("leftSide");
throw new ArgumentNullException(nameof(leftSide));
}
return (SparseVector)leftSide.Multiply(rightSide);
@ -1522,7 +1522,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex
{
if (rightSide == null)
{
throw new ArgumentNullException("rightSide");
throw new ArgumentNullException(nameof(rightSide));
}
return (SparseVector)rightSide.LeftMultiply(leftSide);
@ -1539,7 +1539,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex
{
if (leftSide == null)
{
throw new ArgumentNullException("leftSide");
throw new ArgumentNullException(nameof(leftSide));
}
return (SparseMatrix)leftSide.Remainder(rightSide);

20
src/Numerics/LinearAlgebra/Complex/SparseVector.cs

@ -525,7 +525,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex
{
if (leftSide == null)
{
throw new ArgumentNullException("leftSide");
throw new ArgumentNullException(nameof(leftSide));
}
return (SparseVector)leftSide.Add(rightSide);
@ -541,7 +541,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex
{
if (rightSide == null)
{
throw new ArgumentNullException("rightSide");
throw new ArgumentNullException(nameof(rightSide));
}
return (SparseVector)rightSide.Negate();
@ -559,7 +559,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex
{
if (leftSide == null)
{
throw new ArgumentNullException("leftSide");
throw new ArgumentNullException(nameof(leftSide));
}
return (SparseVector)leftSide.Subtract(rightSide);
@ -576,7 +576,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex
{
if (leftSide == null)
{
throw new ArgumentNullException("leftSide");
throw new ArgumentNullException(nameof(leftSide));
}
return (SparseVector)leftSide.Multiply(rightSide);
@ -593,7 +593,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex
{
if (rightSide == null)
{
throw new ArgumentNullException("rightSide");
throw new ArgumentNullException(nameof(rightSide));
}
return (SparseVector)rightSide.Multiply(leftSide);
@ -611,7 +611,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex
{
if (leftSide == null)
{
throw new ArgumentNullException("leftSide");
throw new ArgumentNullException(nameof(leftSide));
}
return leftSide.DotProduct(rightSide);
@ -628,7 +628,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex
{
if (leftSide == null)
{
throw new ArgumentNullException("leftSide");
throw new ArgumentNullException(nameof(leftSide));
}
return (SparseVector)leftSide.Divide(rightSide);
@ -645,7 +645,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex
{
if (leftSide == null)
{
throw new ArgumentNullException("leftSide");
throw new ArgumentNullException(nameof(leftSide));
}
return (SparseVector)leftSide.Modulus(rightSide);
@ -749,7 +749,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex
/// <returns>Scalar <c>ret = ( ∑|this[i]|^p )^(1/p)</c></returns>
public override double Norm(double p)
{
if (p < 0d) throw new ArgumentOutOfRangeException("p");
if (p < 0d) throw new ArgumentOutOfRangeException(nameof(p));
if (_storage.ValueCount == 0)
{
@ -807,7 +807,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex
{
if (value == null)
{
throw new ArgumentNullException("value");
throw new ArgumentNullException(nameof(value));
}
value = value.Trim();

4
src/Numerics/LinearAlgebra/Complex/Vector.cs

@ -555,7 +555,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex
/// </returns>
public override double Norm(double p)
{
if (p < 0d) throw new ArgumentOutOfRangeException("p");
if (p < 0d) throw new ArgumentOutOfRangeException(nameof(p));
if (p == 1d) return L1Norm();
if (p == 2d) return L2Norm();
@ -600,7 +600,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex
{
if (p < 0d)
{
throw new ArgumentOutOfRangeException("p");
throw new ArgumentOutOfRangeException(nameof(p));
}
double norm = Norm(p);

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

@ -1040,12 +1040,12 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32
{
if (rightSide == null)
{
throw new ArgumentNullException("rightSide");
throw new ArgumentNullException(nameof(rightSide));
}
if (leftSide == null)
{
throw new ArgumentNullException("leftSide");
throw new ArgumentNullException(nameof(leftSide));
}
if (leftSide._rowCount != rightSide._rowCount || leftSide._columnCount != rightSide._columnCount)
@ -1066,7 +1066,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32
{
if (rightSide == null)
{
throw new ArgumentNullException("rightSide");
throw new ArgumentNullException(nameof(rightSide));
}
return (DenseMatrix)rightSide.Clone();
@ -1087,12 +1087,12 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32
{
if (rightSide == null)
{
throw new ArgumentNullException("rightSide");
throw new ArgumentNullException(nameof(rightSide));
}
if (leftSide == null)
{
throw new ArgumentNullException("leftSide");
throw new ArgumentNullException(nameof(leftSide));
}
if (leftSide._rowCount != rightSide._rowCount || leftSide._columnCount != rightSide._columnCount)
@ -1113,7 +1113,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32
{
if (rightSide == null)
{
throw new ArgumentNullException("rightSide");
throw new ArgumentNullException(nameof(rightSide));
}
return (DenseMatrix)rightSide.Negate();
@ -1130,7 +1130,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32
{
if (leftSide == null)
{
throw new ArgumentNullException("leftSide");
throw new ArgumentNullException(nameof(leftSide));
}
return (DenseMatrix)leftSide.Multiply(rightSide);
@ -1147,7 +1147,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32
{
if (rightSide == null)
{
throw new ArgumentNullException("rightSide");
throw new ArgumentNullException(nameof(rightSide));
}
return (DenseMatrix)rightSide.Multiply(leftSide);
@ -1168,12 +1168,12 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32
{
if (leftSide == null)
{
throw new ArgumentNullException("leftSide");
throw new ArgumentNullException(nameof(leftSide));
}
if (rightSide == null)
{
throw new ArgumentNullException("rightSide");
throw new ArgumentNullException(nameof(rightSide));
}
if (leftSide._columnCount != rightSide._rowCount)
@ -1195,7 +1195,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32
{
if (leftSide == null)
{
throw new ArgumentNullException("leftSide");
throw new ArgumentNullException(nameof(leftSide));
}
return (DenseVector)leftSide.Multiply(rightSide);
@ -1212,7 +1212,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32
{
if (rightSide == null)
{
throw new ArgumentNullException("rightSide");
throw new ArgumentNullException(nameof(rightSide));
}
return (DenseVector)rightSide.LeftMultiply(leftSide);
@ -1229,7 +1229,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32
{
if (leftSide == null)
{
throw new ArgumentNullException("leftSide");
throw new ArgumentNullException(nameof(leftSide));
}
return (DenseMatrix)leftSide.Remainder(rightSide);

24
src/Numerics/LinearAlgebra/Complex32/DenseVector.cs

@ -45,7 +45,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32
/// A vector using dense storage.
/// </summary>
[Serializable]
[DebuggerDisplay("DenseVector {Count}-Complex32")]
[DebuggerDisplay("DenseVector {" + nameof(Count) + "}-Complex32")]
public class DenseVector : Vector
{
/// <summary>
@ -180,7 +180,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32
{
if (vector == null)
{
throw new ArgumentNullException("vector");
throw new ArgumentNullException(nameof(vector));
}
return vector.Values;
@ -197,7 +197,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32
{
if (array == null)
{
throw new ArgumentNullException("array");
throw new ArgumentNullException(nameof(array));
}
return new DenseVector(array);
@ -259,7 +259,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32
{
if (leftSide == null)
{
throw new ArgumentNullException("leftSide");
throw new ArgumentNullException(nameof(leftSide));
}
return (DenseVector)leftSide.Add(rightSide);
@ -319,7 +319,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32
{
if (rightSide == null)
{
throw new ArgumentNullException("rightSide");
throw new ArgumentNullException(nameof(rightSide));
}
return (DenseVector)rightSide.Negate();
@ -337,7 +337,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32
{
if (leftSide == null)
{
throw new ArgumentNullException("leftSide");
throw new ArgumentNullException(nameof(leftSide));
}
return (DenseVector)leftSide.Subtract(rightSide);
@ -436,7 +436,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32
{
if (leftSide == null)
{
throw new ArgumentNullException("leftSide");
throw new ArgumentNullException(nameof(leftSide));
}
return (DenseVector)leftSide.Multiply(rightSide);
@ -453,7 +453,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32
{
if (rightSide == null)
{
throw new ArgumentNullException("rightSide");
throw new ArgumentNullException(nameof(rightSide));
}
return (DenseVector)rightSide.Multiply(leftSide);
@ -471,7 +471,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32
{
if (leftSide == null)
{
throw new ArgumentNullException("leftSide");
throw new ArgumentNullException(nameof(leftSide));
}
return leftSide.DotProduct(rightSide);
@ -488,7 +488,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32
{
if (leftSide == null)
{
throw new ArgumentNullException("leftSide");
throw new ArgumentNullException(nameof(leftSide));
}
return (DenseVector)leftSide.Divide(rightSide);
@ -590,7 +590,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32
/// <returns>Scalar <c>ret = ( ∑|this[i]|^p )^(1/p)</c></returns>
public override double Norm(double p)
{
if (p < 0d) throw new ArgumentOutOfRangeException("p");
if (p < 0d) throw new ArgumentOutOfRangeException(nameof(p));
if (p == 1d) return L1Norm();
if (p == 2d) return L2Norm();
@ -684,7 +684,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32
{
if (value == null)
{
throw new ArgumentNullException("value");
throw new ArgumentNullException(nameof(value));
}
value = value.Trim();

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

@ -737,7 +737,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32
{
if (source.Length != _data.Length)
{
throw new ArgumentException(Resources.ArgumentArraysSameLength, "source");
throw new ArgumentException(Resources.ArgumentArraysSameLength, nameof(source));
}
Array.Copy(source, 0, _data, 0, source.Length);
@ -763,7 +763,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32
if (_data.Length != denseSource.Values.Length)
{
throw new ArgumentException(Resources.ArgumentVectorsSameLength, "source");
throw new ArgumentException(Resources.ArgumentVectorsSameLength, nameof(source));
}
Array.Copy(denseSource.Values, 0, _data, 0, denseSource.Values.Length);

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

@ -56,7 +56,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Factorization
{
if (matrix == null)
{
throw new ArgumentNullException("matrix");
throw new ArgumentNullException(nameof(matrix));
}
if (matrix.RowCount != matrix.ColumnCount)
@ -89,12 +89,12 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Factorization
// Check for proper arguments.
if (input == null)
{
throw new ArgumentNullException("input");
throw new ArgumentNullException(nameof(input));
}
if (result == null)
{
throw new ArgumentNullException("result");
throw new ArgumentNullException(nameof(result));
}
// Check for proper dimensions.
@ -143,12 +143,12 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Factorization
// Check for proper arguments.
if (input == null)
{
throw new ArgumentNullException("input");
throw new ArgumentNullException(nameof(input));
}
if (result == null)
{
throw new ArgumentNullException("result");
throw new ArgumentNullException(nameof(result));
}
// Check for proper dimensions.

10
src/Numerics/LinearAlgebra/Complex32/Factorization/UserLU.cs

@ -55,7 +55,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Factorization
{
if (matrix == null)
{
throw new ArgumentNullException("matrix");
throw new ArgumentNullException(nameof(matrix));
}
if (matrix.RowCount != matrix.ColumnCount)
@ -147,12 +147,12 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Factorization
// Check for proper arguments.
if (input == null)
{
throw new ArgumentNullException("input");
throw new ArgumentNullException(nameof(input));
}
if (result == null)
{
throw new ArgumentNullException("result");
throw new ArgumentNullException(nameof(result));
}
// Check for proper dimensions.
@ -233,12 +233,12 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Factorization
// Check for proper arguments.
if (input == null)
{
throw new ArgumentNullException("input");
throw new ArgumentNullException(nameof(input));
}
if (result == null)
{
throw new ArgumentNullException("result");
throw new ArgumentNullException(nameof(result));
}
// Check for proper dimensions.

4
src/Numerics/LinearAlgebra/Complex32/Matrix.cs

@ -661,7 +661,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32
{
if (norm <= 0.0)
{
throw new ArgumentOutOfRangeException("norm", Resources.ArgumentMustBePositive);
throw new ArgumentOutOfRangeException(nameof(norm), Resources.ArgumentMustBePositive);
}
var ret = new double[RowCount];
@ -693,7 +693,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32
{
if (norm <= 0.0)
{
throw new ArgumentOutOfRangeException("norm", Resources.ArgumentMustBePositive);
throw new ArgumentOutOfRangeException(nameof(norm), Resources.ArgumentMustBePositive);
}
var ret = new double[ColumnCount];

2
src/Numerics/LinearAlgebra/Complex32/Solvers/BiCgStab.cs

@ -96,7 +96,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers
{
if (matrix.RowCount != matrix.ColumnCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSquare, "matrix");
throw new ArgumentException(Resources.ArgumentMatrixSquare, nameof(matrix));
}
if (result.Count != input.Count)

2
src/Numerics/LinearAlgebra/Complex32/Solvers/CompositeSolver.cs

@ -75,7 +75,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers
{
if (matrix.RowCount != matrix.ColumnCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSquare, "matrix");
throw new ArgumentException(Resources.ArgumentMatrixSquare, nameof(matrix));
}
if (result.Count != input.Count)

4
src/Numerics/LinearAlgebra/Complex32/Solvers/DiagonalPreconditioner.cs

@ -72,7 +72,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers
{
if (matrix.RowCount != matrix.ColumnCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSquare, "matrix");
throw new ArgumentException(Resources.ArgumentMatrixSquare, nameof(matrix));
}
_inverseDiagonals = new Complex32[matrix.RowCount];
@ -96,7 +96,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers
if ((lhs.Count != rhs.Count) || (lhs.Count != _inverseDiagonals.Length))
{
throw new ArgumentException(Resources.ArgumentVectorsSameLength, "rhs");
throw new ArgumentException(Resources.ArgumentVectorsSameLength, nameof(rhs));
}
for (var i = 0; i < _inverseDiagonals.Length; i++)

6
src/Numerics/LinearAlgebra/Complex32/Solvers/GpBiCg.cs

@ -86,7 +86,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers
{
if (value < 0)
{
throw new ArgumentOutOfRangeException("value");
throw new ArgumentOutOfRangeException(nameof(value));
}
_numberOfBiCgStabSteps = value;
@ -105,7 +105,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers
{
if (value < 0)
{
throw new ArgumentOutOfRangeException("value");
throw new ArgumentOutOfRangeException(nameof(value));
}
_numberOfGpbiCgSteps = value;
@ -159,7 +159,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers
{
if (matrix.RowCount != matrix.ColumnCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSquare, "matrix");
throw new ArgumentException(Resources.ArgumentMatrixSquare, nameof(matrix));
}
if (result.Count != input.Count)

4
src/Numerics/LinearAlgebra/Complex32/Solvers/ILU0Preconditioner.cs

@ -105,12 +105,12 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers
{
if (matrix == null)
{
throw new ArgumentNullException("matrix");
throw new ArgumentNullException(nameof(matrix));
}
if (matrix.RowCount != matrix.ColumnCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSquare, "matrix");
throw new ArgumentException(Resources.ArgumentMatrixSquare, nameof(matrix));
}
_decompositionLU = SparseMatrix.OfMatrix(matrix);

18
src/Numerics/LinearAlgebra/Complex32/Solvers/ILUTPPreconditioner.cs

@ -122,17 +122,17 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers
{
if (fillLevel < 0)
{
throw new ArgumentOutOfRangeException("fillLevel");
throw new ArgumentOutOfRangeException(nameof(fillLevel));
}
if (dropTolerance < 0)
{
throw new ArgumentOutOfRangeException("dropTolerance");
throw new ArgumentOutOfRangeException(nameof(dropTolerance));
}
if (pivotTolerance < 0)
{
throw new ArgumentOutOfRangeException("pivotTolerance");
throw new ArgumentOutOfRangeException(nameof(pivotTolerance));
}
_fillLevel = fillLevel;
@ -167,7 +167,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers
{
if (value < 0)
{
throw new ArgumentOutOfRangeException("value");
throw new ArgumentOutOfRangeException(nameof(value));
}
_fillLevel = value;
@ -198,7 +198,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers
{
if (value < 0)
{
throw new ArgumentOutOfRangeException("value");
throw new ArgumentOutOfRangeException(nameof(value));
}
_dropTolerance = value;
@ -231,7 +231,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers
{
if (value < 0)
{
throw new ArgumentOutOfRangeException("value");
throw new ArgumentOutOfRangeException(nameof(value));
}
_pivotTolerance = value;
@ -295,12 +295,12 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers
{
if (matrix == null)
{
throw new ArgumentNullException("matrix");
throw new ArgumentNullException(nameof(matrix));
}
if (matrix.RowCount != matrix.ColumnCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSquare, "matrix");
throw new ArgumentException(Resources.ArgumentMatrixSquare, nameof(matrix));
}
var sparseMatrix = matrix as SparseMatrix ?? SparseMatrix.OfMatrix(matrix);
@ -623,7 +623,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers
if ((lhs.Count != rhs.Count) || (lhs.Count != _upper.RowCount))
{
throw new ArgumentException(Resources.ArgumentVectorsSameLength, "rhs");
throw new ArgumentException(Resources.ArgumentVectorsSameLength, nameof(rhs));
}
// Solve equation here

4
src/Numerics/LinearAlgebra/Complex32/Solvers/MILU0Preconditioner.cs

@ -86,14 +86,14 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers
var csr = matrix.Storage as SparseCompressedRowMatrixStorage<Complex32>;
if (csr == null)
{
throw new ArgumentException(Resources.MatrixMustBeSparse, "matrix");
throw new ArgumentException(Resources.MatrixMustBeSparse, nameof(matrix));
}
// Dimension of matrix
int n = csr.RowCount;
if (n != csr.ColumnCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSquare, "matrix");
throw new ArgumentException(Resources.ArgumentMatrixSquare, nameof(matrix));
}
// Original matrix compressed sparse row storage.

4
src/Numerics/LinearAlgebra/Complex32/Solvers/MlkBiCgStab.cs

@ -94,7 +94,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers
{
if (value <= 1)
{
throw new ArgumentOutOfRangeException("value");
throw new ArgumentOutOfRangeException(nameof(value));
}
_numberOfStartingVectors = value;
@ -245,7 +245,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers
{
if (matrix.RowCount != matrix.ColumnCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSquare, "matrix");
throw new ArgumentException(Resources.ArgumentMatrixSquare, nameof(matrix));
}
if (result.Count != input.Count)

2
src/Numerics/LinearAlgebra/Complex32/Solvers/TFQMR.cs

@ -92,7 +92,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers
{
if (matrix.RowCount != matrix.ColumnCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSquare, "matrix");
throw new ArgumentException(Resources.ArgumentMatrixSquare, nameof(matrix));
}
if (result.Count != input.Count)

38
src/Numerics/LinearAlgebra/Complex32/SparseMatrix.cs

@ -392,7 +392,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32
{
if (result == null)
{
throw new ArgumentNullException("result");
throw new ArgumentNullException(nameof(result));
}
if (result.RowCount != RowCount || result.ColumnCount != ColumnCount)
@ -457,7 +457,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32
{
if (result == null)
{
throw new ArgumentNullException("result");
throw new ArgumentNullException(nameof(result));
}
if (result.RowCount != RowCount || result.ColumnCount != ColumnCount)
@ -523,7 +523,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32
{
if (result == null)
{
throw new ArgumentNullException("result");
throw new ArgumentNullException(nameof(result));
}
if (result.RowCount != RowCount || result.ColumnCount != ColumnCount)
@ -589,7 +589,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32
{
if (result == null)
{
throw new ArgumentNullException("result");
throw new ArgumentNullException(nameof(result));
}
if (result.RowCount != RowCount || result.ColumnCount != ColumnCount)
@ -1230,12 +1230,12 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32
{
if (other == null)
{
throw new ArgumentNullException("other");
throw new ArgumentNullException(nameof(other));
}
if (result == null)
{
throw new ArgumentNullException("result");
throw new ArgumentNullException(nameof(result));
}
if (result.RowCount != (RowCount*other.RowCount) || result.ColumnCount != (ColumnCount*other.ColumnCount))
@ -1349,12 +1349,12 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32
{
if (rightSide == null)
{
throw new ArgumentNullException("rightSide");
throw new ArgumentNullException(nameof(rightSide));
}
if (leftSide == null)
{
throw new ArgumentNullException("leftSide");
throw new ArgumentNullException(nameof(leftSide));
}
if (leftSide.RowCount != rightSide.RowCount || leftSide.ColumnCount != rightSide.ColumnCount)
@ -1375,7 +1375,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32
{
if (rightSide == null)
{
throw new ArgumentNullException("rightSide");
throw new ArgumentNullException(nameof(rightSide));
}
return (SparseMatrix)rightSide.Clone();
@ -1396,12 +1396,12 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32
{
if (rightSide == null)
{
throw new ArgumentNullException("rightSide");
throw new ArgumentNullException(nameof(rightSide));
}
if (leftSide == null)
{
throw new ArgumentNullException("leftSide");
throw new ArgumentNullException(nameof(leftSide));
}
if (leftSide.RowCount != rightSide.RowCount || leftSide.ColumnCount != rightSide.ColumnCount)
@ -1422,7 +1422,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32
{
if (rightSide == null)
{
throw new ArgumentNullException("rightSide");
throw new ArgumentNullException(nameof(rightSide));
}
return (SparseMatrix)rightSide.Negate();
@ -1439,7 +1439,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32
{
if (leftSide == null)
{
throw new ArgumentNullException("leftSide");
throw new ArgumentNullException(nameof(leftSide));
}
return (SparseMatrix)leftSide.Multiply(rightSide);
@ -1456,7 +1456,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32
{
if (rightSide == null)
{
throw new ArgumentNullException("rightSide");
throw new ArgumentNullException(nameof(rightSide));
}
return (SparseMatrix)rightSide.Multiply(leftSide);
@ -1477,12 +1477,12 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32
{
if (leftSide == null)
{
throw new ArgumentNullException("leftSide");
throw new ArgumentNullException(nameof(leftSide));
}
if (rightSide == null)
{
throw new ArgumentNullException("rightSide");
throw new ArgumentNullException(nameof(rightSide));
}
if (leftSide.ColumnCount != rightSide.RowCount)
@ -1504,7 +1504,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32
{
if (leftSide == null)
{
throw new ArgumentNullException("leftSide");
throw new ArgumentNullException(nameof(leftSide));
}
return (SparseVector)leftSide.Multiply(rightSide);
@ -1521,7 +1521,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32
{
if (rightSide == null)
{
throw new ArgumentNullException("rightSide");
throw new ArgumentNullException(nameof(rightSide));
}
return (SparseVector)rightSide.LeftMultiply(leftSide);
@ -1538,7 +1538,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32
{
if (leftSide == null)
{
throw new ArgumentNullException("leftSide");
throw new ArgumentNullException(nameof(leftSide));
}
return (SparseMatrix)leftSide.Remainder(rightSide);

20
src/Numerics/LinearAlgebra/Complex32/SparseVector.cs

@ -525,7 +525,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32
{
if (leftSide == null)
{
throw new ArgumentNullException("leftSide");
throw new ArgumentNullException(nameof(leftSide));
}
return (SparseVector)leftSide.Add(rightSide);
@ -541,7 +541,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32
{
if (rightSide == null)
{
throw new ArgumentNullException("rightSide");
throw new ArgumentNullException(nameof(rightSide));
}
return (SparseVector)rightSide.Negate();
@ -559,7 +559,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32
{
if (leftSide == null)
{
throw new ArgumentNullException("leftSide");
throw new ArgumentNullException(nameof(leftSide));
}
return (SparseVector)leftSide.Subtract(rightSide);
@ -576,7 +576,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32
{
if (leftSide == null)
{
throw new ArgumentNullException("leftSide");
throw new ArgumentNullException(nameof(leftSide));
}
return (SparseVector)leftSide.Multiply(rightSide);
@ -593,7 +593,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32
{
if (rightSide == null)
{
throw new ArgumentNullException("rightSide");
throw new ArgumentNullException(nameof(rightSide));
}
return (SparseVector)rightSide.Multiply(leftSide);
@ -611,7 +611,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32
{
if (leftSide == null)
{
throw new ArgumentNullException("leftSide");
throw new ArgumentNullException(nameof(leftSide));
}
return leftSide.DotProduct(rightSide);
@ -628,7 +628,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32
{
if (leftSide == null)
{
throw new ArgumentNullException("leftSide");
throw new ArgumentNullException(nameof(leftSide));
}
return (SparseVector)leftSide.Divide(rightSide);
@ -645,7 +645,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32
{
if (leftSide == null)
{
throw new ArgumentNullException("leftSide");
throw new ArgumentNullException(nameof(leftSide));
}
return (SparseVector)leftSide.Modulus(rightSide);
@ -749,7 +749,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32
/// <returns>Scalar <c>ret = ( ∑|this[i]|^p )^(1/p)</c></returns>
public override double Norm(double p)
{
if (p < 0d) throw new ArgumentOutOfRangeException("p");
if (p < 0d) throw new ArgumentOutOfRangeException(nameof(p));
if (_storage.ValueCount == 0)
{
@ -807,7 +807,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32
{
if (value == null)
{
throw new ArgumentNullException("value");
throw new ArgumentNullException(nameof(value));
}
value = value.Trim();

4
src/Numerics/LinearAlgebra/Complex32/Vector.cs

@ -555,7 +555,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32
/// </returns>
public override double Norm(double p)
{
if (p < 0d) throw new ArgumentOutOfRangeException("p");
if (p < 0d) throw new ArgumentOutOfRangeException(nameof(p));
if (p == 1d) return L1Norm();
if (p == 2d) return L2Norm();
@ -600,7 +600,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32
{
if (p < 0d)
{
throw new ArgumentOutOfRangeException("p");
throw new ArgumentOutOfRangeException(nameof(p));
}
double norm = Norm(p);

26
src/Numerics/LinearAlgebra/Double/DenseMatrix.cs

@ -996,12 +996,12 @@ namespace MathNet.Numerics.LinearAlgebra.Double
{
if (rightSide == null)
{
throw new ArgumentNullException("rightSide");
throw new ArgumentNullException(nameof(rightSide));
}
if (leftSide == null)
{
throw new ArgumentNullException("leftSide");
throw new ArgumentNullException(nameof(leftSide));
}
if (leftSide._rowCount != rightSide._rowCount || leftSide._columnCount != rightSide._columnCount)
@ -1022,7 +1022,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double
{
if (rightSide == null)
{
throw new ArgumentNullException("rightSide");
throw new ArgumentNullException(nameof(rightSide));
}
return (DenseMatrix)rightSide.Clone();
@ -1043,12 +1043,12 @@ namespace MathNet.Numerics.LinearAlgebra.Double
{
if (rightSide == null)
{
throw new ArgumentNullException("rightSide");
throw new ArgumentNullException(nameof(rightSide));
}
if (leftSide == null)
{
throw new ArgumentNullException("leftSide");
throw new ArgumentNullException(nameof(leftSide));
}
if (leftSide._rowCount != rightSide._rowCount || leftSide._columnCount != rightSide._columnCount)
@ -1069,7 +1069,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double
{
if (rightSide == null)
{
throw new ArgumentNullException("rightSide");
throw new ArgumentNullException(nameof(rightSide));
}
return (DenseMatrix)rightSide.Negate();
@ -1086,7 +1086,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double
{
if (leftSide == null)
{
throw new ArgumentNullException("leftSide");
throw new ArgumentNullException(nameof(leftSide));
}
return (DenseMatrix)leftSide.Multiply(rightSide);
@ -1103,7 +1103,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double
{
if (rightSide == null)
{
throw new ArgumentNullException("rightSide");
throw new ArgumentNullException(nameof(rightSide));
}
return (DenseMatrix)rightSide.Multiply(leftSide);
@ -1124,12 +1124,12 @@ namespace MathNet.Numerics.LinearAlgebra.Double
{
if (leftSide == null)
{
throw new ArgumentNullException("leftSide");
throw new ArgumentNullException(nameof(leftSide));
}
if (rightSide == null)
{
throw new ArgumentNullException("rightSide");
throw new ArgumentNullException(nameof(rightSide));
}
if (leftSide._columnCount != rightSide._rowCount)
@ -1151,7 +1151,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double
{
if (leftSide == null)
{
throw new ArgumentNullException("leftSide");
throw new ArgumentNullException(nameof(leftSide));
}
return (DenseVector)leftSide.Multiply(rightSide);
@ -1168,7 +1168,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double
{
if (rightSide == null)
{
throw new ArgumentNullException("rightSide");
throw new ArgumentNullException(nameof(rightSide));
}
return (DenseVector)rightSide.LeftMultiply(leftSide);
@ -1185,7 +1185,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double
{
if (leftSide == null)
{
throw new ArgumentNullException("leftSide");
throw new ArgumentNullException(nameof(leftSide));
}
return (DenseMatrix)leftSide.Remainder(rightSide);

30
src/Numerics/LinearAlgebra/Double/DenseVector.cs

@ -45,7 +45,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double
/// A vector using dense storage.
/// </summary>
[Serializable]
[DebuggerDisplay("DenseVector {Count}-Double")]
[DebuggerDisplay("DenseVector {" + nameof(Count) + "}-Double")]
public class DenseVector : Vector
{
/// <summary>
@ -180,7 +180,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double
{
if (vector == null)
{
throw new ArgumentNullException("vector");
throw new ArgumentNullException(nameof(vector));
}
return vector.Values;
@ -197,7 +197,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double
{
if (array == null)
{
throw new ArgumentNullException("array");
throw new ArgumentNullException(nameof(array));
}
return new DenseVector(array);
@ -259,17 +259,17 @@ namespace MathNet.Numerics.LinearAlgebra.Double
{
if (rightSide == null)
{
throw new ArgumentNullException("rightSide");
throw new ArgumentNullException(nameof(rightSide));
}
if (leftSide == null)
{
throw new ArgumentNullException("leftSide");
throw new ArgumentNullException(nameof(leftSide));
}
if (leftSide.Count != rightSide.Count)
{
throw new ArgumentException(Resources.ArgumentVectorsSameLength, "rightSide");
throw new ArgumentException(Resources.ArgumentVectorsSameLength, nameof(rightSide));
}
return (DenseVector)leftSide.Add(rightSide);
@ -329,7 +329,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double
{
if (rightSide == null)
{
throw new ArgumentNullException("rightSide");
throw new ArgumentNullException(nameof(rightSide));
}
return (DenseVector)rightSide.Negate();
@ -347,7 +347,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double
{
if (leftSide == null)
{
throw new ArgumentNullException("leftSide");
throw new ArgumentNullException(nameof(leftSide));
}
return (DenseVector)leftSide.Subtract(rightSide);
@ -411,7 +411,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double
{
if (leftSide == null)
{
throw new ArgumentNullException("leftSide");
throw new ArgumentNullException(nameof(leftSide));
}
return (DenseVector)leftSide.Multiply(rightSide);
@ -428,7 +428,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double
{
if (rightSide == null)
{
throw new ArgumentNullException("rightSide");
throw new ArgumentNullException(nameof(rightSide));
}
return (DenseVector)rightSide.Multiply(leftSide);
@ -446,7 +446,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double
{
if (leftSide == null)
{
throw new ArgumentNullException("leftSide");
throw new ArgumentNullException(nameof(leftSide));
}
return leftSide.DotProduct(rightSide);
@ -463,7 +463,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double
{
if (leftSide == null)
{
throw new ArgumentNullException("leftSide");
throw new ArgumentNullException(nameof(leftSide));
}
return (DenseVector)leftSide.Divide(rightSide);
@ -530,7 +530,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double
{
if (leftSide == null)
{
throw new ArgumentNullException("leftSide");
throw new ArgumentNullException(nameof(leftSide));
}
return (DenseVector)leftSide.Remainder(rightSide);
@ -672,7 +672,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double
/// <returns>Scalar <c>ret = ( ∑|this[i]|^p )^(1/p)</c></returns>
public override double Norm(double p)
{
if (p < 0d) throw new ArgumentOutOfRangeException("p");
if (p < 0d) throw new ArgumentOutOfRangeException(nameof(p));
if (p == 1d) return L1Norm();
if (p == 2d) return L2Norm();
@ -766,7 +766,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double
{
if (value == null)
{
throw new ArgumentNullException("value");
throw new ArgumentNullException(nameof(value));
}
value = value.Trim();

4
src/Numerics/LinearAlgebra/Double/DiagonalMatrix.cs

@ -586,7 +586,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double
{
if (source.Length != _data.Length)
{
throw new ArgumentException(Resources.ArgumentArraysSameLength, "source");
throw new ArgumentException(Resources.ArgumentArraysSameLength, nameof(source));
}
Buffer.BlockCopy(source, 0, _data, 0, source.Length * Constants.SizeOfDouble);
@ -612,7 +612,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double
if (_data.Length != denseSource.Values.Length)
{
throw new ArgumentException(Resources.ArgumentVectorsSameLength, "source");
throw new ArgumentException(Resources.ArgumentVectorsSameLength, nameof(source));
}
Buffer.BlockCopy(denseSource.Values, 0, _data, 0, denseSource.Values.Length * Constants.SizeOfDouble);

10
src/Numerics/LinearAlgebra/Double/Factorization/DenseLU.cs

@ -54,7 +54,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Factorization
{
if (matrix == null)
{
throw new ArgumentNullException("matrix");
throw new ArgumentNullException(nameof(matrix));
}
if (matrix.RowCount != matrix.ColumnCount)
@ -87,12 +87,12 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Factorization
// Check for proper arguments.
if (input == null)
{
throw new ArgumentNullException("input");
throw new ArgumentNullException(nameof(input));
}
if (result == null)
{
throw new ArgumentNullException("result");
throw new ArgumentNullException(nameof(result));
}
// Check for proper dimensions.
@ -141,12 +141,12 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Factorization
// Check for proper arguments.
if (input == null)
{
throw new ArgumentNullException("input");
throw new ArgumentNullException(nameof(input));
}
if (result == null)
{
throw new ArgumentNullException("result");
throw new ArgumentNullException(nameof(result));
}
// Check for proper dimensions.

10
src/Numerics/LinearAlgebra/Double/Factorization/UserLU.cs

@ -53,7 +53,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Factorization
{
if (matrix == null)
{
throw new ArgumentNullException("matrix");
throw new ArgumentNullException(nameof(matrix));
}
if (matrix.RowCount != matrix.ColumnCount)
@ -145,12 +145,12 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Factorization
// Check for proper arguments.
if (input == null)
{
throw new ArgumentNullException("input");
throw new ArgumentNullException(nameof(input));
}
if (result == null)
{
throw new ArgumentNullException("result");
throw new ArgumentNullException(nameof(result));
}
// Check for proper dimensions.
@ -231,12 +231,12 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Factorization
// Check for proper arguments.
if (input == null)
{
throw new ArgumentNullException("input");
throw new ArgumentNullException(nameof(input));
}
if (result == null)
{
throw new ArgumentNullException("result");
throw new ArgumentNullException(nameof(result));
}
// Check for proper dimensions.

4
src/Numerics/LinearAlgebra/Double/Matrix.cs

@ -631,7 +631,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double
{
if (norm <= 0.0)
{
throw new ArgumentOutOfRangeException("norm", Resources.ArgumentMustBePositive);
throw new ArgumentOutOfRangeException(nameof(norm), Resources.ArgumentMustBePositive);
}
var ret = new double[RowCount];
@ -663,7 +663,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double
{
if (norm <= 0.0)
{
throw new ArgumentOutOfRangeException("norm", Resources.ArgumentMustBePositive);
throw new ArgumentOutOfRangeException(nameof(norm), Resources.ArgumentMustBePositive);
}
var ret = new double[ColumnCount];

2
src/Numerics/LinearAlgebra/Double/Solvers/BiCgStab.cs

@ -96,7 +96,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers
{
if (matrix.RowCount != matrix.ColumnCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSquare, "matrix");
throw new ArgumentException(Resources.ArgumentMatrixSquare, nameof(matrix));
}
if (result.Count != input.Count)

2
src/Numerics/LinearAlgebra/Double/Solvers/CompositeSolver.cs

@ -75,7 +75,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers
{
if (matrix.RowCount != matrix.ColumnCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSquare, "matrix");
throw new ArgumentException(Resources.ArgumentMatrixSquare, nameof(matrix));
}
if (result.Count != input.Count)

4
src/Numerics/LinearAlgebra/Double/Solvers/DiagonalPreconditioner.cs

@ -70,7 +70,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers
{
if (matrix.RowCount != matrix.ColumnCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSquare, "matrix");
throw new ArgumentException(Resources.ArgumentMatrixSquare, nameof(matrix));
}
_inverseDiagonals = new double[matrix.RowCount];
@ -94,7 +94,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers
if ((lhs.Count != rhs.Count) || (lhs.Count != _inverseDiagonals.Length))
{
throw new ArgumentException(Resources.ArgumentVectorsSameLength, "rhs");
throw new ArgumentException(Resources.ArgumentVectorsSameLength, nameof(rhs));
}
for (var i = 0; i < _inverseDiagonals.Length; i++)

6
src/Numerics/LinearAlgebra/Double/Solvers/GpBiCg.cs

@ -89,7 +89,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers
{
if (value < 0)
{
throw new ArgumentOutOfRangeException("value");
throw new ArgumentOutOfRangeException(nameof(value));
}
_numberOfBiCgStabSteps = value;
@ -111,7 +111,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers
{
if (value < 0)
{
throw new ArgumentOutOfRangeException("value");
throw new ArgumentOutOfRangeException(nameof(value));
}
_numberOfGpbiCgSteps = value;
@ -165,7 +165,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers
{
if (matrix.RowCount != matrix.ColumnCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSquare, "matrix");
throw new ArgumentException(Resources.ArgumentMatrixSquare, nameof(matrix));
}
if (result.Count != input.Count)

4
src/Numerics/LinearAlgebra/Double/Solvers/ILU0Preconditioner.cs

@ -103,12 +103,12 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers
{
if (matrix == null)
{
throw new ArgumentNullException("matrix");
throw new ArgumentNullException(nameof(matrix));
}
if (matrix.RowCount != matrix.ColumnCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSquare, "matrix");
throw new ArgumentException(Resources.ArgumentMatrixSquare, nameof(matrix));
}
_decompositionLU = SparseMatrix.OfMatrix(matrix);

18
src/Numerics/LinearAlgebra/Double/Solvers/ILUTPPreconditioner.cs

@ -120,17 +120,17 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers
{
if (fillLevel < 0)
{
throw new ArgumentOutOfRangeException("fillLevel");
throw new ArgumentOutOfRangeException(nameof(fillLevel));
}
if (dropTolerance < 0)
{
throw new ArgumentOutOfRangeException("dropTolerance");
throw new ArgumentOutOfRangeException(nameof(dropTolerance));
}
if (pivotTolerance < 0)
{
throw new ArgumentOutOfRangeException("pivotTolerance");
throw new ArgumentOutOfRangeException(nameof(pivotTolerance));
}
_fillLevel = fillLevel;
@ -165,7 +165,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers
{
if (value < 0)
{
throw new ArgumentOutOfRangeException("value");
throw new ArgumentOutOfRangeException(nameof(value));
}
_fillLevel = value;
@ -196,7 +196,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers
{
if (value < 0)
{
throw new ArgumentOutOfRangeException("value");
throw new ArgumentOutOfRangeException(nameof(value));
}
_dropTolerance = value;
@ -229,7 +229,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers
{
if (value < 0)
{
throw new ArgumentOutOfRangeException("value");
throw new ArgumentOutOfRangeException(nameof(value));
}
_pivotTolerance = value;
@ -293,12 +293,12 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers
{
if (matrix == null)
{
throw new ArgumentNullException("matrix");
throw new ArgumentNullException(nameof(matrix));
}
if (matrix.RowCount != matrix.ColumnCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSquare, "matrix");
throw new ArgumentException(Resources.ArgumentMatrixSquare, nameof(matrix));
}
var sparseMatrix = matrix as SparseMatrix ?? SparseMatrix.OfMatrix(matrix);
@ -621,7 +621,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers
if ((lhs.Count != rhs.Count) || (lhs.Count != _upper.RowCount))
{
throw new ArgumentException(Resources.ArgumentVectorsSameLength, "rhs");
throw new ArgumentException(Resources.ArgumentVectorsSameLength, nameof(rhs));
}
// Solve equation here

4
src/Numerics/LinearAlgebra/Double/Solvers/MILU0Preconditioner.cs

@ -84,14 +84,14 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers
var csr = matrix.Storage as SparseCompressedRowMatrixStorage<double>;
if (csr == null)
{
throw new ArgumentException(Resources.MatrixMustBeSparse, "matrix");
throw new ArgumentException(Resources.MatrixMustBeSparse, nameof(matrix));
}
// Dimension of matrix
int n = csr.RowCount;
if (n != csr.ColumnCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSquare, "matrix");
throw new ArgumentException(Resources.ArgumentMatrixSquare, nameof(matrix));
}
// Original matrix compressed sparse row storage.

4
src/Numerics/LinearAlgebra/Double/Solvers/MlkBiCgStab.cs

@ -97,7 +97,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers
{
if (value <= 1)
{
throw new ArgumentOutOfRangeException("value");
throw new ArgumentOutOfRangeException(nameof(value));
}
_numberOfStartingVectors = value;
@ -245,7 +245,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers
{
if (matrix.RowCount != matrix.ColumnCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSquare, "matrix");
throw new ArgumentException(Resources.ArgumentMatrixSquare, nameof(matrix));
}
if (result.Count != input.Count)

2
src/Numerics/LinearAlgebra/Double/Solvers/TFQMR.cs

@ -92,7 +92,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers
{
if (matrix.RowCount != matrix.ColumnCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSquare, "matrix");
throw new ArgumentException(Resources.ArgumentMatrixSquare, nameof(matrix));
}
if (result.Count != input.Count)

38
src/Numerics/LinearAlgebra/Double/SparseMatrix.cs

@ -390,7 +390,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double
{
if (result == null)
{
throw new ArgumentNullException("result");
throw new ArgumentNullException(nameof(result));
}
if (result.RowCount != RowCount || result.ColumnCount != ColumnCount)
@ -455,7 +455,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double
{
if (result == null)
{
throw new ArgumentNullException("result");
throw new ArgumentNullException(nameof(result));
}
if (result.RowCount != RowCount || result.ColumnCount != ColumnCount)
@ -521,7 +521,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double
{
if (result == null)
{
throw new ArgumentNullException("result");
throw new ArgumentNullException(nameof(result));
}
if (result.RowCount != RowCount || result.ColumnCount != ColumnCount)
@ -587,7 +587,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double
{
if (result == null)
{
throw new ArgumentNullException("result");
throw new ArgumentNullException(nameof(result));
}
if (result.RowCount != RowCount || result.ColumnCount != ColumnCount)
@ -1228,12 +1228,12 @@ namespace MathNet.Numerics.LinearAlgebra.Double
{
if (other == null)
{
throw new ArgumentNullException("other");
throw new ArgumentNullException(nameof(other));
}
if (result == null)
{
throw new ArgumentNullException("result");
throw new ArgumentNullException(nameof(result));
}
if (result.RowCount != (RowCount*other.RowCount) || result.ColumnCount != (ColumnCount*other.ColumnCount))
@ -1364,12 +1364,12 @@ namespace MathNet.Numerics.LinearAlgebra.Double
{
if (rightSide == null)
{
throw new ArgumentNullException("rightSide");
throw new ArgumentNullException(nameof(rightSide));
}
if (leftSide == null)
{
throw new ArgumentNullException("leftSide");
throw new ArgumentNullException(nameof(leftSide));
}
if (leftSide.RowCount != rightSide.RowCount || leftSide.ColumnCount != rightSide.ColumnCount)
@ -1390,7 +1390,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double
{
if (rightSide == null)
{
throw new ArgumentNullException("rightSide");
throw new ArgumentNullException(nameof(rightSide));
}
return (SparseMatrix)rightSide.Clone();
@ -1411,12 +1411,12 @@ namespace MathNet.Numerics.LinearAlgebra.Double
{
if (rightSide == null)
{
throw new ArgumentNullException("rightSide");
throw new ArgumentNullException(nameof(rightSide));
}
if (leftSide == null)
{
throw new ArgumentNullException("leftSide");
throw new ArgumentNullException(nameof(leftSide));
}
if (leftSide.RowCount != rightSide.RowCount || leftSide.ColumnCount != rightSide.ColumnCount)
@ -1437,7 +1437,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double
{
if (rightSide == null)
{
throw new ArgumentNullException("rightSide");
throw new ArgumentNullException(nameof(rightSide));
}
return (SparseMatrix)rightSide.Negate();
@ -1454,7 +1454,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double
{
if (leftSide == null)
{
throw new ArgumentNullException("leftSide");
throw new ArgumentNullException(nameof(leftSide));
}
return (SparseMatrix)leftSide.Multiply(rightSide);
@ -1471,7 +1471,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double
{
if (rightSide == null)
{
throw new ArgumentNullException("rightSide");
throw new ArgumentNullException(nameof(rightSide));
}
return (SparseMatrix)rightSide.Multiply(leftSide);
@ -1492,12 +1492,12 @@ namespace MathNet.Numerics.LinearAlgebra.Double
{
if (leftSide == null)
{
throw new ArgumentNullException("leftSide");
throw new ArgumentNullException(nameof(leftSide));
}
if (rightSide == null)
{
throw new ArgumentNullException("rightSide");
throw new ArgumentNullException(nameof(rightSide));
}
if (leftSide.ColumnCount != rightSide.RowCount)
@ -1519,7 +1519,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double
{
if (leftSide == null)
{
throw new ArgumentNullException("leftSide");
throw new ArgumentNullException(nameof(leftSide));
}
return (SparseVector)leftSide.Multiply(rightSide);
@ -1536,7 +1536,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double
{
if (rightSide == null)
{
throw new ArgumentNullException("rightSide");
throw new ArgumentNullException(nameof(rightSide));
}
return (SparseVector)rightSide.LeftMultiply(leftSide);
@ -1553,7 +1553,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double
{
if (leftSide == null)
{
throw new ArgumentNullException("leftSide");
throw new ArgumentNullException(nameof(leftSide));
}
return (SparseMatrix)leftSide.Remainder(rightSide);

20
src/Numerics/LinearAlgebra/Double/SparseVector.cs

@ -521,7 +521,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double
{
if (leftSide == null)
{
throw new ArgumentNullException("leftSide");
throw new ArgumentNullException(nameof(leftSide));
}
return (SparseVector)leftSide.Add(rightSide);
@ -537,7 +537,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double
{
if (rightSide == null)
{
throw new ArgumentNullException("rightSide");
throw new ArgumentNullException(nameof(rightSide));
}
return (SparseVector)rightSide.Negate();
@ -555,7 +555,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double
{
if (leftSide == null)
{
throw new ArgumentNullException("leftSide");
throw new ArgumentNullException(nameof(leftSide));
}
return (SparseVector)leftSide.Subtract(rightSide);
@ -572,7 +572,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double
{
if (leftSide == null)
{
throw new ArgumentNullException("leftSide");
throw new ArgumentNullException(nameof(leftSide));
}
return (SparseVector)leftSide.Multiply(rightSide);
@ -589,7 +589,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double
{
if (rightSide == null)
{
throw new ArgumentNullException("rightSide");
throw new ArgumentNullException(nameof(rightSide));
}
return (SparseVector)rightSide.Multiply(leftSide);
@ -607,7 +607,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double
{
if (leftSide == null)
{
throw new ArgumentNullException("leftSide");
throw new ArgumentNullException(nameof(leftSide));
}
return leftSide.DotProduct(rightSide);
@ -624,7 +624,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double
{
if (leftSide == null)
{
throw new ArgumentNullException("leftSide");
throw new ArgumentNullException(nameof(leftSide));
}
return (SparseVector)leftSide.Divide(rightSide);
@ -642,7 +642,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double
{
if (leftSide == null)
{
throw new ArgumentNullException("leftSide");
throw new ArgumentNullException(nameof(leftSide));
}
return (SparseVector)leftSide.Remainder(rightSide);
@ -796,7 +796,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double
/// <returns>Scalar <c>ret = ( ∑|this[i]|^p )^(1/p)</c></returns>
public override double Norm(double p)
{
if (p < 0d) throw new ArgumentOutOfRangeException("p");
if (p < 0d) throw new ArgumentOutOfRangeException(nameof(p));
if (_storage.ValueCount == 0)
{
@ -854,7 +854,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double
{
if (value == null)
{
throw new ArgumentNullException("value");
throw new ArgumentNullException(nameof(value));
}
value = value.Trim();

4
src/Numerics/LinearAlgebra/Double/Vector.cs

@ -553,7 +553,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double
/// </returns>
public override double Norm(double p)
{
if (p < 0d) throw new ArgumentOutOfRangeException("p");
if (p < 0d) throw new ArgumentOutOfRangeException(nameof(p));
if (p == 1d) return L1Norm();
if (p == 2d) return L2Norm();
@ -622,7 +622,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double
{
if (p < 0d)
{
throw new ArgumentOutOfRangeException("p");
throw new ArgumentOutOfRangeException(nameof(p));
}
double norm = Norm(p);

12
src/Numerics/LinearAlgebra/Matrix.Arithmetic.cs

@ -508,12 +508,12 @@ namespace MathNet.Numerics.LinearAlgebra
{
if (result.RowCount != RowCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSameRowDimension, "result");
throw new ArgumentException(Resources.ArgumentMatrixSameRowDimension, nameof(result));
}
if (result.ColumnCount != ColumnCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSameColumnDimension, "result");
throw new ArgumentException(Resources.ArgumentMatrixSameColumnDimension, nameof(result));
}
if (scalar.Equals(One))
@ -563,12 +563,12 @@ namespace MathNet.Numerics.LinearAlgebra
{
if (result.RowCount != RowCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSameRowDimension, "result");
throw new ArgumentException(Resources.ArgumentMatrixSameRowDimension, nameof(result));
}
if (result.ColumnCount != ColumnCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSameColumnDimension, "result");
throw new ArgumentException(Resources.ArgumentMatrixSameColumnDimension, nameof(result));
}
if (scalar.Equals(One))
@ -607,12 +607,12 @@ namespace MathNet.Numerics.LinearAlgebra
{
if (result.RowCount != RowCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSameRowDimension, "result");
throw new ArgumentException(Resources.ArgumentMatrixSameRowDimension, nameof(result));
}
if (result.ColumnCount != ColumnCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSameColumnDimension, "result");
throw new ArgumentException(Resources.ArgumentMatrixSameColumnDimension, nameof(result));
}
DoDivideByThis(scalar, result);

88
src/Numerics/LinearAlgebra/Matrix.cs

@ -163,7 +163,7 @@ namespace MathNet.Numerics.LinearAlgebra
{
if (rowIndex < 0 || rowIndex >= RowCount)
{
throw new ArgumentOutOfRangeException("rowIndex");
throw new ArgumentOutOfRangeException(nameof(rowIndex));
}
Storage.ClearUnchecked(rowIndex, 1, 0, ColumnCount);
@ -176,7 +176,7 @@ namespace MathNet.Numerics.LinearAlgebra
{
if (columnIndex < 0 || columnIndex >= ColumnCount)
{
throw new ArgumentOutOfRangeException("columnIndex");
throw new ArgumentOutOfRangeException(nameof(columnIndex));
}
Storage.ClearUnchecked(0, RowCount, columnIndex, 1);
@ -248,7 +248,7 @@ namespace MathNet.Numerics.LinearAlgebra
{
if (target == null)
{
throw new ArgumentNullException("target");
throw new ArgumentNullException(nameof(target));
}
Storage.CopyTo(target.Storage);
@ -265,7 +265,7 @@ namespace MathNet.Numerics.LinearAlgebra
{
if (index >= RowCount || index < 0)
{
throw new ArgumentOutOfRangeException("index");
throw new ArgumentOutOfRangeException(nameof(index));
}
var ret = Vector<T>.Build.SameAs(this, ColumnCount);
@ -286,7 +286,7 @@ namespace MathNet.Numerics.LinearAlgebra
{
if (result == null)
{
throw new ArgumentNullException("result");
throw new ArgumentNullException(nameof(result));
}
Storage.CopyRowTo(result.Storage, index);
@ -333,7 +333,7 @@ namespace MathNet.Numerics.LinearAlgebra
{
if (result == null)
{
throw new ArgumentNullException("result");
throw new ArgumentNullException(nameof(result));
}
Storage.CopySubRowTo(result.Storage, rowIndex, columnIndex, 0, length);
@ -350,7 +350,7 @@ namespace MathNet.Numerics.LinearAlgebra
{
if (index >= ColumnCount || index < 0)
{
throw new ArgumentOutOfRangeException("index");
throw new ArgumentOutOfRangeException(nameof(index));
}
var ret = Vector<T>.Build.SameAs(this, RowCount);
@ -371,7 +371,7 @@ namespace MathNet.Numerics.LinearAlgebra
{
if (result == null)
{
throw new ArgumentNullException("result");
throw new ArgumentNullException(nameof(result));
}
Storage.CopyColumnTo(result.Storage, index);
@ -419,7 +419,7 @@ namespace MathNet.Numerics.LinearAlgebra
{
if (result == null)
{
throw new ArgumentNullException("result");
throw new ArgumentNullException(nameof(result));
}
Storage.CopySubColumnTo(result.Storage, columnIndex, rowIndex, 0, length);
@ -469,7 +469,7 @@ namespace MathNet.Numerics.LinearAlgebra
{
if (result == null)
{
throw new ArgumentNullException("result");
throw new ArgumentNullException(nameof(result));
}
if (result.RowCount != RowCount || result.ColumnCount != ColumnCount)
@ -496,7 +496,7 @@ namespace MathNet.Numerics.LinearAlgebra
{
if (result == null)
{
throw new ArgumentNullException("result");
throw new ArgumentNullException(nameof(result));
}
if (result.RowCount != RowCount || result.ColumnCount != ColumnCount)
@ -584,7 +584,7 @@ namespace MathNet.Numerics.LinearAlgebra
{
if (result == null)
{
throw new ArgumentNullException("result");
throw new ArgumentNullException(nameof(result));
}
if (result.RowCount != RowCount || result.ColumnCount != ColumnCount)
@ -629,7 +629,7 @@ namespace MathNet.Numerics.LinearAlgebra
{
if (result == null)
{
throw new ArgumentNullException("result");
throw new ArgumentNullException(nameof(result));
}
if (result.RowCount != RowCount || result.ColumnCount != ColumnCount)
@ -659,17 +659,17 @@ namespace MathNet.Numerics.LinearAlgebra
{
if (column == null)
{
throw new ArgumentNullException("column");
throw new ArgumentNullException(nameof(column));
}
if (columnIndex < 0 || columnIndex > ColumnCount)
{
throw new ArgumentOutOfRangeException("columnIndex");
throw new ArgumentOutOfRangeException(nameof(columnIndex));
}
if (column.Count != RowCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSameRowDimension, "column");
throw new ArgumentException(Resources.ArgumentMatrixSameRowDimension, nameof(column));
}
var result = Build.SameAs(this, RowCount, ColumnCount + 1, fullyMutable: true);
@ -689,7 +689,7 @@ namespace MathNet.Numerics.LinearAlgebra
{
if (columnIndex < 0 || columnIndex >= ColumnCount)
{
throw new ArgumentOutOfRangeException("columnIndex");
throw new ArgumentOutOfRangeException(nameof(columnIndex));
}
var result = Build.SameAs(this, RowCount, ColumnCount - 1, fullyMutable: true);
@ -712,7 +712,7 @@ namespace MathNet.Numerics.LinearAlgebra
{
if (column == null)
{
throw new ArgumentNullException("column");
throw new ArgumentNullException(nameof(column));
}
column.Storage.CopyToColumn(Storage, columnIndex);
@ -734,7 +734,7 @@ namespace MathNet.Numerics.LinearAlgebra
{
if (column == null)
{
throw new ArgumentNullException("column");
throw new ArgumentNullException(nameof(column));
}
column.Storage.CopyToSubColumn(Storage, columnIndex, 0, rowIndex, length);
@ -756,7 +756,7 @@ namespace MathNet.Numerics.LinearAlgebra
{
if (column == null)
{
throw new ArgumentNullException("column");
throw new ArgumentNullException(nameof(column));
}
new DenseVectorStorage<T>(column.Length, column).CopyToColumn(Storage, columnIndex);
@ -775,17 +775,17 @@ namespace MathNet.Numerics.LinearAlgebra
{
if (row == null)
{
throw new ArgumentNullException("row");
throw new ArgumentNullException(nameof(row));
}
if (rowIndex < 0 || rowIndex > RowCount)
{
throw new ArgumentOutOfRangeException("rowIndex");
throw new ArgumentOutOfRangeException(nameof(rowIndex));
}
if (row.Count != ColumnCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSameRowDimension, "row");
throw new ArgumentException(Resources.ArgumentMatrixSameRowDimension, nameof(row));
}
var result = Build.SameAs(this, RowCount + 1, ColumnCount, fullyMutable: true);
@ -805,7 +805,7 @@ namespace MathNet.Numerics.LinearAlgebra
{
if (rowIndex < 0 || rowIndex >= RowCount)
{
throw new ArgumentOutOfRangeException("rowIndex");
throw new ArgumentOutOfRangeException(nameof(rowIndex));
}
var result = Build.SameAs(this, RowCount - 1, ColumnCount, fullyMutable: true);
@ -828,7 +828,7 @@ namespace MathNet.Numerics.LinearAlgebra
{
if (row == null)
{
throw new ArgumentNullException("row");
throw new ArgumentNullException(nameof(row));
}
row.Storage.CopyToRow(Storage, rowIndex);
@ -850,7 +850,7 @@ namespace MathNet.Numerics.LinearAlgebra
{
if (row == null)
{
throw new ArgumentNullException("row");
throw new ArgumentNullException(nameof(row));
}
row.Storage.CopyToSubRow(Storage, rowIndex, 0, columnIndex, length);
@ -871,7 +871,7 @@ namespace MathNet.Numerics.LinearAlgebra
{
if (row == null)
{
throw new ArgumentNullException("row");
throw new ArgumentNullException(nameof(row));
}
new DenseVectorStorage<T>(row.Length, row).CopyToRow(Storage, rowIndex);
@ -954,14 +954,14 @@ namespace MathNet.Numerics.LinearAlgebra
{
if (source == null)
{
throw new ArgumentNullException("source");
throw new ArgumentNullException(nameof(source));
}
var min = Math.Min(RowCount, ColumnCount);
if (source.Count != min)
{
throw new ArgumentException(Resources.ArgumentVectorsSameLength, "source");
throw new ArgumentException(Resources.ArgumentVectorsSameLength, nameof(source));
}
for (var i = 0; i < min; i++)
@ -984,14 +984,14 @@ namespace MathNet.Numerics.LinearAlgebra
{
if (source == null)
{
throw new ArgumentNullException("source");
throw new ArgumentNullException(nameof(source));
}
var min = Math.Min(RowCount, ColumnCount);
if (source.Length != min)
{
throw new ArgumentException(Resources.ArgumentArraysSameLength, "source");
throw new ArgumentException(Resources.ArgumentArraysSameLength, nameof(source));
}
for (var i = 0; i < min; i++)
@ -1038,7 +1038,7 @@ namespace MathNet.Numerics.LinearAlgebra
{
if (p.Dimension != RowCount)
{
throw new ArgumentException(Resources.ArgumentArraysSameLength, "p");
throw new ArgumentException(Resources.ArgumentArraysSameLength, nameof(p));
}
// Get a sequence of inversions from the permutation.
@ -1067,7 +1067,7 @@ namespace MathNet.Numerics.LinearAlgebra
{
if (p.Dimension != ColumnCount)
{
throw new ArgumentException(Resources.ArgumentArraysSameLength, "p");
throw new ArgumentException(Resources.ArgumentArraysSameLength, nameof(p));
}
// Get a sequence of inversions from the permutation.
@ -1099,7 +1099,7 @@ namespace MathNet.Numerics.LinearAlgebra
{
if (right == null)
{
throw new ArgumentNullException("right");
throw new ArgumentNullException(nameof(right));
}
if (right.RowCount != RowCount)
@ -1124,7 +1124,7 @@ namespace MathNet.Numerics.LinearAlgebra
{
if (right == null)
{
throw new ArgumentNullException("right");
throw new ArgumentNullException(nameof(right));
}
if (right.RowCount != RowCount)
@ -1134,7 +1134,7 @@ namespace MathNet.Numerics.LinearAlgebra
if (result == null)
{
throw new ArgumentNullException("result");
throw new ArgumentNullException(nameof(result));
}
if (result.ColumnCount != (ColumnCount + right.ColumnCount) || result.RowCount != RowCount)
@ -1159,12 +1159,12 @@ namespace MathNet.Numerics.LinearAlgebra
{
if (lower == null)
{
throw new ArgumentNullException("lower");
throw new ArgumentNullException(nameof(lower));
}
if (lower.ColumnCount != ColumnCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSameColumnDimension, "lower");
throw new ArgumentException(Resources.ArgumentMatrixSameColumnDimension, nameof(lower));
}
var result = Build.SameAs(this, lower, RowCount + lower.RowCount, ColumnCount, fullyMutable: true);
@ -1186,17 +1186,17 @@ namespace MathNet.Numerics.LinearAlgebra
{
if (lower == null)
{
throw new ArgumentNullException("lower");
throw new ArgumentNullException(nameof(lower));
}
if (lower.ColumnCount != ColumnCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSameColumnDimension, "lower");
throw new ArgumentException(Resources.ArgumentMatrixSameColumnDimension, nameof(lower));
}
if (result == null)
{
throw new ArgumentNullException("result");
throw new ArgumentNullException(nameof(result));
}
if (result.RowCount != (RowCount + lower.RowCount) || result.ColumnCount != ColumnCount)
@ -1222,7 +1222,7 @@ namespace MathNet.Numerics.LinearAlgebra
{
if (lower == null)
{
throw new ArgumentNullException("lower");
throw new ArgumentNullException(nameof(lower));
}
var result = Build.SameAs(this, lower, RowCount + lower.RowCount, ColumnCount + lower.ColumnCount, RowCount != ColumnCount);
@ -1245,12 +1245,12 @@ namespace MathNet.Numerics.LinearAlgebra
{
if (lower == null)
{
throw new ArgumentNullException("lower");
throw new ArgumentNullException(nameof(lower));
}
if (result == null)
{
throw new ArgumentNullException("result");
throw new ArgumentNullException(nameof(result));
}
if (result.RowCount != RowCount + lower.RowCount || result.ColumnCount != ColumnCount + lower.ColumnCount)

26
src/Numerics/LinearAlgebra/Single/DenseMatrix.cs

@ -996,12 +996,12 @@ namespace MathNet.Numerics.LinearAlgebra.Single
{
if (rightSide == null)
{
throw new ArgumentNullException("rightSide");
throw new ArgumentNullException(nameof(rightSide));
}
if (leftSide == null)
{
throw new ArgumentNullException("leftSide");
throw new ArgumentNullException(nameof(leftSide));
}
if (leftSide._rowCount != rightSide._rowCount || leftSide._columnCount != rightSide._columnCount)
@ -1022,7 +1022,7 @@ namespace MathNet.Numerics.LinearAlgebra.Single
{
if (rightSide == null)
{
throw new ArgumentNullException("rightSide");
throw new ArgumentNullException(nameof(rightSide));
}
return (DenseMatrix)rightSide.Clone();
@ -1043,12 +1043,12 @@ namespace MathNet.Numerics.LinearAlgebra.Single
{
if (rightSide == null)
{
throw new ArgumentNullException("rightSide");
throw new ArgumentNullException(nameof(rightSide));
}
if (leftSide == null)
{
throw new ArgumentNullException("leftSide");
throw new ArgumentNullException(nameof(leftSide));
}
if (leftSide._rowCount != rightSide._rowCount || leftSide._columnCount != rightSide._columnCount)
@ -1069,7 +1069,7 @@ namespace MathNet.Numerics.LinearAlgebra.Single
{
if (rightSide == null)
{
throw new ArgumentNullException("rightSide");
throw new ArgumentNullException(nameof(rightSide));
}
return (DenseMatrix)rightSide.Negate();
@ -1086,7 +1086,7 @@ namespace MathNet.Numerics.LinearAlgebra.Single
{
if (leftSide == null)
{
throw new ArgumentNullException("leftSide");
throw new ArgumentNullException(nameof(leftSide));
}
return (DenseMatrix)leftSide.Multiply(rightSide);
@ -1103,7 +1103,7 @@ namespace MathNet.Numerics.LinearAlgebra.Single
{
if (rightSide == null)
{
throw new ArgumentNullException("rightSide");
throw new ArgumentNullException(nameof(rightSide));
}
return (DenseMatrix)rightSide.Multiply(leftSide);
@ -1124,12 +1124,12 @@ namespace MathNet.Numerics.LinearAlgebra.Single
{
if (leftSide == null)
{
throw new ArgumentNullException("leftSide");
throw new ArgumentNullException(nameof(leftSide));
}
if (rightSide == null)
{
throw new ArgumentNullException("rightSide");
throw new ArgumentNullException(nameof(rightSide));
}
if (leftSide._columnCount != rightSide._rowCount)
@ -1151,7 +1151,7 @@ namespace MathNet.Numerics.LinearAlgebra.Single
{
if (leftSide == null)
{
throw new ArgumentNullException("leftSide");
throw new ArgumentNullException(nameof(leftSide));
}
return (DenseVector)leftSide.Multiply(rightSide);
@ -1168,7 +1168,7 @@ namespace MathNet.Numerics.LinearAlgebra.Single
{
if (rightSide == null)
{
throw new ArgumentNullException("rightSide");
throw new ArgumentNullException(nameof(rightSide));
}
return (DenseVector)rightSide.LeftMultiply(leftSide);
@ -1185,7 +1185,7 @@ namespace MathNet.Numerics.LinearAlgebra.Single
{
if (leftSide == null)
{
throw new ArgumentNullException("leftSide");
throw new ArgumentNullException(nameof(leftSide));
}
return (DenseMatrix)leftSide.Remainder(rightSide);

26
src/Numerics/LinearAlgebra/Single/DenseVector.cs

@ -45,7 +45,7 @@ namespace MathNet.Numerics.LinearAlgebra.Single
/// A vector using dense storage.
/// </summary>
[Serializable]
[DebuggerDisplay("DenseVector {Count}-Single")]
[DebuggerDisplay("DenseVector {" + nameof(Count) + "}-Single")]
public class DenseVector : Vector
{
/// <summary>
@ -180,7 +180,7 @@ namespace MathNet.Numerics.LinearAlgebra.Single
{
if (vector == null)
{
throw new ArgumentNullException("vector");
throw new ArgumentNullException(nameof(vector));
}
return vector.Values;
@ -197,7 +197,7 @@ namespace MathNet.Numerics.LinearAlgebra.Single
{
if (array == null)
{
throw new ArgumentNullException("array");
throw new ArgumentNullException(nameof(array));
}
return new DenseVector(array);
@ -259,7 +259,7 @@ namespace MathNet.Numerics.LinearAlgebra.Single
{
if (leftSide == null)
{
throw new ArgumentNullException("leftSide");
throw new ArgumentNullException(nameof(leftSide));
}
return (DenseVector)leftSide.Add(rightSide);
@ -319,7 +319,7 @@ namespace MathNet.Numerics.LinearAlgebra.Single
{
if (rightSide == null)
{
throw new ArgumentNullException("rightSide");
throw new ArgumentNullException(nameof(rightSide));
}
return (DenseVector)rightSide.Negate();
@ -337,7 +337,7 @@ namespace MathNet.Numerics.LinearAlgebra.Single
{
if (leftSide == null)
{
throw new ArgumentNullException("leftSide");
throw new ArgumentNullException(nameof(leftSide));
}
return (DenseVector)leftSide.Subtract(rightSide);
@ -401,7 +401,7 @@ namespace MathNet.Numerics.LinearAlgebra.Single
{
if (leftSide == null)
{
throw new ArgumentNullException("leftSide");
throw new ArgumentNullException(nameof(leftSide));
}
return (DenseVector)leftSide.Multiply(rightSide);
@ -418,7 +418,7 @@ namespace MathNet.Numerics.LinearAlgebra.Single
{
if (rightSide == null)
{
throw new ArgumentNullException("rightSide");
throw new ArgumentNullException(nameof(rightSide));
}
return (DenseVector)rightSide.Multiply(leftSide);
@ -436,7 +436,7 @@ namespace MathNet.Numerics.LinearAlgebra.Single
{
if (leftSide == null)
{
throw new ArgumentNullException("leftSide");
throw new ArgumentNullException(nameof(leftSide));
}
return leftSide.DotProduct(rightSide);
@ -453,7 +453,7 @@ namespace MathNet.Numerics.LinearAlgebra.Single
{
if (leftSide == null)
{
throw new ArgumentNullException("leftSide");
throw new ArgumentNullException(nameof(leftSide));
}
return (DenseVector)leftSide.Divide(rightSide);
@ -521,7 +521,7 @@ namespace MathNet.Numerics.LinearAlgebra.Single
{
if (leftSide == null)
{
throw new ArgumentNullException("leftSide");
throw new ArgumentNullException(nameof(leftSide));
}
return (DenseVector)leftSide.Remainder(rightSide);
@ -663,7 +663,7 @@ namespace MathNet.Numerics.LinearAlgebra.Single
/// <returns>Scalar <c>ret = ( ∑|this[i]|^p )^(1/p)</c></returns>
public override double Norm(double p)
{
if (p < 0d) throw new ArgumentOutOfRangeException("p");
if (p < 0d) throw new ArgumentOutOfRangeException(nameof(p));
if (p == 1d) return L1Norm();
if (p == 2d) return L2Norm();
@ -757,7 +757,7 @@ namespace MathNet.Numerics.LinearAlgebra.Single
{
if (value == null)
{
throw new ArgumentNullException("value");
throw new ArgumentNullException(nameof(value));
}
value = value.Trim();

4
src/Numerics/LinearAlgebra/Single/DiagonalMatrix.cs

@ -586,7 +586,7 @@ namespace MathNet.Numerics.LinearAlgebra.Single
{
if (source.Length != _data.Length)
{
throw new ArgumentException(Resources.ArgumentArraysSameLength, "source");
throw new ArgumentException(Resources.ArgumentArraysSameLength, nameof(source));
}
Buffer.BlockCopy(source, 0, _data, 0, source.Length * Constants.SizeOfFloat);
@ -612,7 +612,7 @@ namespace MathNet.Numerics.LinearAlgebra.Single
if (_data.Length != denseSource.Values.Length)
{
throw new ArgumentException(Resources.ArgumentVectorsSameLength, "source");
throw new ArgumentException(Resources.ArgumentVectorsSameLength, nameof(source));
}
Buffer.BlockCopy(denseSource.Values, 0, _data, 0, denseSource.Values.Length * Constants.SizeOfFloat);

10
src/Numerics/LinearAlgebra/Single/Factorization/DenseLU.cs

@ -54,7 +54,7 @@ namespace MathNet.Numerics.LinearAlgebra.Single.Factorization
{
if (matrix == null)
{
throw new ArgumentNullException("matrix");
throw new ArgumentNullException(nameof(matrix));
}
if (matrix.RowCount != matrix.ColumnCount)
@ -87,12 +87,12 @@ namespace MathNet.Numerics.LinearAlgebra.Single.Factorization
// Check for proper arguments.
if (input == null)
{
throw new ArgumentNullException("input");
throw new ArgumentNullException(nameof(input));
}
if (result == null)
{
throw new ArgumentNullException("result");
throw new ArgumentNullException(nameof(result));
}
// Check for proper dimensions.
@ -141,12 +141,12 @@ namespace MathNet.Numerics.LinearAlgebra.Single.Factorization
// Check for proper arguments.
if (input == null)
{
throw new ArgumentNullException("input");
throw new ArgumentNullException(nameof(input));
}
if (result == null)
{
throw new ArgumentNullException("result");
throw new ArgumentNullException(nameof(result));
}
// Check for proper dimensions.

10
src/Numerics/LinearAlgebra/Single/Factorization/UserLU.cs

@ -53,7 +53,7 @@ namespace MathNet.Numerics.LinearAlgebra.Single.Factorization
{
if (matrix == null)
{
throw new ArgumentNullException("matrix");
throw new ArgumentNullException(nameof(matrix));
}
if (matrix.RowCount != matrix.ColumnCount)
@ -145,12 +145,12 @@ namespace MathNet.Numerics.LinearAlgebra.Single.Factorization
// Check for proper arguments.
if (input == null)
{
throw new ArgumentNullException("input");
throw new ArgumentNullException(nameof(input));
}
if (result == null)
{
throw new ArgumentNullException("result");
throw new ArgumentNullException(nameof(result));
}
// Check for proper dimensions.
@ -231,12 +231,12 @@ namespace MathNet.Numerics.LinearAlgebra.Single.Factorization
// Check for proper arguments.
if (input == null)
{
throw new ArgumentNullException("input");
throw new ArgumentNullException(nameof(input));
}
if (result == null)
{
throw new ArgumentNullException("result");
throw new ArgumentNullException(nameof(result));
}
// Check for proper dimensions.

4
src/Numerics/LinearAlgebra/Single/Matrix.cs

@ -632,7 +632,7 @@ namespace MathNet.Numerics.LinearAlgebra.Single
{
if (norm <= 0.0)
{
throw new ArgumentOutOfRangeException("norm", Resources.ArgumentMustBePositive);
throw new ArgumentOutOfRangeException(nameof(norm), Resources.ArgumentMustBePositive);
}
var ret = new double[RowCount];
@ -664,7 +664,7 @@ namespace MathNet.Numerics.LinearAlgebra.Single
{
if (norm <= 0.0)
{
throw new ArgumentOutOfRangeException("norm", Resources.ArgumentMustBePositive);
throw new ArgumentOutOfRangeException(nameof(norm), Resources.ArgumentMustBePositive);
}
var ret = new double[ColumnCount];

2
src/Numerics/LinearAlgebra/Single/Solvers/BiCgStab.cs

@ -96,7 +96,7 @@ namespace MathNet.Numerics.LinearAlgebra.Single.Solvers
{
if (matrix.RowCount != matrix.ColumnCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSquare, "matrix");
throw new ArgumentException(Resources.ArgumentMatrixSquare, nameof(matrix));
}
if (result.Count != input.Count)

2
src/Numerics/LinearAlgebra/Single/Solvers/CompositeSolver.cs

@ -75,7 +75,7 @@ namespace MathNet.Numerics.LinearAlgebra.Single.Solvers
{
if (matrix.RowCount != matrix.ColumnCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSquare, "matrix");
throw new ArgumentException(Resources.ArgumentMatrixSquare, nameof(matrix));
}
if (result.Count != input.Count)

4
src/Numerics/LinearAlgebra/Single/Solvers/DiagonalPreconditioner.cs

@ -70,7 +70,7 @@ namespace MathNet.Numerics.LinearAlgebra.Single.Solvers
{
if (matrix.RowCount != matrix.ColumnCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSquare, "matrix");
throw new ArgumentException(Resources.ArgumentMatrixSquare, nameof(matrix));
}
_inverseDiagonals = new float[matrix.RowCount];
@ -94,7 +94,7 @@ namespace MathNet.Numerics.LinearAlgebra.Single.Solvers
if ((lhs.Count != rhs.Count) || (lhs.Count != _inverseDiagonals.Length))
{
throw new ArgumentException(Resources.ArgumentVectorsSameLength, "rhs");
throw new ArgumentException(Resources.ArgumentVectorsSameLength, nameof(rhs));
}
for (var i = 0; i < _inverseDiagonals.Length; i++)

6
src/Numerics/LinearAlgebra/Single/Solvers/GpBiCg.cs

@ -86,7 +86,7 @@ namespace MathNet.Numerics.LinearAlgebra.Single.Solvers
{
if (value < 0)
{
throw new ArgumentOutOfRangeException("value");
throw new ArgumentOutOfRangeException(nameof(value));
}
_numberOfBiCgStabSteps = value;
@ -105,7 +105,7 @@ namespace MathNet.Numerics.LinearAlgebra.Single.Solvers
{
if (value < 0)
{
throw new ArgumentOutOfRangeException("value");
throw new ArgumentOutOfRangeException(nameof(value));
}
_numberOfGpbiCgSteps = value;
@ -159,7 +159,7 @@ namespace MathNet.Numerics.LinearAlgebra.Single.Solvers
{
if (matrix.RowCount != matrix.ColumnCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSquare, "matrix");
throw new ArgumentException(Resources.ArgumentMatrixSquare, nameof(matrix));
}
if (result.Count != input.Count)

4
src/Numerics/LinearAlgebra/Single/Solvers/ILU0Preconditioner.cs

@ -103,12 +103,12 @@ namespace MathNet.Numerics.LinearAlgebra.Single.Solvers
{
if (matrix == null)
{
throw new ArgumentNullException("matrix");
throw new ArgumentNullException(nameof(matrix));
}
if (matrix.RowCount != matrix.ColumnCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSquare, "matrix");
throw new ArgumentException(Resources.ArgumentMatrixSquare, nameof(matrix));
}
_decompositionLU = SparseMatrix.OfMatrix(matrix);

18
src/Numerics/LinearAlgebra/Single/Solvers/ILUTPPreconditioner.cs

@ -120,17 +120,17 @@ namespace MathNet.Numerics.LinearAlgebra.Single.Solvers
{
if (fillLevel < 0)
{
throw new ArgumentOutOfRangeException("fillLevel");
throw new ArgumentOutOfRangeException(nameof(fillLevel));
}
if (dropTolerance < 0)
{
throw new ArgumentOutOfRangeException("dropTolerance");
throw new ArgumentOutOfRangeException(nameof(dropTolerance));
}
if (pivotTolerance < 0)
{
throw new ArgumentOutOfRangeException("pivotTolerance");
throw new ArgumentOutOfRangeException(nameof(pivotTolerance));
}
_fillLevel = fillLevel;
@ -165,7 +165,7 @@ namespace MathNet.Numerics.LinearAlgebra.Single.Solvers
{
if (value < 0)
{
throw new ArgumentOutOfRangeException("value");
throw new ArgumentOutOfRangeException(nameof(value));
}
_fillLevel = value;
@ -196,7 +196,7 @@ namespace MathNet.Numerics.LinearAlgebra.Single.Solvers
{
if (value < 0)
{
throw new ArgumentOutOfRangeException("value");
throw new ArgumentOutOfRangeException(nameof(value));
}
_dropTolerance = value;
@ -229,7 +229,7 @@ namespace MathNet.Numerics.LinearAlgebra.Single.Solvers
{
if (value < 0)
{
throw new ArgumentOutOfRangeException("value");
throw new ArgumentOutOfRangeException(nameof(value));
}
_pivotTolerance = value;
@ -293,12 +293,12 @@ namespace MathNet.Numerics.LinearAlgebra.Single.Solvers
{
if (matrix == null)
{
throw new ArgumentNullException("matrix");
throw new ArgumentNullException(nameof(matrix));
}
if (matrix.RowCount != matrix.ColumnCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSquare, "matrix");
throw new ArgumentException(Resources.ArgumentMatrixSquare, nameof(matrix));
}
SparseMatrix sparseMatrix = matrix as SparseMatrix ?? SparseMatrix.OfMatrix(matrix);
@ -621,7 +621,7 @@ namespace MathNet.Numerics.LinearAlgebra.Single.Solvers
if ((lhs.Count != rhs.Count) || (lhs.Count != _upper.RowCount))
{
throw new ArgumentException(Resources.ArgumentVectorsSameLength, "rhs");
throw new ArgumentException(Resources.ArgumentVectorsSameLength, nameof(rhs));
}
// Solve equation here

4
src/Numerics/LinearAlgebra/Single/Solvers/MILU0Preconditioner.cs

@ -84,14 +84,14 @@ namespace MathNet.Numerics.LinearAlgebra.Single.Solvers
var csr = matrix.Storage as SparseCompressedRowMatrixStorage<float>;
if (csr == null)
{
throw new ArgumentException(Resources.MatrixMustBeSparse, "matrix");
throw new ArgumentException(Resources.MatrixMustBeSparse, nameof(matrix));
}
// Dimension of matrix
int n = csr.RowCount;
if (n != csr.ColumnCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSquare, "matrix");
throw new ArgumentException(Resources.ArgumentMatrixSquare, nameof(matrix));
}
// Original matrix compressed sparse row storage.

4
src/Numerics/LinearAlgebra/Single/Solvers/MlkBiCgStab.cs

@ -96,7 +96,7 @@ namespace MathNet.Numerics.LinearAlgebra.Single.Solvers
{
if (value <= 1)
{
throw new ArgumentOutOfRangeException("value");
throw new ArgumentOutOfRangeException(nameof(value));
}
_numberOfStartingVectors = value;
@ -248,7 +248,7 @@ namespace MathNet.Numerics.LinearAlgebra.Single.Solvers
{
if (matrix.RowCount != matrix.ColumnCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSquare, "matrix");
throw new ArgumentException(Resources.ArgumentMatrixSquare, nameof(matrix));
}
if (result.Count != input.Count)

2
src/Numerics/LinearAlgebra/Single/Solvers/TFQMR.cs

@ -92,7 +92,7 @@ namespace MathNet.Numerics.LinearAlgebra.Single.Solvers
{
if (matrix.RowCount != matrix.ColumnCount)
{
throw new ArgumentException(Resources.ArgumentMatrixSquare, "matrix");
throw new ArgumentException(Resources.ArgumentMatrixSquare, nameof(matrix));
}
if (result.Count != input.Count)

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

Loading…
Cancel
Save