Java Euclidean Distance euclidean_distance(double[] vec1, double[] vec2)

Here you can find the source of euclidean_distance(double[] vec1, double[] vec2)

Description

euclideadistance

License

Apache License

Declaration

public static double euclidean_distance(double[] vec1, double[] vec2) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    public static double euclidean_distance(double[] vec1, double[] vec2) {
        double dist = 0;
        for (int i = 0; i < vec1.length && i < vec2.length; i++)
            dist += Math.pow(vec1[i] - vec2[i], 2);
        dist = Math.sqrt(dist);/*from w ww .  j  a va  2s. co  m*/
        return dist;
    }
}

Related

  1. euclidean(double[] a, double[] b)
  2. euclidean(Double[] a, Double[] b)
  3. euclidean(double[] features1, double[] features2)
  4. euclidean(double[] x1, double[] x2)
  5. euclidean(double[] xvalues, double[] yvalues, int[] include)
  6. euclideanDist(double[] ePointOne, double[] ePoint2)
  7. euclideanDist(final double[] vec1, final double[] vec2, int n)
  8. euclideanDist(float[] v1, float[] v2)
  9. euclideanDistance(double instance1[], double instance2[])