<!--
{
  "availability" : [
    "iOS: 14.0.0 -",
    "iPadOS: 14.0.0 -",
    "macCatalyst: -",
    "macOS: 11.0.0 -",
    "tvOS: 14.0.0 -",
    "visionOS: -",
    "watchOS: 7.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Accelerate",
  "identifier" : "/documentation/Accelerate/vDSP/linearInterpolate(values:atIndices:)-9rxb4",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "Accelerate"
    ],
    "preciseIdentifier" : "s:10Accelerate4vDSPO17linearInterpolate6values9atIndicesSaySdGx_q_tAA0A6BufferRzAaHR_Sd7ElementRtzSdAIRt_r0_lFZ"
  },
  "title" : "linearInterpolate(values:atIndices:)"
}
-->

# linearInterpolate(values:atIndices:)

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

```
static func linearInterpolate<T, U>(values: T, atIndices indices: U) -> [Double] where T : AccelerateBuffer, U : AccelerateBuffer, T.Element == Double, U.Element == Double
```

## Parameters

`values`

The values to interpolate.

`indices`

The indices to the output vector.

## Return Value

A vector that contains the linearly interpolated values.

## 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 result = vDSP.linearInterpolate(values: values,
                                    atIndices: indices)

// Prints "[0.0, 25.0, 50.0, 75.0, 100.0]".
print(result)
```

---

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)