code: public static void scale(double[][] x, double lo, double hi) {
          int n = x.length;
          int p = x[0].length;
  
          double[] min = colMin(x);
          double[] max = colMax(x);
  
          for (int j = 0; j < p; j++) {
              double scale = max[j] - min[j];
              if (!Math.isZero(scale)) {
                  for (int i = 0; i < n; i++) {
                      x[i][j] = (x[i][j] - min[j]) / scale;
                  }
              } else {
                  for (int i = 0; i < n; i++) {
                      x[i][j] = 0.5;
                  }
              }
          }
      }
docs: Scales each column of a matrix to range [lo, hi].
  @param lo lower limit of range
  @param hi upper limit of range