sum(_:)
Returns the single-precision vector sum.
Declaration
static func sum<U>(_ vector: U) -> Float where U : AccelerateBuffer, U.Element == FloatParameters
- vector:
The vector to sum.
Discussion
This function calculates and returns the sum of the elements of a supplied vector.
The following is an example of using sum(_:):
let a: [Float] = [-1.5, 2.25, 3.6,
0.2, -0.1, -4.3]
let sum = vDSP.sum(a)
// Prints "sum 0.1500"
print(String(format: "sum %.4f", sum))