@Test public void test3(){ double[] v1 = new double[]{248.124,-321.574,788.14,0.001,-459.298}; double[] v2 = new double[]{97.145,-78.658,417.0004,-4.02,-7865.3594}; Asserts.assertEqualLength(v1, v2); double res = Clark.distance(v1, v2); Asserts.assertEquals(res, 0.69941577660644458757); }
public static double distance(double[] v1, double[] v2){ Asserts.assertEqualLength(v1, v2); int n = v1.length; double sum = 0; for(int i=0;i<n;i++){ sum += Math.pow((v1[i]-v2[i])/(Math.abs(v1[i])+Math.abs(v2[i])),2); } return Math.sqrt(sum/n); }
Clark { public static double distance(double[] v1, double[] v2){ Asserts.assertEqualLength(v1, v2); int n = v1.length; double sum = 0; for(int i=0;i<n;i++){ sum += Math.pow((v1[i]-v2[i])/(Math.abs(v1[i])+Math.abs(v2[i])),2); } return Math.sqrt(sum/n); } }
Clark { public static double distance(double[] v1, double[] v2){ Asserts.assertEqualLength(v1, v2); int n = v1.length; double sum = 0; for(int i=0;i<n;i++){ sum += Math.pow((v1[i]-v2[i])/(Math.abs(v1[i])+Math.abs(v2[i])),2); } return Math.sqrt(sum/n); }  }
Clark { public static double distance(double[] v1, double[] v2){ Asserts.assertEqualLength(v1, v2); int n = v1.length; double sum = 0; for(int i=0;i<n;i++){ sum += Math.pow((v1[i]-v2[i])/(Math.abs(v1[i])+Math.abs(v2[i])),2); } return Math.sqrt(sum/n); }  static double distance(double[] v1, double[] v2); }
Clark { public static double distance(double[] v1, double[] v2){ Asserts.assertEqualLength(v1, v2); int n = v1.length; double sum = 0; for(int i=0;i<n;i++){ sum += Math.pow((v1[i]-v2[i])/(Math.abs(v1[i])+Math.abs(v2[i])),2); } return Math.sqrt(sum/n); }  static double distance(double[] v1, double[] v2);  }