docs: public static void logNormalize(double[] a) {
      double logTotal = logSum(a);
      if (logTotal == Double.NEGATIVE_INFINITY) {
        // to avoid NaN values
        double v = -Math.log(a.length);
        for (int i = 0; i < a.length; i++) {
          a[i] = v;
        }
        return;
      }
      addInPlace(a, -logTotal); // subtract log total from each value
    }