Contents

DenseMatrix_Float

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

Declaration

struct DenseMatrix_Float

Overview

You typically use dense matrices to represent the unknowns matrix, X, and the right-hand-side matrix, B, in the matrix equation AX = B. A DenseMatrix_Float structure provides a pointer to its underlying data, and information about its structure and attributes.

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

// An array of `rowCount` x `columnCount` single-precision values.
var matrixValues = [...]
let rowCount = Int32(5)
let columnCount = Int32(5)

matrixValues.withUnsafeMutableBufferPointer {
    let matrix = DenseMatrix_Float(rowCount: rowCount,
                                   columnCount: columnCount,
                                   columnStride: rowCount,
                                   attributes: SparseAttributes_t(),
                                   data: $0.baseAddress!)
    
    // Perform operations using `matrix`.
}

Topics

Initializers

Inspecting a Matrix’s Structure and Data

See Also

Creating dense matrices and dense vectors