Swift, Accelerate, and Generics
After spending a while in a Playground, I managed to get a generic vDSP multiply routine written that could work on both
Slice<Float>
and[Float]
.For no good reason at all, I decided that I should brain-dump this approach into my SMUGMath-Swift project before I lose the playground to the sands of time.
The “magic” is in the way that I was able to lean on the
withUnsafeBufferPointer
method that exists for both collection types, and then also specify some additional type clauses to ensure we’re working withFloat
vsDouble
floating point types.