multiply(subtraction:subtraction:)
Returns the double-precision element-wise product of the differences of two pairs of vectors.
Declaration
static func multiply<R, S, T, U>(subtraction subtractionAB: (a: R, b: S), subtraction subtractionCD: (c: T, d: U)) -> [Double] where R : AccelerateBuffer, S : AccelerateBuffer, T : AccelerateBuffer, U : AccelerateBuffer, R.Element == Double, S.Element == Double, T.Element == Double, U.Element == DoubleParameters
- subtractionAB:
A tuple that contains the vectors
AandBinE = (A - B) * (C - D). - subtractionCD:
A tuple that contains the vectors
CandDinE = (A - B) * (C - D).
Return Value
The output vector E in E = (A - B) * (C - D).
Discussion
This function calculates the products of the first N elements of the subtraction of vectors A and B and the subtraction of vectors C and D.
for (n = 0; n < N; ++n)
E[n] = (A[n]-B[n]) * (C[n]-D[n]); [Image]
The following code shows an example of using this function:
let a: [Double] = [ 1, 2, 3, 4, 5]
let b: [Double] = [10, 20, 30, 40, 50]
let c: [Double] = [ 5, 4, 3, 2, 1]
let d: [Double] = [50, 40, 30, 20, 10]
let e = vDSP.multiply(subtraction: (a, b),
subtraction: (c, d))
// Prints "[405.0, 648.0, 729.0, 648.0, 405.0]".
print(e)
See Also
Multiplication
multiply(_:_:)multiply(_:_:)multiply(_:_:)multiply(_:_:)multiply(_:_:result:)multiply(_:_:result:)multiply(_:_:result:)multiply(_:_:result:)multiply(_:by:count:useConjugate:result:)multiply(_:by:count:useConjugate:result:)multiply(_:by:result:)multiply(_:by:result:)multiply(addition:_:)multiply(addition:_:)multiply(addition:_:)