multiply(_:_:)
Returns the single-precision element-wise product of a vector and a scalar value.
Declaration
static func multiply<U>(_ scalar: Float, _ vector: U) -> [Float] where U : AccelerateBuffer, U.Element == FloatParameters
- scalar:
The input scalar value,
B. - vector:
The input vector,
A.
Mentioned in
Return Value
The output vector, C.
Discussion
This function calculates the element-wise product of vector A and scalar value B, and writes the result to vector C.
for (n = 0; n < N; ++n)
C[n] = A[n] * B;[Image]
The following code shows an example of using this function:
let a: [Float] = [1, 2, 3, 4, 5]
let b: Float = 10
let c = vDSP.multiply(b, a)
// Prints "[10.0, 20.0, 30.0, 40.0, 50.0]".
print(c)See Also
Multiplication
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:_:)multiply(addition:_:)