diff --git a/src/Numerics/Distance.cs b/src/Numerics/Distance.cs index 4f9433e9..8dfca7a3 100644 --- a/src/Numerics/Distance.cs +++ b/src/Numerics/Distance.cs @@ -39,15 +39,7 @@ namespace MathNet.Numerics /// /// Sum of Absolute Difference (SAD), i.e. the L1-norm (Manhattan) of the difference. /// - public static double SAD(Vector a, Vector b) - { - return (a - b).L1Norm(); - } - - /// - /// Sum of Absolute Difference (SAD), i.e. the L1-norm (Manhattan) of the difference. - /// - public static double SAD(Vector a, Vector b) + public static double SAD(Vector a, Vector b) where T : struct, IEquatable, IFormattable { return (a - b).L1Norm(); } @@ -85,15 +77,7 @@ namespace MathNet.Numerics /// /// Mean-Absolute Error (MAE), i.e. the normalized L1-norm (Manhattan) of the difference. /// - public static double MAE(Vector a, Vector b) - { - return (a - b).L1Norm()/a.Count; - } - - /// - /// Mean-Absolute Error (MAE), i.e. the normalized L1-norm (Manhattan) of the difference. - /// - public static double MAE(Vector a, Vector b) + public static double MAE(Vector a, Vector b) where T : struct, IEquatable, IFormattable { return (a - b).L1Norm()/a.Count; } @@ -117,16 +101,7 @@ namespace MathNet.Numerics /// /// Sum of Squared Difference (SSD), i.e. the squared L2-norm (Euclidean) of the difference. /// - public static double SSD(Vector a, Vector b) - { - var norm = (a - b).L2Norm(); - return norm*norm; - } - - /// - /// Sum of Squared Difference (SSD), i.e. the squared L2-norm (Euclidean) of the difference. - /// - public static double SSD(Vector a, Vector b) + public static double SSD(Vector a, Vector b) where T : struct, IEquatable, IFormattable { var norm = (a - b).L2Norm(); return norm*norm; @@ -155,16 +130,7 @@ namespace MathNet.Numerics /// /// Mean-Squared Error (MSE), i.e. the normalized squared L2-norm (Euclidean) of the difference. /// - public static double MSE(Vector a, Vector b) - { - var norm = (a - b).L2Norm(); - return norm*norm/a.Count; - } - - /// - /// Mean-Squared Error (MSE), i.e. the normalized squared L2-norm (Euclidean) of the difference. - /// - public static double MSE(Vector a, Vector b) + public static double MSE(Vector a, Vector b) where T : struct, IEquatable, IFormattable { var norm = (a - b).L2Norm(); return norm*norm/a.Count; @@ -189,15 +155,7 @@ namespace MathNet.Numerics /// /// Euclidean Distance, i.e. the L2-norm of the difference. /// - public static double Euclidean(Vector a, Vector b) - { - return (a - b).L2Norm(); - } - - /// - /// Euclidean Distance, i.e. the L2-norm of the difference. - /// - public static double Euclidean(Vector a, Vector b) + public static double Euclidean(Vector a, Vector b) where T : struct, IEquatable, IFormattable { return (a - b).L2Norm(); } @@ -221,15 +179,7 @@ namespace MathNet.Numerics /// /// Manhattan Distance, i.e. the L1-norm of the difference. /// - public static double Manhattan(Vector a, Vector b) - { - return (a - b).L1Norm(); - } - - /// - /// Manhattan Distance, i.e. the L1-norm of the difference. - /// - public static double Manhattan(Vector a, Vector b) + public static double Manhattan(Vector a, Vector b) where T : struct, IEquatable, IFormattable { return (a - b).L1Norm(); } @@ -253,15 +203,7 @@ namespace MathNet.Numerics /// /// Chebyshev Distance, i.e. the Infinity-norm of the difference. /// - public static double Chebyshev(Vector a, Vector b) - { - return (a - b).InfinityNorm(); - } - - /// - /// Chebyshev Distance, i.e. the Infinity-norm of the difference. - /// - public static double Chebyshev(Vector a, Vector b) + public static double Chebyshev(Vector a, Vector b) where T : struct, IEquatable, IFormattable { return (a - b).InfinityNorm(); }