Here you can find the source of euclidean(double[] xvalues, double[] yvalues, int[] include)
public static double euclidean(double[] xvalues, double[] yvalues, int[] include)
//package com.java2s; //License from project: Open Source License public class Main { /**//from w w w. ja v a 2s . co m * Returns the euclidean distance between xvalues and yvalues for those include values * that are non-zero. */ public static double euclidean(double[] xvalues, double[] yvalues, int[] include) { double ddiff; double ddist; double dsumsq = 0; for (int nindex = 0; nindex < include.length; nindex++) { if (include[nindex] != 0) { ddiff = (xvalues[nindex] - yvalues[nindex]); dsumsq += ddiff * ddiff; } } ddist = Math.sqrt(dsumsq); return ddist; } }