Divides a single-precision vector by a single-precision scalar value.


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



Single-precision real input vector.


Stride for A.


Pointer to single-precision real input scalar.


Single-precision real output vector.


Stride for C.


The number of elements to process.


This function calculates the first N elements of A divided by the scalar value B, writing the result to C:

The operation is:

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

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

let stride = vDSP_Stride(1)

let a: [Float] = [1, 2, 4, 5]
var b: Float = 2

let n = vDSP_Length(a.count)

var c = [Float](repeating: 0,
                count: a.count)

vDSP_vsdiv(a, stride,
           &c, stride,

// Prints "[0.5, 1.0, 2.0, 2.5]"

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software