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