diff --git a/src/Numerics/LinearAlgebra/Complex/Solvers/MILU0Preconditioner.cs b/src/Numerics/LinearAlgebra/Complex/Solvers/MILU0Preconditioner.cs
index bc6970f9..bdfef1c7 100644
--- a/src/Numerics/LinearAlgebra/Complex/Solvers/MILU0Preconditioner.cs
+++ b/src/Numerics/LinearAlgebra/Complex/Solvers/MILU0Preconditioner.cs
@@ -170,6 +170,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Solvers
/// Matrix values in MSR format (output).
/// Row pointers and column indices (output).
/// Pointer to diagonal elements (output).
+ /// True if the modified/MILU algorithm should be used (recommended)
/// Returns 0 on success or k > 0 if a zero pivot was encountered at step k.
private int Compute(int n, Complex[] a, int[] ja, int[] ia, Complex[] alu, int[] jlu, int[] ju, bool modified)
{
diff --git a/src/Numerics/LinearAlgebra/Complex32/Solvers/MILU0Preconditioner.cs b/src/Numerics/LinearAlgebra/Complex32/Solvers/MILU0Preconditioner.cs
index bfba1c97..bfabc36d 100644
--- a/src/Numerics/LinearAlgebra/Complex32/Solvers/MILU0Preconditioner.cs
+++ b/src/Numerics/LinearAlgebra/Complex32/Solvers/MILU0Preconditioner.cs
@@ -165,6 +165,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Solvers
/// Matrix values in MSR format (output).
/// Row pointers and column indices (output).
/// Pointer to diagonal elements (output).
+ /// True if the modified/MILU algorithm should be used (recommended)
/// Returns 0 on success or k > 0 if a zero pivot was encountered at step k.
private int Compute(int n, Complex32[] a, int[] ja, int[] ia, Complex32[] alu, int[] jlu, int[] ju, bool modified)
{
diff --git a/src/Numerics/LinearAlgebra/Double/Solvers/MILU0Preconditioner.cs b/src/Numerics/LinearAlgebra/Double/Solvers/MILU0Preconditioner.cs
index a127d284..5f9683af 100644
--- a/src/Numerics/LinearAlgebra/Double/Solvers/MILU0Preconditioner.cs
+++ b/src/Numerics/LinearAlgebra/Double/Solvers/MILU0Preconditioner.cs
@@ -163,6 +163,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Solvers
/// Matrix values in MSR format (output).
/// Row pointers and column indices (output).
/// Pointer to diagonal elements (output).
+ /// True if the modified/MILU algorithm should be used (recommended)
/// Returns 0 on success or k > 0 if a zero pivot was encountered at step k.
private int Compute(int n, double[] a, int[] ja, int[] ia, double[] alu, int[] jlu, int[] ju, bool modified)
{
diff --git a/src/Numerics/LinearAlgebra/Single/Solvers/MILU0Preconditioner.cs b/src/Numerics/LinearAlgebra/Single/Solvers/MILU0Preconditioner.cs
index c81d1bfd..2e26e4dd 100644
--- a/src/Numerics/LinearAlgebra/Single/Solvers/MILU0Preconditioner.cs
+++ b/src/Numerics/LinearAlgebra/Single/Solvers/MILU0Preconditioner.cs
@@ -163,6 +163,7 @@ namespace MathNet.Numerics.LinearAlgebra.Single.Solvers
/// Matrix values in MSR format (output).
/// Row pointers and column indices (output).
/// Pointer to diagonal elements (output).
+ /// True if the modified/MILU algorithm should be used (recommended)
/// Returns 0 on success or k > 0 if a zero pivot was encountered at step k.
private int Compute(int n, float[] a, int[] ja, int[] ia, float[] alu, int[] jlu, int[] ju, bool modified)
{
diff --git a/src/Numerics/LinearRegression/MultipleRegression.cs b/src/Numerics/LinearRegression/MultipleRegression.cs
index f33419d3..819ce7a9 100644
--- a/src/Numerics/LinearRegression/MultipleRegression.cs
+++ b/src/Numerics/LinearRegression/MultipleRegression.cs
@@ -53,7 +53,7 @@ namespace MathNet.Numerics.LinearRegression
/// Uses the cholesky decomposition of the normal equations.
///
/// Predictor matrix X
- /// Response vector Y
+ /// Response matrix Y
/// Best fitting vector for model parameters β
public static Matrix NormalEquations(Matrix x, Matrix y) where T : struct, IEquatable, IFormattable
{
@@ -109,7 +109,7 @@ namespace MathNet.Numerics.LinearRegression
/// Uses an orthogonal decomposition and is therefore more numerically stable than the normal equations but also slower.
///
/// Predictor matrix X
- /// Response vector Y
+ /// Response matrix Y
/// Best fitting vector for model parameters β
public static Matrix QR(Matrix x, Matrix y) where T : struct, IEquatable, IFormattable
{
@@ -164,7 +164,7 @@ namespace MathNet.Numerics.LinearRegression
/// Uses a singular value decomposition and is therefore more numerically stable (especially if ill-conditioned) than the normal equations or QR but also slower.
///
/// Predictor matrix X
- /// Response vector Y
+ /// Response matrix Y
/// Best fitting vector for model parameters β
public static Matrix Svd(Matrix x, Matrix y) where T : struct, IEquatable, IFormattable
{
diff --git a/src/Numerics/LinearRegression/WeightedRegression.cs b/src/Numerics/LinearRegression/WeightedRegression.cs
index 9d7ec732..0271e874 100644
--- a/src/Numerics/LinearRegression/WeightedRegression.cs
+++ b/src/Numerics/LinearRegression/WeightedRegression.cs
@@ -31,7 +31,6 @@
using System;
using System.Collections.Generic;
using MathNet.Numerics.LinearAlgebra;
-using MathNet.Numerics.LinearAlgebra.Storage;
namespace MathNet.Numerics.LinearRegression
{
@@ -40,6 +39,9 @@ namespace MathNet.Numerics.LinearRegression
///
/// Weighted Linear Regression using normal equations.
///
+ /// Predictor matrix X
+ /// Response vector Y
+ /// Weight matrix W, usually diagonal with an entry for each predictor (row).
public static Vector Weighted(Matrix x, Vector y, Matrix w) where T : struct, IEquatable, IFormattable
{
return x.TransposeThisAndMultiply(w*x).Cholesky().Solve(x.TransposeThisAndMultiply(w*y));
@@ -48,6 +50,9 @@ namespace MathNet.Numerics.LinearRegression
///
/// Weighted Linear Regression using normal equations.
///
+ /// Predictor matrix X
+ /// Response matrix Y
+ /// Weight matrix W, usually diagonal with an entry for each predictor (row).
public static Matrix Weighted(Matrix x, Matrix y, Matrix w) where T : struct, IEquatable, IFormattable
{
return x.TransposeThisAndMultiply(w*x).Cholesky().Solve(x.TransposeThisAndMultiply(w*y));
@@ -56,6 +61,9 @@ namespace MathNet.Numerics.LinearRegression
///
/// Weighted Linear Regression using normal equations.
///
+ /// Predictor matrix X
+ /// Response vector Y
+ /// Weight matrix W, usually diagonal with an entry for each predictor (row).
/// True if an intercept should be added as first artificial perdictor value. Default = false.
public static T[] Weighted(T[][] x, T[] y, T[] w, bool intercept = false) where T : struct, IEquatable, IFormattable
{
@@ -72,16 +80,19 @@ namespace MathNet.Numerics.LinearRegression
///
/// Weighted Linear Regression using normal equations.
///
+ /// List of sample vectors (predictor) together with their response.
+ /// List of weights, one for each sample.
/// True if an intercept should be added as first artificial perdictor value. Default = false.
- public static T[] Weighted(IEnumerable> samples, T[] w, bool intercept = false) where T : struct, IEquatable, IFormattable
+ public static T[] Weighted(IEnumerable> samples, T[] weights, bool intercept = false) where T : struct, IEquatable, IFormattable
{
var xy = samples.UnpackSinglePass();
- return Weighted(xy.Item1, xy.Item2, w, intercept);
+ return Weighted(xy.Item1, xy.Item2, weights, intercept);
}
///
/// Locally-Weighted Linear Regression using normal equations.
///
+ [Obsolete("Warning: This function is here to stay but its signature will likely change.")]
public static Vector Local(Matrix x, Vector y, Vector t, double radius, Func kernel) where T : struct, IEquatable, IFormattable
{
// TODO: Weird kernel definition
@@ -96,6 +107,7 @@ namespace MathNet.Numerics.LinearRegression
///
/// Locally-Weighted Linear Regression using normal equations.
///
+ [Obsolete("Warning: This function is here to stay but its signature will likely change.")]
public static Matrix Local(Matrix x, Matrix y, Vector t, double radius, Func kernel) where T : struct, IEquatable, IFormattable
{
// TODO: Weird kernel definition
@@ -107,6 +119,7 @@ namespace MathNet.Numerics.LinearRegression
return Weighted(x, y, w);
}
+ [Obsolete("Warning: This function is here to stay but will likely be refactored and/or moved to another place.")]
public static double GaussianKernel(double normalizedDistance)
{
return Math.Exp(-0.5*normalizedDistance*normalizedDistance);
diff --git a/src/Numerics/Precision.Equality.cs b/src/Numerics/Precision.Equality.cs
index e36945bf..870ac5cc 100644
--- a/src/Numerics/Precision.Equality.cs
+++ b/src/Numerics/Precision.Equality.cs
@@ -397,6 +397,7 @@ namespace MathNet.Numerics
/// The norm of the first value (can be negative).
/// The norm of the second value (can be negative).
/// The norm of the difference of the two values (can be negative).
+ /// The number of decimal places.
/// Thrown if is smaller than zero.
public static bool AlmostEqualNormRelative(this double a, double b, double diff, int decimalPlaces)
{