linearInterpolate(values:atIndices:)
Returns the single-precision linearly interpolated values of a vector at the specified indices.
Declaration
static func linearInterpolate<T, U>(values: T, atIndices indices: U) -> [Float] where T : AccelerateBuffer, U : AccelerateBuffer, T.Element == Float, U.Element == FloatParameters
- values:
The values to interpolate.
- indices:
The indices to the output vector.
Mentioned in
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.
let values: [Float] = [0, 100]
let indices: [Float] = [0, 4]
let result = vDSP.linearInterpolate(values: values,
atIndices: indices)
// Prints "[0.0, 25.0, 50.0, 75.0, 100.0]".
print(result)