Contents

ramp(withInitialValue:increment:count:)

Returns a single-precision vector that contains monotonically incrementing or decrementing values using an initial value and increment.

Declaration

static func ramp(withInitialValue initialValue: Float, increment: Float, count: Int) -> [Float]

Parameters

  • initialValue:

    The initial value of the ramp.

  • increment:

    The increment, or decrement if negative, between each generated element.

  • count:

    The number of elements in the 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 ramp = vDSP.ramp(withInitialValue: Float(0),
                         increment: 1,
                         count: 8)
    
    // Prints "[0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0]".
    print(ramp)

See Also

Type Methods