<!--
{
  "availability" : [
    "iOS: 13.0.0 -",
    "iPadOS: 13.0.0 -",
    "macCatalyst: -",
    "macOS: 10.15.0 -",
    "tvOS: 13.0.0 -",
    "visionOS: -",
    "watchOS: 6.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Accelerate",
  "identifier" : "/documentation/Accelerate/vDSP/formRamp(withInitialValue:increment:result:)-40zxg",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "Accelerate"
    ],
    "preciseIdentifier" : "s:10Accelerate4vDSPO8formRamp16withInitialValue9increment6resultySf_SfxztAA0A13MutableBufferRzSf7ElementRtzlFZ"
  },
  "title" : "formRamp(withInitialValue:increment:result:)"
}
-->

# formRamp(withInitialValue:increment:result:)

Populates a single-precision vector with monotonically incrementing or decrementing values using an initial value and increment.

```
static func formRamp<V>(withInitialValue initialValue: Float, increment: Float, result: inout V) where V : AccelerateMutableBuffer, V.Element == Float
```

## Parameters

`initialValue`

The initial value of the ramp.

`increment`

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

`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`:

```swift
    let n = 8
    
    let ramp = [Float](unsafeUninitializedCapacity: n) {
        buffer, initializedCount in
        
        vDSP.formRamp(withInitialValue: 0,
                      increment: 1,
                      result: &buffer)
        
        initializedCount = n
    }
    
    // Prints "[0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0]".
    print(ramp)
```

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)