@Test public void auto_test38(){ double[] v1 = new double[]{902130.1073314352, 246377.8946189279, -277889.6325704163, -667772.34806861, -921779.6249731211, -612414.2150602565, -714055.0282938541, 908937.0105608648, -588257.5633952632, 285378.48588335747}; double[] v2 = new double[]{294501.2067259808, 904048.8089709593, 91598.97222160584, 731100.0962504292, 228713.13711570372, 882090.9932138838, -296493.83265220607, 196760.5312820072, -283725.88729284896, -749494.436772235}; double p = 1; double res = LP.distance(p, v1, v2); double ref = 8147801.108110025; 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[]);  }