@Test public void auto_test29(){ double[] v1 = new double[]{721029.4406644551, 536036.0331675485, 756019.305401209, 369415.1779921624, 12387.742590731832, 273493.51595713466, 793470.2342677673, 652388.6359273122, 84764.25783040887, 974195.3729564988}; double[] v2 = new double[]{654150.8085320374, 435502.8506330867, 194681.96966157836, 63409.19151408409, 194992.69236042982, 442584.79092221835, 513261.9438210676, 912952.6552284833, 373752.1433534321, 686962.799715993}; double p = 30.34894595459341; double res = LP.distance(p, v1, v2); double ref = 561337.336000359; 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[]);  }