Пример #1
0
 /// <summary>
 /// Manhattan distance function; <i>Sum( abs(x[i]-y[i]) )</i>.
 /// </summary>
 /// <returns></returns>
 public static VectorVectorFunction MANHATTAN()
 {
     return((a, b) => a.Aggregate(b, F2.Plus, F2.Chain(F1.Abs, F2.Minus)));
 }
Пример #2
0
 /// <summary>
 /// Bray-Curtis distance function; <i>Sum( abs(x[i]-y[i]) )  /  Sum( x[i]+y[i] )</i>.
 /// </summary>
 /// <returns></returns>
 public static VectorVectorFunction BRAY_CURTIS()
 {
     return((a, b) => a.Aggregate(b, F2.Plus, F2.Chain(F1.Abs, F2.Minus)) / a.Aggregate(b, F2.Plus, F2.Plus));
 }
Пример #3
0
 /// <summary>
 /// Maximum distance function; <i>Max( abs(x[i]-y[i]) )</i>.
 /// </summary>
 /// <returns></returns>
 public static VectorVectorFunction MAXIMUM()
 {
     return((a, b) => a.Aggregate(b, F2.Max, F2.Chain(F1.Abs, F2.Minus)));
 }
Пример #4
0
        //private static Cern.Jet.Math.Functions.DoubleDoubleFunctions F;

        /// <summary>
        /// Euclidean distance function; <i>Sqrt(Sum( (x[i]-y[i])^2 ))</i>.
        /// </summary>
        /// <returns></returns>
        public static VectorVectorFunction EUCLID()
        {
            return((a, b) => System.Math.Sqrt(a.Aggregate(b, F2.Plus, F2.Chain(F1.Square, F2.Minus))));
        }