@Test public void test1(){ double[] v1 = new double[]{8,3,7}; double[] v2 = new double[]{9,8,4}; Asserts.assertEqualLength(v1, v2); double res = Meehl.distance(v1, v2); Asserts.assertEquals(res, 80); }
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-1;i++){ sum += Math.pow((v1[i]-v2[i]-v1[i+1]+v2[i+1]),2); } return sum; }
Meehl { 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-1;i++){ sum += Math.pow((v1[i]-v2[i]-v1[i+1]+v2[i+1]),2); } return sum; } }
Meehl { 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-1;i++){ sum += Math.pow((v1[i]-v2[i]-v1[i+1]+v2[i+1]),2); } return sum; }  }
Meehl { 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-1;i++){ sum += Math.pow((v1[i]-v2[i]-v1[i+1]+v2[i+1]),2); } return sum; }  static double distance(double[] v1, double[] v2); }
Meehl { 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-1;i++){ sum += Math.pow((v1[i]-v2[i]-v1[i+1]+v2[i+1]),2); } return sum; }  static double distance(double[] v1, double[] v2);  }