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

# vDSP_vgenpD

Generates the double-precision linearly interpolated values of a vector at the specified indices.

```
extern void vDSP_vgenpD(const double *__A, vDSP_Stride __IA, const double *__B, vDSP_Stride __IB, double *__C, vDSP_Stride __IC, vDSP_Length __N, vDSP_Length __M);
```

## Parameters

`__A`

The input vector that defines the values that the function interpolates.

`__IA`

The distance between the elements in the values vector.

`__B`

The input vector that defines the indices at which the function interpolates.

`__IB`

The distance between the elements in the indices vector.

`__C`

The output vector.

`__IC`

The distance between the elements in the output vector.

`__N`

The number of elements that the function processes.

`__M`

The number of elements in the values and indices input vectors.

## Discussion

The following code creates a five-element vector from two values using linear interpolation. The last index in `indices` determines the length of the operation result.

```swift
    let values: [Double] = [0, 100]
    let indices: [Double] = [0, 4]
    
    let n = Int(indices.last! + 1)
    let m = values.count
    
    let stride = 1
    
    let interpolatedValues = [Double](unsafeUninitializedCapacity: n) {
        buffer, initializedCount in
        
        vDSP_vgenpD(values, stride,
                    indices, stride,
                    buffer.baseAddress!, stride,
                    vDSP_Length(n),
                    vDSP_Length(m))
        
        initializedCount = n
    }
    
    // Prints "[0.0, 25.0, 50.0, 75.0, 100.0]".
    print(interpolatedValues)
```

---

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)