code: public static double jensenShannonDivergence(double[] a, double[] b) {
      double[] average = pairwiseAdd(a, b);
      multiplyInPlace(average, .5);
      return .5 * klDivergence(a, average) + .5 * klDivergence(b, average);
    }
docs: Returns the Jensen Shannon divergence (information radius) between
  a and b, defined as the average of the kl divergences from a to b
  and from b to a.