---
title: "ramp(withInitialValue:multiplyingBy:increment:)"
framework: accelerate
role: symbol
role_heading: Type Method
path: "accelerate/vdsp/ramp(withinitialvalue:multiplyingby:increment:)-1s3c9"
---

# ramp(withInitialValue:multiplyingBy:increment:)

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

## Declaration

```swift
static func ramp<U>(withInitialValue initialValue: inout Double, multiplyingBy vector: U, increment: Double) -> [Double] where U : AccelerateBuffer, U.Element == Double
```

## Parameters

- `initialValue`: On input, the initial value of the ramp. On output, the next value in the ramp.
- `vector`: The input vector that the function multiplies by the ramp.
- `increment`: The increment, or decrement if negative, between each generated element.

## Discussion

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. 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.     var initialValue: Double = 0     let increment: Double = 1          let ramp = vDSP.ramp(withInitialValue: &initialValue,                          multiplyingBy: [10, 100, 10, 100, 10, 100, 10, 100],                          increment: increment)          // Prints "[0.0, 100.0, 20.0, 300.0, 40.0, 500.0, 60.0, 700.0]".     print(ramp)          // Prints "8".     print(initialValue)

## See Also

### Type Methods

- [absolute(_:)](accelerate/vdsp/absolute(_:)-9c3ge.md)
- [absolute(_:)](accelerate/vdsp/absolute(_:)-5ehc1.md)
- [absolute(_:result:)](accelerate/vdsp/absolute(_:result:)-9x5jn.md)
- [absolute(_:result:)](accelerate/vdsp/absolute(_:result:)-1wu9x.md)
- [absolute(_:result:)](accelerate/vdsp/absolute(_:result:)-657bd.md)
- [absolute(_:result:)](accelerate/vdsp/absolute(_:result:)-4pigo.md)
- [add(_:_:)](accelerate/vdsp/add(_:_:)-9mv1a.md)
- [add(_:_:)](accelerate/vdsp/add(_:_:)-2ftxc.md)
- [add(_:_:)](accelerate/vdsp/add(_:_:)-53nh9.md)
- [add(_:_:)](accelerate/vdsp/add(_:_:)-7swvf.md)
- [add(_:_:result:)](accelerate/vdsp/add(_:_:result:)-2531u.md)
- [add(_:_:result:)](accelerate/vdsp/add(_:_:result:)-2w0o9.md)
- [add(_:_:result:)](accelerate/vdsp/add(_:_:result:)-338hl.md)
- [add(_:_:result:)](accelerate/vdsp/add(_:_:result:)-3vzwi.md)
- [add(_:to:count:result:)](accelerate/vdsp/add(_:to:count:result:)-g1dk.md)
