Function

vDSP_vclrD(_:_:_:)

Populates a double-precision vector with zeros.

Declaration

func vDSP_vclrD(_ __C: UnsafeMutablePointer<Double>, _ __IC: vDSP_Stride, _ __N: vDSP_Length)

Parameters

__C

Double-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)

Populates a double-precision vector with zeros.

static func clear<V>(inout V)

Populates a single-precision vector with zeros.

func vDSP_vclr(UnsafeMutablePointer<Float>, vDSP_Stride, vDSP_Length)

Populates a single-precision vector with zeros.