diff --git a/src/Numerics/Fit.cs b/src/Numerics/Fit.cs
index 2aeb3312..c8ded4e0 100644
--- a/src/Numerics/Fit.cs
+++ b/src/Numerics/Fit.cs
@@ -81,36 +81,6 @@ namespace MathNet.Numerics
return z => slope * z;
}
- ///
- /// Least-Squares fitting the points (X,y) = ((x0,x1,..,xk),y) to a linear surface y : X -> p0*x0 + p1*x1 + ... + pk*xk,
- /// returning its best fitting parameters as [p0, p1, p2, ..., pk] array.
- /// If an intercept is added, its coefficient will be prepended to the resulting parameters.
- ///
- public static double[] MultiDim(double[][] x, double[] y, bool intercept = false, DirectRegressionMethod method = DirectRegressionMethod.NormalEquations)
- {
- return MultipleRegression.DirectMethod(x, y, intercept, method);
- }
-
- ///
- /// Least-Squares fitting the points (X,y) = ((x0,x1,..,xk),y) to a linear surface y : X -> p0*x0 + p1*x1 + ... + pk*xk,
- /// returning a function y' for the best fitting combination.
- /// If an intercept is added, its coefficient will be prepended to the resulting parameters.
- ///
- public static Func MultiDimFunc(double[][] x, double[] y, bool intercept = false, DirectRegressionMethod method = DirectRegressionMethod.NormalEquations)
- {
- var parameters = MultipleRegression.DirectMethod(x, y, intercept, method);
- return z => LinearAlgebraControl.Provider.DotProduct(parameters, z);
- }
-
- ///
- /// Weighted Least-Squares fitting the points (X,y) = ((x0,x1,..,xk),y) and weights w to a linear surface y : X -> p0*x0 + p1*x1 + ... + pk*xk,
- /// returning its best fitting parameters as [p0, p1, p2, ..., pk] array.
- ///
- public static double[] MultiDimWeighted(double[][] x, double[] y, double[] w)
- {
- return WeightedRegression.Weighted(x, y, w);
- }
-
///
/// Least-Squares fitting the points (x,y) to an exponential y : x -> a*exp(r*x),
/// returning its best fitting parameters as (a, r) tuple.
@@ -169,6 +139,7 @@ namespace MathNet.Numerics
double[] p_hat = Fit.LinearCombination(x, y_hat, method, t => 1.0, Math.Log);
return Tuple.Create(Math.Exp(p_hat[0]), p_hat[1]);
}
+
///
/// Least-Squares fitting the points (x,y) to a power y : x -> a*x^b,
/// returning a function y' for the best fitting line.
@@ -254,6 +225,36 @@ namespace MathNet.Numerics
return z => functions.Zip(parameters, (f, p) => p*f(z)).Sum();
}
+ ///
+ /// Least-Squares fitting the points (X,y) = ((x0,x1,..,xk),y) to a linear surface y : X -> p0*x0 + p1*x1 + ... + pk*xk,
+ /// returning its best fitting parameters as [p0, p1, p2, ..., pk] array.
+ /// If an intercept is added, its coefficient will be prepended to the resulting parameters.
+ ///
+ public static double[] MultiDim(double[][] x, double[] y, bool intercept = false, DirectRegressionMethod method = DirectRegressionMethod.NormalEquations)
+ {
+ return MultipleRegression.DirectMethod(x, y, intercept, method);
+ }
+
+ ///
+ /// Least-Squares fitting the points (X,y) = ((x0,x1,..,xk),y) to a linear surface y : X -> p0*x0 + p1*x1 + ... + pk*xk,
+ /// returning a function y' for the best fitting combination.
+ /// If an intercept is added, its coefficient will be prepended to the resulting parameters.
+ ///
+ public static Func MultiDimFunc(double[][] x, double[] y, bool intercept = false, DirectRegressionMethod method = DirectRegressionMethod.NormalEquations)
+ {
+ var parameters = MultipleRegression.DirectMethod(x, y, intercept, method);
+ return z => LinearAlgebraControl.Provider.DotProduct(parameters, z);
+ }
+
+ ///
+ /// Weighted Least-Squares fitting the points (X,y) = ((x0,x1,..,xk),y) and weights w to a linear surface y : X -> p0*x0 + p1*x1 + ... + pk*xk,
+ /// returning its best fitting parameters as [p0, p1, p2, ..., pk] array.
+ ///
+ public static double[] MultiDimWeighted(double[][] x, double[] y, double[] w)
+ {
+ return WeightedRegression.Weighted(x, y, w);
+ }
+
///
/// Least-Squares fitting the points (X,y) = ((x0,x1,..,xk),y) to an arbitrary linear combination y : X -> p0*f0(x) + p1*f1(x) + ... + pk*fk(x),
/// returning its best fitting parameters as [p0, p1, p2, ..., pk] array.