Contents

formRamp(in:result:)

Populates a single-precision vector with monotonically incrementing or decrementing values within a range.

Declaration

static func formRamp<V>(in range: ClosedRange<Double>, result: inout V) where V : AccelerateMutableBuffer, V.Element == Double

Parameters

  • 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 = [Double](unsafeUninitializedCapacity: n) {
        buffer, initializedCount in
        
        vDSP.formRamp(in: Double(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)

See Also

Type Methods