<!--
{
  "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(lookupTable:withOffsets:scale:baseOffset:)-1ye2o",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "Accelerate"
    ],
    "preciseIdentifier" : "s:10Accelerate4vDSPO17linearInterpolate11lookupTable11withOffsets5scale10baseOffsetSaySdGx_q_S2dtAA0A6BufferRzAaJR_Sd7ElementRtzSdAKRt_r0_lFZ"
  },
  "title" : "linearInterpolate(lookupTable:withOffsets:scale:baseOffset:)"
}
-->

# linearInterpolate(lookupTable:withOffsets:scale:baseOffset:)

Returns the double-precision linearly interpolated values of a lookup table from the specified offsets.

```
static func linearInterpolate<T, U>(lookupTable: T, withOffsets offsets: U, scale: Double = 1, baseOffset: Double = 0) -> [Double] where T : AccelerateBuffer, U : AccelerateBuffer, T.Element == Double, U.Element == Double
```

## Parameters

`lookupTable`

The lookup table.

`offsets`

The offsets into the lookup table.

`scale`

The scale factor for the offsets.

`baseOffset`

The base offset for the offsets.

## Return Value

The result of the interpolation operation.

## Discussion

The following code shows the result of linearly interpolating a lookup table that contains the values `[-10, 0, 100]` using the offsets `[0, 0.5, 1, 1.5, 2]`.  The integer offsets, `0`, `1`, and `2`, return the corresponding values in the lookup table, `-10`, `0`, and `2`. The noninteger offsets, `0.5` and `1.5`, return the linearly interpolated values between the lookup table values, `-5` and `50`:

```swift
let lookupTable: [Double] = [-10, 0, 100]
let offsets: [Double] = [0, 0.5, 1, 1.5, 2]

let result = vDSP.linearInterpolate(lookupTable: lookupTable,
                                    withOffsets: offsets)

// Prints "[-10.0, -5.0, 0.0, 50.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)