Contents

vDSP_ztoc

Copies the contents of a split single-precision complex vector to an interleaved vector.

Declaration

extern void vDSP_ztoc(const DSPSplitComplex *__Z, vDSP_Stride __IZ, DSPComplex *__C, vDSP_Stride __IC, vDSP_Length __N);

Parameters

  • __Z:

    The split-complex input vector.

  • __IZ:

    The distance between the elements in the input vector.

  • __C:

    The interleaved-complex output vector.

  • __IC:

    The distance between the real elements in the output vector. For example, a stride of 2 corresponds to a single complex element.

  • __N:

    The number of complex elements that the function processes.

Mentioned in

Discussion

For example, the following code converts the contents of a DSPSplitComplex structure to an array of DSPComplex structures :

    let srcReal = UnsafeMutableBufferPointer<Float>.allocate(capacity: 4)
    _ = srcReal.initialize(from: [1.0, 2.0, 3.0, 4.0])
    
    let srcImag = UnsafeMutableBufferPointer<Float>.allocate(capacity: 4)
    _ = srcImag.initialize(from: [10.0, 20.0, 30.0, 40.0])
    
    var source = DSPSplitComplex(realp: srcReal.baseAddress!,
                                 imagp: srcImag.baseAddress!)
    
    let destination = [DSPComplex](unsafeUninitializedCapacity: 4) {
        buffer, initializedCount in
        
        vDSP_ztoc(&source, 1,
                  buffer.baseAddress!, 2,
                  4)
        
        initializedCount = 4
    }
    
    // Prints:
    //     "[ DSPComplex(real: 1.0, imag: 10.0),
    //        DSPComplex(real: 2.0, imag: 20.0),
    //        DSPComplex(real: 3.0, imag: 30.0),
    //        DSPComplex(real: 4.0, imag: 40.0) ]".
    print(destination)

See Also

Converting split-complex vectors to interleaved-complex vectors