fill(_:with:)
Populates a single-precision vector with a specified scalar value.
Declaration
static func fill<V>(_ vector: inout V, with value: Float) where V : AccelerateMutableBuffer, V.Element == FloatParameters
- vector:
The vector to populate with the specified value.
- value:
The value to populate.
Discussion
This function populates a vector with a specified scalar value.
The following code shows how to set each element of vector c to pi:
let a = Float.pi
var c = [Float](repeating: .nan,
count: 10)
vDSP.fill(&c,
with: a)
// Prints "[3.1415925, 3.1415925, 3.1415925,
// 3.1415925, 3.1415925, 3.1415925,
// 3.1415925, 3.1415925, 3.1415925,
// 3.1415925]"
print(c)