divide(_:_:)
Returns the single-precision element-wise division of two vectors.
Declaration
static func divide<T, U>(_ vectorA: T, _ vectorB: U) -> [Float] where T : AccelerateBuffer, U : AccelerateBuffer, T.Element == Float, U.Element == FloatParameters
- vectorA:
The first input vector,
A. - vectorB:
The second input vector,
B.
Mentioned in
Return Value
The output vector, C.
Discussion
This function calculates the division of the first N elements of input vectors A and B, and writes the result to output vector C.
for (n = 0; n < N; ++n)
C[n] = A[n] / B[n];[Image]
The following code shows an example of using this function:
let a: [Float] = [10, 20, 30, 40, 50]
let b: [Float] = [ 1, 2, 3, 4, 5]
let c = vDSP.divide(a, b)
// Prints "[10.0, 10.0, 10.0, 10.0, 10.0]".
print(c)