code: public static double[] colMeans (RealMatrix matrix) {
          // Get the col sums:
          double[] retval = EMatrixUtils.colSums(matrix);
  
          // Iterate over return value and divide by the length:
          for (int i = 0; i < retval.length; i++) {
              retval[i] = retval[i] / matrix.getRowDimension();
          }
  
          // Done, return col means:
          return retval;
      }
docs: Returns the means of columns.
  
  @param matrix The matrix of which the means of columns to be computed
  @return A double array of column means