<!--
{
  "availability" : [
    "iOS: 4.0.0 -",
    "iPadOS: 4.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.6.0 -",
    "tvOS: -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Accelerate",
  "identifier" : "/documentation/Accelerate/vDSP_vrampmuladd",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Accelerate"
    ],
    "preciseIdentifier" : "c:@F@vDSP_vrampmuladd"
  },
  "title" : "vDSP_vrampmuladd"
}
-->

# vDSP_vrampmuladd

Adds a single-precision vector that contains monotonically incrementing or decrementing values, and multiplies that vector by a source vector.

```
void vDSP_vrampmuladd(const float *__I, vDSP_Stride __IS, float *__Start, const float *__Step, float *__O, vDSP_Stride __OS, vDSP_Length __N);
```

## Parameters

`__I`

The input vector that the function multiplies by the ramp.

`__IS`

The distance between the elements in the input vector.

`__Start`

On input, the initial value of the ramp. On output, the next value in the ramp.

`__Step`

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

`__O`

The output vector.

`__OS`

The distance between the elements in the output vector.

`__N`

The number of elements that the function processes.

## Discussion

Use this function to generate and return a vector populated with ramped values with each element multiplied by the corresponding element in a second vector. This function is similar to [`vDSP_vrampmul`](/documentation/Accelerate/vDSP_vrampmul) but adds the result to the output vector.

The following code generates a ramped vector with values in the range `0 ... 7`. The function multiplies elements at even indices by `10` and multiplies elements at odd indices by `100`, and adds the ramp values to the existing values in the output buffer.

```swift
    let n = 8
    let stride = 1
    
    var initialValue: Float = 0
    var increment: Float = 1
    
    let ramp = [Float](unsafeUninitializedCapacity: n) {
        buffer, initializedCount in
        
        for i in 0 ..< n {
            buffer[i] = 1000
        }
        
        vDSP_vrampmuladd([10, 100, 10, 100, 10, 100, 10, 100],
                      stride,
                      &initialValue,
                      &increment,
                      buffer.baseAddress!,
                      stride,
                      vDSP_Length(n))
        
        initializedCount = n
    }
    
    // Prints "[1000.0, 1100.0, 1020.0, 1300.0, 1040.0, 1500.0, 1060.0, 1700.0]".
    print(ramp)
    
    // Prints "8".
    print(initialValue)
```

---

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)