Averaging all the rows in a matrix

    Jun 25 2009 | 1:00 am
    I would like to take a 2D matrix and get a vector out. Each element in the vector would be the average value of the corresponding column in the matrix. For a small example:
    0 1 1 2 3 4 5 2 1
    Would lead to:
    7/3 2 2
    It is relatively easy to do with jit.convolve and a kernel big enough to grab every value in a column, but that seems terribly inefficient. Is there a better way to do this?