@Test public void auto_test17(){ double[] v1 = new double[]{492, 722, -10, -910, -281, -913, 565, 820, 402, 26}; double[] v2 = new double[]{311, 334, -380, -882, 440, 301, 119, 924, -458, -899}; double p = 46; double res = LP.distance(p, v1, v2); double ref = 1214.0001011291756; Asserts.assertDistance(ref); Asserts.assertEquals(res, ref); }
public static double distance(double p, double v1[], double v2[]){ double sum = 0; for(int i=0; i < v1.length; i++){ sum+=Math.pow(CommonStats.abs(v1[i]-v2[i]),p); } double res = Math.pow(sum, 1/p); Asserts.assertDistance(res); return res; }
LP { public static double distance(double p, double v1[], double v2[]){ double sum = 0; for(int i=0; i < v1.length; i++){ sum+=Math.pow(CommonStats.abs(v1[i]-v2[i]),p); } double res = Math.pow(sum, 1/p); Asserts.assertDistance(res); return res; } }
LP { public static double distance(double p, double v1[], double v2[]){ double sum = 0; for(int i=0; i < v1.length; i++){ sum+=Math.pow(CommonStats.abs(v1[i]-v2[i]),p); } double res = Math.pow(sum, 1/p); Asserts.assertDistance(res); return res; }  }
LP { public static double distance(double p, double v1[], double v2[]){ double sum = 0; for(int i=0; i < v1.length; i++){ sum+=Math.pow(CommonStats.abs(v1[i]-v2[i]),p); } double res = Math.pow(sum, 1/p); Asserts.assertDistance(res); return res; }  static double distance(double p, double v1[], double v2[]); }
LP { public static double distance(double p, double v1[], double v2[]){ double sum = 0; for(int i=0; i < v1.length; i++){ sum+=Math.pow(CommonStats.abs(v1[i]-v2[i]),p); } double res = Math.pow(sum, 1/p); Asserts.assertDistance(res); return res; }  static double distance(double p, double v1[], double v2[]);  }