Java Euclidean Distance euclideanDist(double[] ePointOne, double[] ePoint2)

Here you can find the source of euclideanDist(double[] ePointOne, double[] ePoint2)

Description

euclidean Dist

License

Open Source License

Declaration

public static double euclideanDist(double[] ePointOne, double[] ePoint2) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static double euclideanDist(double[] ePointOne, double[] ePoint2) {
        double diff;
        int i;//from w  w  w  . j  av  a 2s. c o m
        double eDist = 0;

        for (i = 0; i < ePointOne.length; i++) {
            if (i < ePoint2.length) {
                diff = ePointOne[i] - ePoint2[i];
            } else {
                diff = 0;
            }
            eDist += (diff * diff);
        }
        eDist = Math.sqrt(eDist);

        return (eDist);
    }
}

Related

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