Contents

vDSP_ctoz

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

Declaration

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

Parameters

  • __C:

    The interleaved-complex input vector.

  • __IC:

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

  • __Z:

    The split-complex output vector.

  • __IZ:

    The distance between the elements in the ouput vector.

  • __N:

    The number of complex elements that the function processes.

Mentioned in

Discussion

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

    let source: [DSPComplex] = [
        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),
    ]
    
    let destReal = UnsafeMutableBufferPointer<Float>.allocate(capacity: 4)
    let destImag = UnsafeMutableBufferPointer<Float>.allocate(capacity: 4)
    
    var destination = DSPSplitComplex(realp: destReal.baseAddress!,
                                      imagp: destImag.baseAddress!)
    
    vDSP_ctoz(source, 2,
              &destination, 1,
              4)
    
    print(Array(destReal)) // Prints "[1.0, 2.0, 3.0, 4.0]".
    print(Array(destImag)) // Prints "[10.0, 20.0, 30.0, 40.0]".

See Also

Converting interleaved-complex vectors to split-complex vectors