code: public double normalize() {
          double propSum = this.getSum();
          if (propSum == s.zero()) {
              this.fill(s.divide(s.one(), s.fromReal(values.length)));
          } else if (propSum == s.posInf()) {
              int count = DoubleArrays.count(values, s.posInf());
              if (count == 0) {
                  throw new RuntimeException("Unable to normalize since sum is infinite but contains no infinities: " + Arrays.toString(values));
              }
              double constant = s.divide(s.one(), s.fromReal(count));
              for (int d=0; d<values.length; d++) {
                  if (values[d] == s.posInf()) {
                      values[d] = constant;
                  } else {
                      values[d] = s.zero();
                  }
              }
          } else {
              this.divide(propSum);
              assert !this.containsNaN();
          }
          return propSum;
      }
docs: Normalizes the values so that they sum to 1