how to find average of rows for each column in a matrix

    Dec 11 2015 | 2:40 am
    I have a 1024x256 matrix, and I'd like to produce a 1024x1 matrix which contains the average (mean) for each column. I was hoping copying the matrix into a 1 row matrix with interp 1 would downscale correctly, but it doesn't (see attached file). How can I do this? searching on the forum and google led me to jit.3m, but that finds the average for the whole matrix. I could split up each column into it's own matrix and call 3m on it, but with 1024 columns that could be bad! Alternatively I could iterate the matrix rows, get each row as a submatrix and accumulate with previous rows, then average manually (in javascript) but still seems quite inefficient. Is there a more feasible way?

    • Dec 11 2015 | 6:32 pm
      jit.dimop @op avg is what you're looking for. Just set the @step attribute appropriately.
    • Dec 11 2015 | 10:41 pm
      wow that's super thx, i missed that one someone.