Can't you achieve this with a single vector*matrix multiplication? [1/n, 1/n, ..., 1/n] * A = [mean(col 1); mean(col 2); ...; mean(col n)]
Or in more legible form: [image: Inline image 1] Jacob On Fri, Nov 18, 2016 at 5:36 AM, Yuma Decaux via swift-users < swift-users@swift.org> wrote: > Hello everyone, > > Nice to meet y'all, and here's my first question: > > I am currently setting a semantically easy to use accelerate operation > extension set for my research. > > I have done all the basic operations, vector to scalar, vector to vector, > matrix mult matrix, transpose etc, but would like to know what the best > approach might be for getting the mean for a matrix, as I am not sure if > the result is what I think it is. In fact, I would like an output of m by 1 > from an n by m matrix with means of each column vector. > > The function is: > func vDSP_meanvD(UnsafePointer<Double>, vDSP_Stride, > UnsafeMutablePointer<Double>, vDSP_Length) > > I assume for a vector this is fine since it is 1 dimensional, but for > matrices here is my question: > > What is the approach to take? > 1-Do I slice my matrix into m copies of size n where M_i(n by m) and pass > them all through vDSP_meanvD? > 2- Does the stride argument take care of this, in that if I have stride of > n, then the ranges [0:n], [n+1: 2n], [2n+1: 3n] will have their mean and > std computed? > > > Thanks for any pointer > > Best regards, > > > > > _______________________________________________ > swift-users mailing list > swift-users@swift.org > https://lists.swift.org/mailman/listinfo/swift-users >
_______________________________________________ swift-users mailing list swift-users@swift.org https://lists.swift.org/mailman/listinfo/swift-users