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;
    }
public static double [ ] colMeans ( RealMatrix matrix ) { double [ ] retval = EMatrixUtils . colSums ( matrix ) ; for ( int i = 0 ; i < retval . length ; i ++ ) { retval [ i ] = retval [ i ] / matrix . getRowDimension ( ) ; } return retval ; }
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