ios - Accelerate: how do I add multiple vectors into an output vector of different size from the input vectors? -
ios - Accelerate: how do I add multiple vectors into an output vector of different size from the input vectors? -
i have 4 vectors, a,b,c,d, 1024 doubles long. have output vector o, 1792 doubles long, , zeros.
i want add together o added double-for-double @ position 0-1023
i want same b 256 doubles later, add together b o b added double-for-double @ position 256-1279
then same c, position 512-1535
then same d, position 768-1791
how can using apple's accellerate framework? looking vdsp_vaddd, output array seems have of same length?
i'm trying express in swift, if using objective c expect utilize pointer arithmetics express in output array wanted start be?
cheers
nik
o.withunsafemutablebufferpointer { (inout bufptr : unsafemutablebufferpointer<double>) -> void in var ptr = bufptr.baseaddress vaddd(a, 1, ptr, 1, ptr, 1, 1024) ptr += 256 vaddd(b, 1, ptr, 1, ptr, 1, 1024) ptr += 256 vaddd(c, 1, ptr, 1, ptr, 1, 1024) ptr += 256 vaddd(d, 1, ptr, 1, ptr, 1, 1024) }
i admit looks ugly, , unsafe in sense neither swift compiler nor runtime can check array bounds, solution find.
ios cocoa-touch vector swift accelerate-framework
Comments
Post a Comment