Function

vDSP_vgathr(_:_:_:_:_:_:)

Gathers a single-precision vector using the specified 1-based indices.

Declaration

func vDSP_vgathr(_ __A: UnsafePointer<Float>, _ __B: UnsafePointer<vDSP_Length>, _ __IB: vDSP_Stride, _ __C: UnsafeMutablePointer<Float>, _ __IC: vDSP_Stride, _ __N: vDSP_Length)

Parameters

__A

Single-precision real input vector

__B

Integer vector containing indices

__IB

Stride for B

__C

Single-precision real output vector

__IC

Stride for C

__N

The number of elements to process

Discussion

Performs the following operation:

for (n = 0; n < N; ++n){
    C[n*IC] = A[B[n*IB] - 1];
}

Uses elements of vector B as indices to copy selected elements of vector A to sequential locations in vector C. Note that 1, not zero, is treated as the first location in the input vector A when evaluating indices (in other words, 1 is subtracted from a 1-based index found in B to obtain the 0-based index into A). This function can only be done out of place.