---
title: "linearInterpolate(lookupTable:withOffsets:scale:baseOffset:result:)"
framework: accelerate
role: symbol
role_heading: Type Method
path: "accelerate/vdsp/linearinterpolate(lookuptable:withoffsets:scale:baseoffset:result:)-4ownc"
---

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

Computes the single-precision linearly interpolated values of a lookup table from the specified offsets.

## Declaration

```swift
static func linearInterpolate<T, U, V>(lookupTable: T, withOffsets offsets: U, scale: Float = 1, baseOffset: Float = 0, result: inout V) where T : AccelerateBuffer, U : AccelerateBuffer, V : AccelerateMutableBuffer, T.Element == Float, U.Element == Float, V.Element == Float
```

## 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.
- `result`: The destination vector that receives the result.

## Discussion

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. let lookupTable: [Float] = [-10, 0, 100] let offsets: [Float] = [0, 0.5, 1, 1.5, 2]

let count = offsets.count

let result = [Float](unsafeUninitializedCapacity: count) {     buffer, initializedCount in          vDSP.linearInterpolate(lookupTable: lookupTable,                                         withOffsets: offsets,                                         result: &buffer)          initializedCount = count }

// Prints "[-10.0, -5.0, 0.0, 50.0, 100.0]". print(result)

## 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)
