linearInterpolate(lookupTable:withOffsets:scale:baseOffset:)
Returns the single-precision linearly interpolated values of a lookup table from the specified offsets.
Declaration
static func linearInterpolate<T, U>(lookupTable: T, withOffsets offsets: U, scale: Float = 1, baseOffset: Float = 0) -> [Float] where T : AccelerateBuffer, U : AccelerateBuffer, T.Element == Float, U.Element == FloatParameters
- 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.
let lookupTable: [Float] = [-10, 0, 100]
let offsets: [Float] = [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)