Java Euclidean Distance euclidean(double[] features1, double[] features2)

Here you can find the source of euclidean(double[] features1, double[] features2)

Description

euclidean

License

Open Source License

Declaration

public static double euclidean(double[] features1, double[] features2) 

Method Source Code

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

public class Main {
    public static double euclidean(double[] features1, double[] features2) {
        double d = 0;
        if (features1 == null || features2 == null) {
            return 0;
        }//from   w  w  w  .  ja  v  a2  s . c o m
        for (int i = 0; i < features1.length; i++) {
            d += (features1[i] - features2[i]) * (features1[i] - features2[i]);
        }
        return Math.sqrt(d);
    }
}

Related

  1. euclidean(double[] _a, double[] _b)
  2. euclidean(double[] a, double[] b)
  3. euclidean(Double[] a, Double[] b)
  4. euclidean(double[] x1, double[] x2)
  5. euclidean(double[] xvalues, double[] yvalues, int[] include)
  6. euclidean_distance(double[] vec1, double[] vec2)
  7. euclideanDist(double[] ePointOne, double[] ePoint2)