Browse Source

Maintenance: minor code style fixes

pull/375/head
Christoph Ruegg 11 years ago
parent
commit
a72d01495d
  1. 64
      src/Numerics/Differentiation/NumericalDerivative.cs
  2. 4
      src/Numerics/Distributions/Beta.cs
  3. 4
      src/Numerics/LinearAlgebra/Complex/DiagonalMatrix.cs
  4. 18
      src/Numerics/LinearAlgebra/Complex/Matrix.cs
  5. 20
      src/Numerics/LinearAlgebra/Complex/Solvers/ILUTPPreconditioner.cs
  6. 12
      src/Numerics/LinearAlgebra/Complex/Vector.cs
  7. 4
      src/Numerics/LinearAlgebra/Complex32/DiagonalMatrix.cs
  8. 18
      src/Numerics/LinearAlgebra/Complex32/Matrix.cs
  9. 20
      src/Numerics/LinearAlgebra/Complex32/Solvers/ILUTPPreconditioner.cs
  10. 12
      src/Numerics/LinearAlgebra/Complex32/Vector.cs
  11. 2
      src/Numerics/LinearAlgebra/Double/DiagonalMatrix.cs
  12. 16
      src/Numerics/LinearAlgebra/Double/Matrix.cs
  13. 20
      src/Numerics/LinearAlgebra/Double/Solvers/ILUTPPreconditioner.cs
  14. 4
      src/Numerics/LinearAlgebra/Double/Vector.cs
  15. 2
      src/Numerics/LinearAlgebra/Matrix.BCL.cs
  16. 2
      src/Numerics/LinearAlgebra/Single/DiagonalMatrix.cs
  17. 16
      src/Numerics/LinearAlgebra/Single/Matrix.cs
  18. 20
      src/Numerics/LinearAlgebra/Single/Solvers/ILUTPPreconditioner.cs
  19. 4
      src/Numerics/LinearAlgebra/Single/Vector.cs
  20. 2
      src/Numerics/LinearAlgebra/Storage/MatrixStorage.cs
  21. 2
      src/Numerics/LinearAlgebra/Storage/VectorStorage.cs
  22. 6
      src/Numerics/LinearAlgebra/Vector.BCL.cs
  23. 2
      src/Numerics/Permutation.cs
  24. 8
      src/Numerics/Statistics/MCMC/HybridMC.cs
  25. 14
      src/Numerics/Statistics/MCMC/HybridMCGeneric.cs
  26. 6
      src/Numerics/Statistics/MCMC/MCMCDiagnostics.cs
  27. 2
      src/Numerics/Statistics/MCMC/UnivariateHybridMC.cs

64
src/Numerics/Differentiation/NumericalDerivative.cs

@ -68,6 +68,39 @@ namespace MathNet.Numerics.Differentiation
/// </summary>
public class NumericalDerivative
{
readonly int _points;
int _center;
double _stepSize = Math.Pow(2, -10);
double _epsilon = Precision.PositiveMachineEpsilon;
double _baseStepSize = Math.Pow(2, -26);
StepType _stepType = StepType.Relative;
readonly FiniteDifferenceCoefficients _coefficients;
/// <summary>
/// Initializes a NumericalDerivative class with the default 3 point center difference method.
/// </summary>
public NumericalDerivative() : this(3, 1)
{
}
/// <summary>
/// Initialized a NumericalDerivative class.
/// </summary>
/// <param name="points">Number of points for finite difference derivatives.</param>
/// <param name="center">Location of the center with respect to other points. Value ranges from zero to points-1.</param>
public NumericalDerivative(int points, int center)
{
if (points < 2)
{
throw new ArgumentOutOfRangeException("points", "Points must be two or greater.");
}
_center = center;
_points = points;
Center = center;
_coefficients = new FiniteDifferenceCoefficients(points);
}
/// <summary>
/// Sets and gets the finite difference step size. This value is for each function evaluation if relative stepsize types are used.
/// If the base step size used in scaling is desired, see <see cref="Epsilon"/>.
@ -147,37 +180,6 @@ namespace MathNet.Numerics.Differentiation
set { _stepType = value; }
}
private readonly int _points;
private int _center;
private double _stepSize = Math.Pow(2, -10);
private double _epsilon = Math.Pow(2, -52);
private double _baseStepSize = Math.Pow(2, -26);
private StepType _stepType = StepType.Relative;
private readonly FiniteDifferenceCoefficients _coefficients;
/// <summary>
/// Initializes a NumericalDerivative class with the default 3 point center difference method.
/// </summary>
public NumericalDerivative() : this(3, 1)
{
}
/// <summary>
/// Initialized a NumericalDerivative class.
/// </summary>
/// <param name="points">Number of points for finite difference derivatives.</param>
/// <param name="center">Location of the center with respect to other points. Value ranges from zero to points-1.</param>
public NumericalDerivative(int points, int center)
{
_center = center;
if (points < 2)
throw new ArgumentOutOfRangeException("points", "Points must be two or greater.");
_points = points;
Center = center;
_epsilon = Precision.PositiveMachineEpsilon;
_coefficients = new FiniteDifferenceCoefficients(points);
}
/// <summary>
/// Evaluates the derivative of equidistant points using the finite difference method.
/// </summary>

4
src/Numerics/Distributions/Beta.cs

@ -413,14 +413,14 @@ namespace MathNet.Numerics.Distributions
/// <param name="a">The α shape parameter of the Beta distribution. Range: α ≥ 0.</param>
/// <param name="b">The β shape parameter of the Beta distribution. Range: β ≥ 0.</param>
/// <returns>a random number from the Beta distribution.</returns>
static internal double SampleUnchecked(System.Random rnd, double a, double b)
internal static double SampleUnchecked(System.Random rnd, double a, double b)
{
var x = Gamma.SampleUnchecked(rnd, a, 1.0);
var y = Gamma.SampleUnchecked(rnd, b, 1.0);
return x/(x + y);
}
static internal void SamplesUnchecked(System.Random rnd, double[] values, double a, double b)
internal static void SamplesUnchecked(System.Random rnd, double[] values, double a, double b)
{
var y = new double[values.Length];
Gamma.SamplesUnchecked(rnd, values, a, 1.0);

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

@ -1007,7 +1007,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex
/// <summary>
/// Evaluates whether this matrix is symmetric.
/// </summary>
public override sealed bool IsSymmetric()
public sealed override bool IsSymmetric()
{
return true;
}
@ -1015,7 +1015,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex
/// <summary>
/// Evaluates whether this matrix is hermitian (conjugate symmetric).
/// </summary>
public override sealed bool IsHermitian()
public sealed override bool IsHermitian()
{
for (var k = 0; k < _data.Length; k ++)
{

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

@ -69,7 +69,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex
/// Returns the conjugate transpose of this matrix.
/// </summary>
/// <returns>The conjugate transpose of this matrix.</returns>
public override sealed Matrix<Complex> ConjugateTranspose()
public sealed override Matrix<Complex> ConjugateTranspose()
{
var ret = Transpose();
ret.MapInplace(c => c.Conjugate(), Zeros.AllowSkip);
@ -363,7 +363,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex
/// </summary>
/// <param name="divisor">The pointwise denominator matrix to use</param>
/// <param name="result">The result of the modulus.</param>
protected override sealed void DoPointwiseModulus(Matrix<Complex> divisor, Matrix<Complex> result)
protected sealed override void DoPointwiseModulus(Matrix<Complex> divisor, Matrix<Complex> result)
{
throw new NotSupportedException();
}
@ -374,7 +374,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex
/// </summary>
/// <param name="divisor">The pointwise denominator matrix to use</param>
/// <param name="result">The result of the modulus.</param>
protected override sealed void DoPointwiseRemainder(Matrix<Complex> divisor, Matrix<Complex> result)
protected sealed override void DoPointwiseRemainder(Matrix<Complex> divisor, Matrix<Complex> result)
{
throw new NotSupportedException();
}
@ -385,7 +385,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex
/// </summary>
/// <param name="divisor">The scalar denominator to use.</param>
/// <param name="result">Matrix to store the results in.</param>
protected override sealed void DoModulus(Complex divisor, Matrix<Complex> result)
protected sealed override void DoModulus(Complex divisor, Matrix<Complex> result)
{
throw new NotSupportedException();
}
@ -396,7 +396,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex
/// </summary>
/// <param name="dividend">The scalar numerator to use.</param>
/// <param name="result">A vector to store the results in.</param>
protected override sealed void DoModulusByThis(Complex dividend, Matrix<Complex> result)
protected sealed override void DoModulusByThis(Complex dividend, Matrix<Complex> result)
{
throw new NotSupportedException();
}
@ -407,7 +407,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex
/// </summary>
/// <param name="divisor">The scalar denominator to use.</param>
/// <param name="result">Matrix to store the results in.</param>
protected override sealed void DoRemainder(Complex divisor, Matrix<Complex> result)
protected sealed override void DoRemainder(Complex divisor, Matrix<Complex> result)
{
throw new NotSupportedException();
}
@ -418,7 +418,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex
/// </summary>
/// <param name="dividend">The scalar numerator to use.</param>
/// <param name="result">A vector to store the results in.</param>
protected override sealed void DoRemainderByThis(Complex dividend, Matrix<Complex> result)
protected sealed override void DoRemainderByThis(Complex dividend, Matrix<Complex> result)
{
throw new NotSupportedException();
}
@ -559,7 +559,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex
/// Normalizes all row vectors to a unit p-norm.
/// Typical values for p are 1.0 (L1, Manhattan norm), 2.0 (L2, Euclidean norm) and positive infinity (infinity norm)
/// </summary>
public override sealed Matrix<Complex> NormalizeRows(double norm)
public sealed override Matrix<Complex> NormalizeRows(double norm)
{
var norminv = ((DenseVectorStorage<double>)RowNorms(norm).Storage).Data;
for (int i = 0; i < norminv.Length; i++)
@ -576,7 +576,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex
/// Normalizes all column vectors to a unit p-norm.
/// Typical values for p are 1.0 (L1, Manhattan norm), 2.0 (L2, Euclidean norm) and positive infinity (infinity norm)
/// </summary>
public override sealed Matrix<Complex> NormalizeColumns(double norm)
public sealed override Matrix<Complex> NormalizeColumns(double norm)
{
var norminv = ((DenseVectorStorage<double>)ColumnNorms(norm).Storage).Data;
for (int i = 0; i < norminv.Length; i++)

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

@ -112,11 +112,11 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers
/// Initializes a new instance of the <see cref="ILUTPPreconditioner"/> class with the specified settings.
/// </summary>
/// <param name="fillLevel">
/// The amount of fill that is allowed in the matrix. The value is a fraction of
/// The amount of fill that is allowed in the matrix. The value is a fraction of
/// the number of non-zero entries in the original matrix. Values should be positive.
/// </param>
/// <param name="dropTolerance">
/// The absolute drop tolerance which indicates below what absolute value an entry
/// The absolute drop tolerance which indicates below what absolute value an entry
/// will be dropped from the matrix. A drop tolerance of 0.0 means that no values
/// will be dropped. Values should always be positive.
/// </param>
@ -156,7 +156,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers
/// Values should always be positive and can be higher than 1.0. A value lower
/// than 1.0 means that the eventual preconditioner matrix will have fewer
/// non-zero entries as the original matrix. A value higher than 1.0 means that
/// the eventual preconditioner can have more non-zero values than the original
/// the eventual preconditioner can have more non-zero values than the original
/// matrix.
/// </para>
/// <para>
@ -187,7 +187,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers
/// <remarks>
/// <para>
/// The values should always be positive and can be larger than 1.0. A low value will
/// keep more small numbers in the preconditioner matrix. A high value will remove
/// keep more small numbers in the preconditioner matrix. A high value will remove
/// more small numbers from the preconditioner matrix.
/// </para>
/// <para>
@ -218,7 +218,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers
/// <remarks>
/// <para>
/// The pivot tolerance is used to calculate if pivoting is necessary. Pivoting
/// will take place if any of the values in a row is bigger than the
/// will take place if any of the values in a row is bigger than the
/// diagonal value of that row divided by the pivot tolerance, i.e. pivoting
/// will take place if <b>row(i,j) > row(i,i) / PivotTolerance</b> for
/// any <b>j</b> that is not equal to <b>i</b>.
@ -291,8 +291,8 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers
/// Initializes the preconditioner and loads the internal data structures.
/// </summary>
/// <param name="matrix">
/// The <see cref="Matrix"/> upon which this preconditioner is based. Note that the
/// method takes a general matrix type. However internally the data is stored
/// The <see cref="Matrix"/> upon which this preconditioner is based. Note that the
/// method takes a general matrix type. However internally the data is stored
/// as a sparse matrix. Therefore it is not recommended to pass a dense matrix.
/// </param>
/// <exception cref="ArgumentNullException"> If <paramref name="matrix"/> is <see langword="null" />.</exception>
@ -309,7 +309,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers
throw new ArgumentException(Resources.ArgumentMatrixSquare, "matrix");
}
var sparseMatrix = (matrix is SparseMatrix) ? matrix as SparseMatrix : SparseMatrix.OfMatrix(matrix);
var sparseMatrix = matrix as SparseMatrix ?? SparseMatrix.OfMatrix(matrix);
// The creation of the preconditioner follows the following algorithm.
// spaceLeft = lfilNnz * nnz(A)
@ -347,7 +347,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers
// lfil = spaceRow - nnz(L(i,:)) // space for this row of U
// u(i,j) = w(j) for j = i, .. , n // only the largest lfil - 1 elements
// w = 0
//
//
// if max(U(i,i + 1: n)) > U(i,i) / pivTol then // pivot if necessary
// {
// pivot by swapping the max and the diagonal entries
@ -797,7 +797,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers
}
/// <summary>
/// Sort the given integers in a decreasing fashion using heapsort algorithm
/// Sort the given integers in a decreasing fashion using heapsort algorithm
/// </summary>
/// <param name="values">Array of values to sort</param>
/// <param name="count">Length of <paramref name="values"/></param>

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

@ -211,7 +211,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex
/// </summary>
/// <param name="divisor">The pointwise denominator vector to use.</param>
/// <param name="result">The result of the modulus.</param>
protected override sealed void DoPointwiseModulus(Vector<Complex> divisor, Vector<Complex> result)
protected sealed override void DoPointwiseModulus(Vector<Complex> divisor, Vector<Complex> result)
{
throw new NotSupportedException();
}
@ -222,7 +222,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex
/// </summary>
/// <param name="divisor">The pointwise denominator vector to use.</param>
/// <param name="result">The result of the modulus.</param>
protected override sealed void DoPointwiseRemainder(Vector<Complex> divisor, Vector<Complex> result)
protected sealed override void DoPointwiseRemainder(Vector<Complex> divisor, Vector<Complex> result)
{
throw new NotSupportedException();
}
@ -281,7 +281,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex
/// </summary>
/// <param name="divisor">The scalar denominator to use.</param>
/// <param name="result">A vector to store the results in.</param>
protected override sealed void DoModulus(Complex divisor, Vector<Complex> result)
protected sealed override void DoModulus(Complex divisor, Vector<Complex> result)
{
throw new NotSupportedException();
}
@ -292,7 +292,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex
/// </summary>
/// <param name="dividend">The scalar numerator to use.</param>
/// <param name="result">A vector to store the results in.</param>
protected override sealed void DoModulusByThis(Complex dividend, Vector<Complex> result)
protected sealed override void DoModulusByThis(Complex dividend, Vector<Complex> result)
{
throw new NotSupportedException();
}
@ -303,7 +303,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex
/// </summary>
/// <param name="divisor">The scalar denominator to use.</param>
/// <param name="result">A vector to store the results in.</param>
protected override sealed void DoRemainder(Complex divisor, Vector<Complex> result)
protected sealed override void DoRemainder(Complex divisor, Vector<Complex> result)
{
throw new NotSupportedException();
}
@ -314,7 +314,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex
/// </summary>
/// <param name="dividend">The scalar numerator to use.</param>
/// <param name="result">A vector to store the results in.</param>
protected override sealed void DoRemainderByThis(Complex dividend, Vector<Complex> result)
protected sealed override void DoRemainderByThis(Complex dividend, Vector<Complex> result)
{
throw new NotSupportedException();
}

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

@ -1001,7 +1001,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32
/// <summary>
/// Evaluates whether this matrix is symmetric.
/// </summary>
public override sealed bool IsSymmetric()
public sealed override bool IsSymmetric()
{
return true;
}
@ -1009,7 +1009,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32
/// <summary>
/// Evaluates whether this matrix is hermitian (conjugate symmetric).
/// </summary>
public override sealed bool IsHermitian()
public sealed override bool IsHermitian()
{
for (var k = 0; k < _data.Length; k++)
{

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

@ -64,7 +64,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32
/// Returns the conjugate transpose of this matrix.
/// </summary>
/// <returns>The conjugate transpose of this matrix.</returns>
public override sealed Matrix<Complex32> ConjugateTranspose()
public sealed override Matrix<Complex32> ConjugateTranspose()
{
var ret = Transpose();
ret.MapInplace(c => c.Conjugate(), Zeros.AllowSkip);
@ -358,7 +358,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32
/// </summary>
/// <param name="divisor">The pointwise denominator matrix to use</param>
/// <param name="result">The result of the modulus.</param>
protected override sealed void DoPointwiseModulus(Matrix<Complex32> divisor, Matrix<Complex32> result)
protected sealed override void DoPointwiseModulus(Matrix<Complex32> divisor, Matrix<Complex32> result)
{
throw new NotSupportedException();
}
@ -369,7 +369,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32
/// </summary>
/// <param name="divisor">The pointwise denominator matrix to use</param>
/// <param name="result">The result of the modulus.</param>
protected override sealed void DoPointwiseRemainder(Matrix<Complex32> divisor, Matrix<Complex32> result)
protected sealed override void DoPointwiseRemainder(Matrix<Complex32> divisor, Matrix<Complex32> result)
{
throw new NotSupportedException();
}
@ -380,7 +380,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32
/// </summary>
/// <param name="divisor">The scalar denominator to use.</param>
/// <param name="result">Matrix to store the results in.</param>
protected override sealed void DoModulus(Complex32 divisor, Matrix<Complex32> result)
protected sealed override void DoModulus(Complex32 divisor, Matrix<Complex32> result)
{
throw new NotSupportedException();
}
@ -391,7 +391,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32
/// </summary>
/// <param name="dividend">The scalar numerator to use.</param>
/// <param name="result">A vector to store the results in.</param>
protected override sealed void DoModulusByThis(Complex32 dividend, Matrix<Complex32> result)
protected sealed override void DoModulusByThis(Complex32 dividend, Matrix<Complex32> result)
{
throw new NotSupportedException();
}
@ -402,7 +402,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32
/// </summary>
/// <param name="divisor">The scalar denominator to use.</param>
/// <param name="result">Matrix to store the results in.</param>
protected override sealed void DoRemainder(Complex32 divisor, Matrix<Complex32> result)
protected sealed override void DoRemainder(Complex32 divisor, Matrix<Complex32> result)
{
throw new NotSupportedException();
}
@ -413,7 +413,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32
/// </summary>
/// <param name="dividend">The scalar numerator to use.</param>
/// <param name="result">A vector to store the results in.</param>
protected override sealed void DoRemainderByThis(Complex32 dividend, Matrix<Complex32> result)
protected sealed override void DoRemainderByThis(Complex32 dividend, Matrix<Complex32> result)
{
throw new NotSupportedException();
}
@ -552,7 +552,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32
/// Normalizes all row vectors to a unit p-norm.
/// Typical values for p are 1.0 (L1, Manhattan norm), 2.0 (L2, Euclidean norm) and positive infinity (infinity norm)
/// </summary>
public override sealed Matrix<Complex32> NormalizeRows(double norm)
public sealed override Matrix<Complex32> NormalizeRows(double norm)
{
var norminv = ((DenseVectorStorage<double>)RowNorms(norm).Storage).Data;
for (int i = 0; i < norminv.Length; i++)
@ -569,7 +569,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32
/// Normalizes all column vectors to a unit p-norm.
/// Typical values for p are 1.0 (L1, Manhattan norm), 2.0 (L2, Euclidean norm) and positive infinity (infinity norm)
/// </summary>
public override sealed Matrix<Complex32> NormalizeColumns(double norm)
public sealed override Matrix<Complex32> NormalizeColumns(double norm)
{
var norminv = ((DenseVectorStorage<double>)ColumnNorms(norm).Storage).Data;
for (int i = 0; i < norminv.Length; i++)

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

@ -107,11 +107,11 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers
/// Initializes a new instance of the <see cref="ILUTPPreconditioner"/> class with the specified settings.
/// </summary>
/// <param name="fillLevel">
/// The amount of fill that is allowed in the matrix. The value is a fraction of
/// The amount of fill that is allowed in the matrix. The value is a fraction of
/// the number of non-zero entries in the original matrix. Values should be positive.
/// </param>
/// <param name="dropTolerance">
/// The absolute drop tolerance which indicates below what absolute value an entry
/// The absolute drop tolerance which indicates below what absolute value an entry
/// will be dropped from the matrix. A drop tolerance of 0.0 means that no values
/// will be dropped. Values should always be positive.
/// </param>
@ -151,7 +151,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers
/// Values should always be positive and can be higher than 1.0. A value lower
/// than 1.0 means that the eventual preconditioner matrix will have fewer
/// non-zero entries as the original matrix. A value higher than 1.0 means that
/// the eventual preconditioner can have more non-zero values than the original
/// the eventual preconditioner can have more non-zero values than the original
/// matrix.
/// </para>
/// <para>
@ -182,7 +182,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers
/// <remarks>
/// <para>
/// The values should always be positive and can be larger than 1.0. A low value will
/// keep more small numbers in the preconditioner matrix. A high value will remove
/// keep more small numbers in the preconditioner matrix. A high value will remove
/// more small numbers from the preconditioner matrix.
/// </para>
/// <para>
@ -213,7 +213,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers
/// <remarks>
/// <para>
/// The pivot tolerance is used to calculate if pivoting is necessary. Pivoting
/// will take place if any of the values in a row is bigger than the
/// will take place if any of the values in a row is bigger than the
/// diagonal value of that row divided by the pivot tolerance, i.e. pivoting
/// will take place if <b>row(i,j) > row(i,i) / PivotTolerance</b> for
/// any <b>j</b> that is not equal to <b>i</b>.
@ -286,8 +286,8 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers
/// Initializes the preconditioner and loads the internal data structures.
/// </summary>
/// <param name="matrix">
/// The <see cref="Matrix"/> upon which this preconditioner is based. Note that the
/// method takes a general matrix type. However internally the data is stored
/// The <see cref="Matrix"/> upon which this preconditioner is based. Note that the
/// method takes a general matrix type. However internally the data is stored
/// as a sparse matrix. Therefore it is not recommended to pass a dense matrix.
/// </param>
/// <exception cref="ArgumentNullException"> If <paramref name="matrix"/> is <see langword="null" />.</exception>
@ -304,7 +304,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers
throw new ArgumentException(Resources.ArgumentMatrixSquare, "matrix");
}
var sparseMatrix = (matrix is SparseMatrix) ? matrix as SparseMatrix : SparseMatrix.OfMatrix(matrix);
var sparseMatrix = matrix as SparseMatrix ?? SparseMatrix.OfMatrix(matrix);
// The creation of the preconditioner follows the following algorithm.
// spaceLeft = lfilNnz * nnz(A)
@ -342,7 +342,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers
// lfil = spaceRow - nnz(L(i,:)) // space for this row of U
// u(i,j) = w(j) for j = i, .. , n // only the largest lfil - 1 elements
// w = 0
//
//
// if max(U(i,i + 1: n)) > U(i,i) / pivTol then // pivot if necessary
// {
// pivot by swapping the max and the diagonal entries
@ -792,7 +792,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers
}
/// <summary>
/// Sort the given integers in a decreasing fashion using heapsort algorithm
/// Sort the given integers in a decreasing fashion using heapsort algorithm
/// </summary>
/// <param name="values">Array of values to sort</param>
/// <param name="count">Length of <paramref name="values"/></param>

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

@ -206,7 +206,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32
/// </summary>
/// <param name="divisor">The pointwise denominator vector to use.</param>
/// <param name="result">The result of the modulus.</param>
protected override sealed void DoPointwiseModulus(Vector<Complex32> divisor, Vector<Complex32> result)
protected sealed override void DoPointwiseModulus(Vector<Complex32> divisor, Vector<Complex32> result)
{
throw new NotSupportedException();
}
@ -217,7 +217,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32
/// </summary>
/// <param name="divisor">The pointwise denominator vector to use.</param>
/// <param name="result">The result of the modulus.</param>
protected override sealed void DoPointwiseRemainder(Vector<Complex32> divisor, Vector<Complex32> result)
protected sealed override void DoPointwiseRemainder(Vector<Complex32> divisor, Vector<Complex32> result)
{
throw new NotSupportedException();
}
@ -276,7 +276,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32
/// </summary>
/// <param name="divisor">The scalar denominator to use.</param>
/// <param name="result">A vector to store the results in.</param>
protected override sealed void DoModulus(Complex32 divisor, Vector<Complex32> result)
protected sealed override void DoModulus(Complex32 divisor, Vector<Complex32> result)
{
throw new NotSupportedException();
}
@ -287,7 +287,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32
/// </summary>
/// <param name="dividend">The scalar numerator to use.</param>
/// <param name="result">A vector to store the results in.</param>
protected override sealed void DoModulusByThis(Complex32 dividend, Vector<Complex32> result)
protected sealed override void DoModulusByThis(Complex32 dividend, Vector<Complex32> result)
{
throw new NotSupportedException();
}
@ -298,7 +298,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32
/// </summary>
/// <param name="divisor">The scalar denominator to use.</param>
/// <param name="result">A vector to store the results in.</param>
protected override sealed void DoRemainder(Complex32 divisor, Vector<Complex32> result)
protected sealed override void DoRemainder(Complex32 divisor, Vector<Complex32> result)
{
throw new NotSupportedException();
}
@ -309,7 +309,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32
/// </summary>
/// <param name="dividend">The scalar numerator to use.</param>
/// <param name="result">A vector to store the results in.</param>
protected override sealed void DoRemainderByThis(Complex32 dividend, Vector<Complex32> result)
protected sealed override void DoRemainderByThis(Complex32 dividend, Vector<Complex32> result)
{
throw new NotSupportedException();
}

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

@ -850,7 +850,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double
/// <summary>
/// Evaluates whether this matrix is symmetric.
/// </summary>
public override sealed bool IsSymmetric()
public sealed override bool IsSymmetric()
{
return true;
}

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

@ -62,7 +62,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double
/// Returns the conjugate transpose of this matrix.
/// </summary>
/// <returns>The conjugate transpose of this matrix.</returns>
public override sealed Matrix<double> ConjugateTranspose()
public sealed override Matrix<double> ConjugateTranspose()
{
return Transpose();
}
@ -71,7 +71,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double
/// Complex conjugates each element of this matrix and place the results into the result matrix.
/// </summary>
/// <param name="result">The result of the conjugation.</param>
protected override sealed void DoConjugate(Matrix<double> result)
protected sealed override void DoConjugate(Matrix<double> result)
{
if (ReferenceEquals(this, result))
{
@ -229,7 +229,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double
/// </summary>
/// <param name="other">The matrix to multiply with.</param>
/// <param name="result">The result of the multiplication.</param>
protected override sealed void DoConjugateTransposeAndMultiply(Matrix<double> other, Matrix<double> result)
protected sealed override void DoConjugateTransposeAndMultiply(Matrix<double> other, Matrix<double> result)
{
DoTransposeAndMultiply(other, result);
}
@ -260,7 +260,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double
/// </summary>
/// <param name="other">The matrix to multiply with.</param>
/// <param name="result">The result of the multiplication.</param>
protected override sealed void DoConjugateTransposeThisAndMultiply(Matrix<double> other, Matrix<double> result)
protected sealed override void DoConjugateTransposeThisAndMultiply(Matrix<double> other, Matrix<double> result)
{
DoTransposeThisAndMultiply(other, result);
}
@ -288,7 +288,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double
/// </summary>
/// <param name="rightSide">The vector to multiply with.</param>
/// <param name="result">The result of the multiplication.</param>
protected override sealed void DoConjugateTransposeThisAndMultiply(Vector<double> rightSide, Vector<double> result)
protected sealed override void DoConjugateTransposeThisAndMultiply(Vector<double> rightSide, Vector<double> result)
{
DoTransposeThisAndMultiply(rightSide, result);
}
@ -523,7 +523,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double
/// Normalizes all row vectors to a unit p-norm.
/// Typical values for p are 1.0 (L1, Manhattan norm), 2.0 (L2, Euclidean norm) and positive infinity (infinity norm)
/// </summary>
public override sealed Matrix<double> NormalizeRows(double norm)
public sealed override Matrix<double> NormalizeRows(double norm)
{
var norminv = ((DenseVectorStorage<double>)RowNorms(norm).Storage).Data;
for (int i = 0; i < norminv.Length; i++)
@ -540,7 +540,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double
/// Normalizes all column vectors to a unit p-norm.
/// Typical values for p are 1.0 (L1, Manhattan norm), 2.0 (L2, Euclidean norm) and positive infinity (infinity norm)
/// </summary>
public override sealed Matrix<double> NormalizeColumns(double norm)
public sealed override Matrix<double> NormalizeColumns(double norm)
{
var norminv = ((DenseVectorStorage<double>)ColumnNorms(norm).Storage).Data;
for (int i = 0; i < norminv.Length; i++)
@ -617,7 +617,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double
/// <summary>
/// Evaluates whether this matrix is hermitian (conjugate symmetric).
/// </summary>
public override sealed bool IsHermitian()
public sealed override bool IsHermitian()
{
return IsSymmetric();
}

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

@ -105,11 +105,11 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers
/// Initializes a new instance of the <see cref="ILUTPPreconditioner"/> class with the specified settings.
/// </summary>
/// <param name="fillLevel">
/// The amount of fill that is allowed in the matrix. The value is a fraction of
/// The amount of fill that is allowed in the matrix. The value is a fraction of
/// the number of non-zero entries in the original matrix. Values should be positive.
/// </param>
/// <param name="dropTolerance">
/// The absolute drop tolerance which indicates below what absolute value an entry
/// The absolute drop tolerance which indicates below what absolute value an entry
/// will be dropped from the matrix. A drop tolerance of 0.0 means that no values
/// will be dropped. Values should always be positive.
/// </param>
@ -149,7 +149,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers
/// Values should always be positive and can be higher than 1.0. A value lower
/// than 1.0 means that the eventual preconditioner matrix will have fewer
/// non-zero entries as the original matrix. A value higher than 1.0 means that
/// the eventual preconditioner can have more non-zero values than the original
/// the eventual preconditioner can have more non-zero values than the original
/// matrix.
/// </para>
/// <para>
@ -180,7 +180,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers
/// <remarks>
/// <para>
/// The values should always be positive and can be larger than 1.0. A low value will
/// keep more small numbers in the preconditioner matrix. A high value will remove
/// keep more small numbers in the preconditioner matrix. A high value will remove
/// more small numbers from the preconditioner matrix.
/// </para>
/// <para>
@ -211,7 +211,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers
/// <remarks>
/// <para>
/// The pivot tolerance is used to calculate if pivoting is necessary. Pivoting
/// will take place if any of the values in a row is bigger than the
/// will take place if any of the values in a row is bigger than the
/// diagonal value of that row divided by the pivot tolerance, i.e. pivoting
/// will take place if <b>row(i,j) > row(i,i) / PivotTolerance</b> for
/// any <b>j</b> that is not equal to <b>i</b>.
@ -284,8 +284,8 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers
/// Initializes the preconditioner and loads the internal data structures.
/// </summary>
/// <param name="matrix">
/// The <see cref="Matrix"/> upon which this preconditioner is based. Note that the
/// method takes a general matrix type. However internally the data is stored
/// The <see cref="Matrix"/> upon which this preconditioner is based. Note that the
/// method takes a general matrix type. However internally the data is stored
/// as a sparse matrix. Therefore it is not recommended to pass a dense matrix.
/// </param>
/// <exception cref="ArgumentNullException"> If <paramref name="matrix"/> is <see langword="null" />.</exception>
@ -302,7 +302,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers
throw new ArgumentException(Resources.ArgumentMatrixSquare, "matrix");
}
var sparseMatrix = (matrix is SparseMatrix) ? matrix as SparseMatrix : SparseMatrix.OfMatrix(matrix);
var sparseMatrix = matrix as SparseMatrix ?? SparseMatrix.OfMatrix(matrix);
// The creation of the preconditioner follows the following algorithm.
// spaceLeft = lfilNnz * nnz(A)
@ -340,7 +340,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers
// lfil = spaceRow - nnz(L(i,:)) // space for this row of U
// u(i,j) = w(j) for j = i, .. , n // only the largest lfil - 1 elements
// w = 0
//
//
// if max(U(i,i + 1: n)) > U(i,i) / pivTol then // pivot if necessary
// {
// pivot by swapping the max and the diagonal entries
@ -790,7 +790,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers
}
/// <summary>
/// Sort the given integers in a decreasing fashion using heapsort algorithm
/// Sort the given integers in a decreasing fashion using heapsort algorithm
/// </summary>
/// <param name="values">Array of values to sort</param>
/// <param name="count">Length of <paramref name="values"/></param>

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

@ -60,7 +60,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double
/// Conjugates vector and save result to <paramref name="result"/>
/// </summary>
/// <param name="result">Target vector</param>
protected override sealed void DoConjugate(Vector<double> result)
protected sealed override void DoConjugate(Vector<double> result)
{
if (ReferenceEquals(this, result))
{
@ -263,7 +263,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double
/// </summary>
/// <param name="other">The other vector.</param>
/// <returns>The sum of conj(a[i])*b[i] for all i.</returns>
protected override sealed double DoConjugateDotProduct(Vector<double> other)
protected sealed override double DoConjugateDotProduct(Vector<double> other)
{
return DoDotProduct(other);
}

2
src/Numerics/LinearAlgebra/Matrix.BCL.cs

@ -376,7 +376,7 @@ namespace MathNet.Numerics.LinearAlgebra
/// Returns a string that summarizes this matrix.
/// The maximum number of cells can be configured in the <see cref="Control"/> class.
/// </summary>
public override sealed string ToString()
public sealed override string ToString()
{
return string.Concat(ToTypeString(), Environment.NewLine, ToMatrixString());
}

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

@ -850,7 +850,7 @@ namespace MathNet.Numerics.LinearAlgebra.Single
/// <summary>
/// Evaluates whether this matrix is symmetric.
/// </summary>
public override sealed bool IsSymmetric()
public sealed override bool IsSymmetric()
{
return true;
}

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

@ -62,7 +62,7 @@ namespace MathNet.Numerics.LinearAlgebra.Single
/// Returns the conjugate transpose of this matrix.
/// </summary>
/// <returns>The conjugate transpose of this matrix.</returns>
public override sealed Matrix<float> ConjugateTranspose()
public sealed override Matrix<float> ConjugateTranspose()
{
return Transpose();
}
@ -71,7 +71,7 @@ namespace MathNet.Numerics.LinearAlgebra.Single
/// Complex conjugates each element of this matrix and place the results into the result matrix.
/// </summary>
/// <param name="result">The result of the conjugation.</param>
protected override sealed void DoConjugate(Matrix<float> result)
protected sealed override void DoConjugate(Matrix<float> result)
{
if (ReferenceEquals(this, result))
{
@ -229,7 +229,7 @@ namespace MathNet.Numerics.LinearAlgebra.Single
/// </summary>
/// <param name="other">The matrix to multiply with.</param>
/// <param name="result">The result of the multiplication.</param>
protected override sealed void DoConjugateTransposeAndMultiply(Matrix<float> other, Matrix<float> result)
protected sealed override void DoConjugateTransposeAndMultiply(Matrix<float> other, Matrix<float> result)
{
DoTransposeAndMultiply(other, result);
}
@ -260,7 +260,7 @@ namespace MathNet.Numerics.LinearAlgebra.Single
/// </summary>
/// <param name="other">The matrix to multiply with.</param>
/// <param name="result">The result of the multiplication.</param>
protected override sealed void DoConjugateTransposeThisAndMultiply(Matrix<float> other, Matrix<float> result)
protected sealed override void DoConjugateTransposeThisAndMultiply(Matrix<float> other, Matrix<float> result)
{
DoTransposeThisAndMultiply(other, result);
}
@ -288,7 +288,7 @@ namespace MathNet.Numerics.LinearAlgebra.Single
/// </summary>
/// <param name="rightSide">The vector to multiply with.</param>
/// <param name="result">The result of the multiplication.</param>
protected override sealed void DoConjugateTransposeThisAndMultiply(Vector<float> rightSide, Vector<float> result)
protected sealed override void DoConjugateTransposeThisAndMultiply(Vector<float> rightSide, Vector<float> result)
{
DoTransposeThisAndMultiply(rightSide, result);
}
@ -544,7 +544,7 @@ namespace MathNet.Numerics.LinearAlgebra.Single
/// Normalizes all row vectors to a unit p-norm.
/// Typical values for p are 1.0 (L1, Manhattan norm), 2.0 (L2, Euclidean norm) and positive infinity (infinity norm)
/// </summary>
public override sealed Matrix<float> NormalizeRows(double norm)
public sealed override Matrix<float> NormalizeRows(double norm)
{
var norminv = ((DenseVectorStorage<double>)RowNorms(norm).Storage).Data;
for (int i = 0; i < norminv.Length; i++)
@ -561,7 +561,7 @@ namespace MathNet.Numerics.LinearAlgebra.Single
/// Normalizes all column vectors to a unit p-norm.
/// Typical values for p are 1.0 (L1, Manhattan norm), 2.0 (L2, Euclidean norm) and positive infinity (infinity norm)
/// </summary>
public override sealed Matrix<float> NormalizeColumns(double norm)
public sealed override Matrix<float> NormalizeColumns(double norm)
{
var norminv = ((DenseVectorStorage<double>)ColumnNorms(norm).Storage).Data;
for (int i = 0; i < norminv.Length; i++)
@ -617,7 +617,7 @@ namespace MathNet.Numerics.LinearAlgebra.Single
/// <summary>
/// Evaluates whether this matrix is hermitian (conjugate symmetric).
/// </summary>
public override sealed bool IsHermitian()
public sealed override bool IsHermitian()
{
return IsSymmetric();
}

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

@ -105,11 +105,11 @@ namespace MathNet.Numerics.LinearAlgebra.Single.Solvers
/// Initializes a new instance of the <see cref="ILUTPPreconditioner"/> class with the specified settings.
/// </summary>
/// <param name="fillLevel">
/// The amount of fill that is allowed in the matrix. The value is a fraction of
/// The amount of fill that is allowed in the matrix. The value is a fraction of
/// the number of non-zero entries in the original matrix. Values should be positive.
/// </param>
/// <param name="dropTolerance">
/// The absolute drop tolerance which indicates below what absolute value an entry
/// The absolute drop tolerance which indicates below what absolute value an entry
/// will be dropped from the matrix. A drop tolerance of 0.0 means that no values
/// will be dropped. Values should always be positive.
/// </param>
@ -149,7 +149,7 @@ namespace MathNet.Numerics.LinearAlgebra.Single.Solvers
/// Values should always be positive and can be higher than 1.0. A value lower
/// than 1.0 means that the eventual preconditioner matrix will have fewer
/// non-zero entries as the original matrix. A value higher than 1.0 means that
/// the eventual preconditioner can have more non-zero values than the original
/// the eventual preconditioner can have more non-zero values than the original
/// matrix.
/// </para>
/// <para>
@ -180,7 +180,7 @@ namespace MathNet.Numerics.LinearAlgebra.Single.Solvers
/// <remarks>
/// <para>
/// The values should always be positive and can be larger than 1.0. A low value will
/// keep more small numbers in the preconditioner matrix. A high value will remove
/// keep more small numbers in the preconditioner matrix. A high value will remove
/// more small numbers from the preconditioner matrix.
/// </para>
/// <para>
@ -211,7 +211,7 @@ namespace MathNet.Numerics.LinearAlgebra.Single.Solvers
/// <remarks>
/// <para>
/// The pivot tolerance is used to calculate if pivoting is necessary. Pivoting
/// will take place if any of the values in a row is bigger than the
/// will take place if any of the values in a row is bigger than the
/// diagonal value of that row divided by the pivot tolerance, i.e. pivoting
/// will take place if <b>row(i,j) > row(i,i) / PivotTolerance</b> for
/// any <b>j</b> that is not equal to <b>i</b>.
@ -284,8 +284,8 @@ namespace MathNet.Numerics.LinearAlgebra.Single.Solvers
/// Initializes the preconditioner and loads the internal data structures.
/// </summary>
/// <param name="matrix">
/// The <see cref="Matrix"/> upon which this preconditioner is based. Note that the
/// method takes a general matrix type. However internally the data is stored
/// The <see cref="Matrix"/> upon which this preconditioner is based. Note that the
/// method takes a general matrix type. However internally the data is stored
/// as a sparse matrix. Therefore it is not recommended to pass a dense matrix.
/// </param>
/// <exception cref="ArgumentNullException"> If <paramref name="matrix"/> is <see langword="null" />.</exception>
@ -302,7 +302,7 @@ namespace MathNet.Numerics.LinearAlgebra.Single.Solvers
throw new ArgumentException(Resources.ArgumentMatrixSquare, "matrix");
}
var sparseMatrix = (matrix is SparseMatrix) ? matrix as SparseMatrix : SparseMatrix.OfMatrix(matrix);
SparseMatrix sparseMatrix = matrix as SparseMatrix ?? SparseMatrix.OfMatrix(matrix);
// The creation of the preconditioner follows the following algorithm.
// spaceLeft = lfilNnz * nnz(A)
@ -340,7 +340,7 @@ namespace MathNet.Numerics.LinearAlgebra.Single.Solvers
// lfil = spaceRow - nnz(L(i,:)) // space for this row of U
// u(i,j) = w(j) for j = i, .. , n // only the largest lfil - 1 elements
// w = 0
//
//
// if max(U(i,i + 1: n)) > U(i,i) / pivTol then // pivot if necessary
// {
// pivot by swapping the max and the diagonal entries
@ -790,7 +790,7 @@ namespace MathNet.Numerics.LinearAlgebra.Single.Solvers
}
/// <summary>
/// Sort the given integers in a decreasing fashion using heapsort algorithm
/// Sort the given integers in a decreasing fashion using heapsort algorithm
/// </summary>
/// <param name="values">Array of values to sort</param>
/// <param name="count">Length of <paramref name="values"/></param>

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

@ -60,7 +60,7 @@ namespace MathNet.Numerics.LinearAlgebra.Single
/// Conjugates vector and save result to <paramref name="result"/>
/// </summary>
/// <param name="result">Target vector</param>
protected override sealed void DoConjugate(Vector<float> result)
protected sealed override void DoConjugate(Vector<float> result)
{
if (ReferenceEquals(this, result))
{
@ -263,7 +263,7 @@ namespace MathNet.Numerics.LinearAlgebra.Single
/// </summary>
/// <param name="other">The other vector.</param>
/// <returns>The sum of conj(a[i])*b[i] for all i.</returns>
protected override sealed float DoConjugateDotProduct(Vector<float> other)
protected sealed override float DoConjugateDotProduct(Vector<float> other)
{
return DoDotProduct(other);
}

2
src/Numerics/LinearAlgebra/Storage/MatrixStorage.cs

@ -172,7 +172,7 @@ namespace MathNet.Numerics.LinearAlgebra.Storage
/// true if the specified <see cref="T:System.Object"/> is equal to the current <see cref="T:System.Object"/>; otherwise, false.
/// </returns>
/// <param name="obj">The <see cref="T:System.Object"/> to compare with the current <see cref="T:System.Object"/>. </param>
public override sealed bool Equals(object obj)
public sealed override bool Equals(object obj)
{
return Equals(obj as MatrixStorage<T>);
}

2
src/Numerics/LinearAlgebra/Storage/VectorStorage.cs

@ -148,7 +148,7 @@ namespace MathNet.Numerics.LinearAlgebra.Storage
/// true if the specified <see cref="T:System.Object"/> is equal to the current <see cref="T:System.Object"/>; otherwise, false.
/// </returns>
/// <param name="obj">The <see cref="T:System.Object"/> to compare with the current <see cref="T:System.Object"/>. </param>
public override sealed bool Equals(object obj)
public sealed override bool Equals(object obj)
{
return Equals(obj as VectorStorage<T>);
}

6
src/Numerics/LinearAlgebra/Vector.BCL.cs

@ -61,7 +61,7 @@ namespace MathNet.Numerics.LinearAlgebra
/// <returns>
/// <c>true</c> if the specified <see cref="System.Object"/> is equal to this instance; otherwise, <c>false</c>.
/// </returns>
public override sealed bool Equals(object obj)
public sealed override bool Equals(object obj)
{
var other = obj as Vector<T>;
return other != null && Storage.Equals(other.Storage);
@ -73,7 +73,7 @@ namespace MathNet.Numerics.LinearAlgebra
/// <returns>
/// A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.
/// </returns>
public override sealed int GetHashCode()
public sealed override int GetHashCode()
{
return Storage.GetHashCode();
}
@ -399,7 +399,7 @@ namespace MathNet.Numerics.LinearAlgebra
/// Returns a string that summarizes this vector.
/// The maximum number of cells can be configured in the <see cref="Control"/> class.
/// </summary>
public override sealed string ToString()
public sealed override string ToString()
{
return string.Concat(ToTypeString(), Environment.NewLine, ToVectorString());
}

2
src/Numerics/Permutation.cs

@ -177,7 +177,7 @@ namespace MathNet.Numerics
/// <param name="indices">An array which represents where each integer is permuted too: indices[i] represents that integer i
/// is permuted to location indices[i].</param>
/// <returns>True if <paramref name="indices"/> represents a proper permutation, <c>false</c> otherwise.</returns>
static private bool CheckForProperPermutation(int[] indices)
static bool CheckForProperPermutation(int[] indices)
{
var idxCheck = new bool[indices.Length];

8
src/Numerics/Statistics/MCMC/HybridMC.cs

@ -85,7 +85,7 @@ namespace MathNet.Numerics.Statistics.Mcmc
/// <param name="burnInterval">The number of iterations in between returning samples.</param>
/// <exception cref="ArgumentOutOfRangeException">When the number of burnInterval iteration is negative.</exception>
public HybridMC(double[] x0, DensityLn<double[]> pdfLnP, int frogLeapSteps, double stepSize, int burnInterval = 0)
: this(x0, pdfLnP, frogLeapSteps, stepSize, burnInterval, new double[x0.Count()], SystemRandomSource.Default, Grad)
: this(x0, pdfLnP, frogLeapSteps, stepSize, burnInterval, new double[x0.Length], SystemRandomSource.Default, Grad)
{
for (int i = 0; i < _length; i++)
{
@ -154,7 +154,7 @@ namespace MathNet.Numerics.Statistics.Mcmc
public HybridMC(double[] x0, DensityLn<double[]> pdfLnP, int frogLeapSteps, double stepSize, int burnInterval, double[] pSdv, System.Random randomSource, DiffMethod diff)
: base(x0, pdfLnP, frogLeapSteps, stepSize, burnInterval, randomSource, diff)
{
_length = x0.Count();
_length = x0.Length;
MomentumStdDev = pSdv;
Initialize(x0);
@ -185,7 +185,7 @@ namespace MathNet.Numerics.Statistics.Mcmc
{
throw new ArgumentNullException("pSdv", "Standard deviation cannot be null.");
}
if (pSdv.Count() != _length)
if (pSdv.Length != _length)
{
throw new ArgumentOutOfRangeException("pSdv", "Standard deviation of momentum must have same length as sample.");
}
@ -263,7 +263,7 @@ namespace MathNet.Numerics.Statistics.Mcmc
/// <param name="function">Function which the gradient is to be evaluated.</param>
/// <param name="x">The location where the gradient is to be evaluated.</param>
/// <returns>The gradient of the function at the point x.</returns>
static private double[] Grad(DensityLn<double[]> function, double[] x)
static double[] Grad(DensityLn<double[]> function, double[] x)
{
int length = x.Length;
var returnValue = new double[length];

14
src/Numerics/Statistics/MCMC/HybridMCGeneric.cs

@ -42,7 +42,7 @@ namespace MathNet.Numerics.Statistics.Mcmc
/// (<seealso cref="MetropolisSampler{T}"/>).
/// </summary>
/// <typeparam name="T">The type of samples this sampler produces.</typeparam>
abstract public class HybridMCGeneric<T> : McmcSampler<T>
public abstract class HybridMCGeneric<T> : McmcSampler<T>
{
/// <summary>
/// The delegate type that defines a derivative evaluated at a certain point.
@ -211,21 +211,21 @@ namespace MathNet.Numerics.Statistics.Mcmc
/// Use for creating temporary objects in the Burn method.
/// </summary>
/// <returns>An object of type T.</returns>
abstract protected T Create();
protected abstract T Create();
/// <summary>
/// Use for copying objects in the Burn method.
/// </summary>
/// <param name="source">The source of copying.</param>
/// <returns>A copy of the source object.</returns>
abstract protected T Copy(T source);
protected abstract T Copy(T source);
/// <summary>
/// Method for doing dot product.
/// </summary>
/// <param name="first">First vector/scalar in the product.</param>
/// <param name="second">Second vector/scalar in the product.</param>
abstract protected double DoProduct(T first, T second);
protected abstract double DoProduct(T first, T second);
/// <summary>
/// Method for adding, multiply the second vector/scalar by factor and then
@ -234,7 +234,7 @@ namespace MathNet.Numerics.Statistics.Mcmc
/// <param name="first">First vector/scalar.</param>
/// <param name="factor">Scalar factor multiplying by the second vector/scalar.</param>
/// <param name="second">Second vector/scalar.</param>
abstract protected void DoAdd(ref T first, double factor, T second);
protected abstract void DoAdd(ref T first, double factor, T second);
/// <summary>
/// Multiplying the second vector/scalar by factor and then subtract it from
@ -243,13 +243,13 @@ namespace MathNet.Numerics.Statistics.Mcmc
/// <param name="first">First vector/scalar.</param>
/// <param name="factor">Scalar factor to be multiplied to the second vector/scalar.</param>
/// <param name="second">Second vector/scalar.</param>
abstract protected void DoSubtract(ref T first, double factor, T second);
protected abstract void DoSubtract(ref T first, double factor, T second);
/// <summary>
/// Method for sampling a random momentum.
/// </summary>
/// <param name="p">Momentum to be randomized.</param>
abstract protected void RandomizeMomentum(ref T p);
protected abstract void RandomizeMomentum(ref T p);
/// <summary>
/// The Hamiltonian equations that is used to produce the new sample.

6
src/Numerics/Statistics/MCMC/MCMCDiagnostics.cs

@ -39,7 +39,7 @@ namespace MathNet.Numerics.Statistics.Mcmc
/// Provides utilities to analysis the convergence of a set of samples from
/// a <seealso cref="McmcSampler{T}"/>.
/// </summary>
static public class MCMCDiagnostics
public static class MCMCDiagnostics
{
/// <summary>
/// Computes the auto correlations of a series evaluated by a function f.
@ -50,7 +50,7 @@ namespace MathNet.Numerics.Statistics.Mcmc
/// <returns>The auto correlation.</returns>
/// <exception cref="ArgumentOutOfRangeException">Throws if lag is zero or if lag is
/// greater than or equal to the length of Series.</exception>
static public double ACF<T>(IEnumerable<T> series, int lag, Func<T,double> f)
public static double ACF<T>(IEnumerable<T> series, int lag, Func<T,double> f)
{
if (lag < 0)
{
@ -78,7 +78,7 @@ namespace MathNet.Numerics.Statistics.Mcmc
/// <param name="series">The samples.</param>
/// <param name="f">The function use for evaluating the series.</param>
/// <returns>The effective size when auto correlation is taken into account.</returns>
static public double EffectiveSize<T>(IEnumerable<T> series, Func<T,double> f)
public static double EffectiveSize<T>(IEnumerable<T> series, Func<T,double> f)
{
int length = series.Count();
double rho = ACF(series, 1, f);

2
src/Numerics/Statistics/MCMC/UnivariateHybridMC.cs

@ -185,7 +185,7 @@ namespace MathNet.Numerics.Statistics.Mcmc
/// <param name="function">Function for which the derivative is to be evaluated.</param>
/// <param name="x">The location where the derivative is to be evaluated.</param>
/// <returns>The derivative of the function at the point x.</returns>
static private double Grad(DensityLn<double> function, double x)
static double Grad(DensityLn<double> function, double x)
{
double h = Math.Max(10e-4, (10e-7) * x);
double increment = x + h;

Loading…
Cancel
Save