Function

vDSP_vclr(_:_:_:)

Populate a single-precision vector with zeros.

Declaration

func vDSP_vclr(_ __C: UnsafeMutablePointer<Float>, _ __IC: vDSP_Stride, _ __N: vDSP_Length)

Parameters

__C

Single-precision real output vector.

__IC

Address stride for C.

__N

The number of elements to process.

Discussion

The vDSP_vclr(_:_:_:) and vDSP_vclrD(_:_:_:) functions populate a vector with zeros.

The following code shows how to clear the array c, setting the value of each element to zero:

let n = vDSP_Length(10)
let stride = vDSP_Stride(1)

var c = [Float](repeating: .nan,
                count: Int(n))

vDSP_vclr(&c,
          stride,
          n)

// Prints "[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]"
print(c)

See Also

Clearing Vectors

static func clear<V>(inout V)

Fills a double-precision vector with zeros.

static func clear<V>(inout V)

Fills a single-precision vector with zeros.

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