@Test public void auto_test35(){ double[] v1 = new double[]{710.191259659179, -352.8506941967797, -93.60639998878251, 282.37142534665395, -72.68374727939775, -654.9055511943958, -643.655501327875, -516.5991495013965, 295.6682930746838, 111.97474342571834}; double[] v2 = new double[]{833.2344024906043, -489.0252803913375, 33.235129522342646, 444.7238416617797, -713.6807752329219, 391.91163402028474, 461.13096106181825, -856.3267971470532, 728.3346479399695, 933.0777015877717}; double p = 82; double res = LP.distance(p, v1, v2); double ref = 1104.9477050588846; 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[]);  }