formRamp(in:result:)
Populates a double-precision vector with monotonically incrementing or decrementing values within a range.
Declaration
static func formRamp<V>(in range: ClosedRange<Float>, result: inout V) where V : AccelerateMutableBuffer, V.Element == FloatParameters
- range:
The start and end values of the generated ramp.
- result:
The array that receives the generated ramp.
Discussion
Use this function to generate and return a vector populated with ramped values.
The following code generates a ramped vector with values in the range 0 ... 7:
let n = 8
let ramp = [Float](unsafeUninitializedCapacity: n) {
buffer, initializedCount in
vDSP.formRamp(in: Float(0) ... 7,
result: &buffer)
initializedCount = n
}
// Prints "[0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0]".
print(ramp)