/// <summary> /// Calculates the distance between two vectors /// </summary> /// <param name="distance"></param> /// <param name="vector1"></param> /// <param name="vector2"></param> public static float Calculate(this DistanceMetric distance, IVector vector1, IVector vector2) { switch (distance) { case DistanceMetric.Cosine: return(vector1.CosineDistance(vector2)); case DistanceMetric.Euclidean: return(vector1.EuclideanDistance(vector2)); case DistanceMetric.Manhattan: return(vector1.ManhattanDistance(vector2)); case DistanceMetric.SquaredEuclidean: return(vector1.SquaredEuclidean(vector2)); default: return(vector1.MeanSquaredDistance(vector2)); } }
public double Distance(IVector <double> x, double[] y, int offy) { return(x.ManhattanDistance(y, offy)); }
public float Distance(IVector <float> x, float[] y, int offy) { return(x.ManhattanDistance(y, offy)); }