@Test public void auto_test22(){ double[] v1 = new double[]{9.500806945025971, 6.164034866188849, 3.912410389246417, 7.707439883460072, 5.793942895336532, 3.2826107269108973, 6.533534034642568, 6.5954474924831175, 1.9209647758936932, 5.5056357508952996}; double[] v2 = new double[]{8.49449008754142, 6.648751982325237, 6.478384978724981, 1.8356254037536113, 9.627961797825042, 1.068673562444843, 2.194486679155795, 7.558496654789623, 9.12468266830256, 4.334796006214711}; double p = 64.94317436134; double res = LP.distance(p, v1, v2); double ref = 7.20371808255343; 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[]);  }