Contents

fill(_:with:)

Populates a double-precision vector with a specified scalar value.

Declaration

static func fill<V>(_ vector: inout V, with value: Double) where V : AccelerateMutableBuffer, V.Element == Double

Parameters

  • vector:

    The vector to populate with the specified value.

  • value:

    The value to populate.

Discussion

This function populates a vector with a specified scalar value.

The following code shows how to set each element of vector c to pi:

let a = Double.pi

var c = [Double](repeating: .nan,
                 count: 10)

vDSP.fill(&c,
          with: a)

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

See Also

Type Methods