@Test public void testCovariance() { double[] a = new double[] { 2, 3, 4, 5, 6 }; double[] b = new double[] { 2.2, 33.2, 44.4, 55.5, 66.6 }; Covariance cov = new Covariance(); double covariance = cov.covariance(a, b, false); double amean = MathUtils.mean(a); double bmean = MathUtils.mean(b); assertEquals(covariance, MathUtils.covariance(a, amean, b, bmean), 0.001); }
public static double covariance(double[] a, double amean, double[] b, double bmean) { double t = 0; for (int i = 0; i < a.length; i++) { t += (a[i] - amean) * (b[i] - bmean); } return t / a.length; }
MathUtils { public static double covariance(double[] a, double amean, double[] b, double bmean) { double t = 0; for (int i = 0; i < a.length; i++) { t += (a[i] - amean) * (b[i] - bmean); } return t / a.length; } }
MathUtils { public static double covariance(double[] a, double amean, double[] b, double bmean) { double t = 0; for (int i = 0; i < a.length; i++) { t += (a[i] - amean) * (b[i] - bmean); } return t / a.length; }  }
MathUtils { public static double covariance(double[] a, double amean, double[] b, double bmean) { double t = 0; for (int i = 0; i < a.length; i++) { t += (a[i] - amean) * (b[i] - bmean); } return t / a.length; }  static double ppmcc(double[] a, double[] b); static double mean(double[] a); static long mean(long[] a); static double covariance(double[] a, double amean, double[] b, double bmean); static long standardDeviation(long[] a, long avg); static double standardDeviation(double[] a, double avg); static double[] ppmcc(double[][] ary, int baseIndex); }
MathUtils { public static double covariance(double[] a, double amean, double[] b, double bmean) { double t = 0; for (int i = 0; i < a.length; i++) { t += (a[i] - amean) * (b[i] - bmean); } return t / a.length; }  static double ppmcc(double[] a, double[] b); static double mean(double[] a); static long mean(long[] a); static double covariance(double[] a, double amean, double[] b, double bmean); static long standardDeviation(long[] a, long avg); static double standardDeviation(double[] a, double avg); static double[] ppmcc(double[][] ary, int baseIndex);  }