vDSP_vtmerg
Performs a tapered merge between two single-precision vectors.
Declaration
extern void vDSP_vtmerg(const float *__A, vDSP_Stride __IA, const float *__B, vDSP_Stride __IB, float *__C, vDSP_Stride __IC, vDSP_Length __N);Parameters
- __A:
The first input vector.
- __IA:
The distance between the elements in the first input vector.``
- __B:
The second input vector.
- __IB:
The distance between the elements in the second input vector.
- __C:
The output vector.
- __IC:
The distance between the elements in the output vector.
- __N:
The number of complex elements in the output vector.
Discussion
The following code performs a tapered merge between two vectors that represent sine waves at different frequencies:
let count = 1024
let vectorA: [Float] = (0 ..< count).map {
return sin(Float($0) * 0.4)
}
let vectorB: [Float] = (0 ..< count).map {
return sin(Float($0) * 0.025)
}
let stride = 1
let n = vDSP_Length(count)
let tapered = [Float](unsafeUninitializedCapacity: count) {
buffer, initializedCount in
vDSP_vtmerg(vectorA, stride,
vectorB, stride,
buffer.baseAddress!, stride,
n)
initializedCount = count
}The following image shows the result of the tapered merge in tapered.
[Image]