A structure that contains a dense vector of single-precision, floating-point values.


struct DenseVector_Float


The following code shows an example of how to create a dense vector structure from an array of single-precision values. In this case, use withUnsafeMutableBufferPointer(_:) to pass a pointer to your collection. The DenseVector_Float structure is valid only during the execution of the closure. Do not store or return the structure for later use.

var vectorValues: [Float] = [10, 20, 30, 40]
let vectorValuesCount = Int32(vectorValues.count)

vectorValues.withUnsafeMutableBufferPointer { vectorValuesPtr in
    let vector = DenseVector_Float(count: vectorValuesCount,
                                   data: vectorValuesPtr.baseAddress!)
    // Perform operations using `vector`.



init(count: Int32, data: UnsafeMutablePointer<Float>)

Creates a new vector of single-precision values.

Inspecting a Vector's Structure and Data

var count: Int32

The number of items in the vector.

var data: UnsafeMutablePointer<Float>

The array of single-precision, floating-point values.

See Also

Dense Matrices and Vectors

struct DenseMatrix_Double

A structure that contains a dense matrix of double-precision, floating-point values.

struct DenseMatrix_Float

A structure that contains a dense matrix of single-precision, floating-point values.

struct DenseVector_Double

A structure that contains a dense vector of double-precision, floating-point values.