[swift-users] hello, first time poster and accelerate question

Jacob Bandes-Storch jtbandes at gmail.com
Fri Nov 18 21:55:09 CST 2016


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 at 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 at swift.org
> https://lists.swift.org/mailman/listinfo/swift-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20161118/dad2a1ac/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 69098 bytes
Desc: not available
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20161118/dad2a1ac/attachment.png>


More information about the swift-users mailing list