Function

vDSP_ztrans(_:_:_:_:)

Divides a complex single-precision vector by a real single-precision vector.

Declaration

func vDSP_ztrans(_ __A: UnsafePointer<Float>, _ __B: UnsafePointer<DSPSplitComplex>, _ __C: UnsafePointer<DSPSplitComplex>, _ __N: vDSP_Length)

Parameters

__A

Single-precision real input vector.

__B

Single-precision complex input vector.

__C

Single-precision complex output vector.

__N

The number of elements to process.

Discussion

This function calculates the first N elements of A divided by the corresponding element in B, writing the result to C:

The operation is:

 for (n = 0; n < N; ++n)
    C[n] = B[n] / A[n];

The following code shows an example of using vDSP_ztrans(_:_:_:_:):

let a: [Float] = [10, 20, 30, 40]

let n = vDSP_Length(a.count)

var realB: [Float] = [100, 200, 300, 400]
var imagB: [Float] = [500, 800, 600, 800]

let b = [DSPSplitComplex(realp: &realB,
                         imagp: &imagB)]

var realC = [Float](repeating: .nan,
                    count: Int(n))
var imagC = [Float](repeating: .nan,
                    count: Int(n))
var c = DSPSplitComplex(realp: &realC,
                        imagp: &imagC)

vDSP_ztrans(a,
            b,
            &c,
            n)

print("real", realC) // Prints "real [10, 10, 10, 10]"
print("imag", imagC) // Prints "imag [50, 40, 20, 20]"

See Also

Binary Transfer Operations