docs: public static double logSumOfExponentials(double[] arr) {
      if (arr.length == 0) {
        return Double.NEGATIVE_INFINITY;
      }
  
      final double maxVal = Doubles.max(arr);
      double ret = 0.0;
      for (int i = 0; i < arr.length; ++i) {
        // ensures biggest value we ever exp is 0.
        ret += Math.exp(arr[i] - maxVal);
      }
      return maxVal + Math.log(ret);
    }