<!--
{
  "availability" : [
    "iOS: -",
    "iPadOS: -",
    "macCatalyst: -",
    "macOS: -",
    "tvOS: -",
    "visionOS: -",
    "watchOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "Accelerate",
  "identifier" : "/documentation/Accelerate/DenseMatrix_Float",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "Accelerate"
    ],
    "preciseIdentifier" : "c:@SA@DenseMatrix_Float"
  },
  "title" : "DenseMatrix_Float"
}
-->

# DenseMatrix_Float

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

```
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`](/documentation/Accelerate/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(_:)`](/documentation/Accelerate/AccelerateMutableBuffer/withUnsafeMutableBufferPointer(_:)) to pass a pointer to your collection. The [`DenseMatrix_Float`](/documentation/Accelerate/DenseMatrix_Float) structure is valid only during the execution of the closure. Don’t store or return the structure for later use.

```swift
// 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

[`init(rowCount:columnCount:columnStride:attributes:data:)`](/documentation/Accelerate/DenseMatrix_Float/init(rowCount:columnCount:columnStride:attributes:data:))

Creates a new matrix of single-precision values.

### Inspecting a Matrix’s Structure and Data

[`rowCount`](/documentation/Accelerate/DenseMatrix_Float/rowCount)

The number of rows in the matrix.

[`columnCount`](/documentation/Accelerate/DenseMatrix_Float/columnCount)

The number of columns in the matrix.

[`columnStride`](/documentation/Accelerate/DenseMatrix_Float/columnStride)

The stride between matrix columns, in elements.

[`attributes`](/documentation/Accelerate/DenseMatrix_Float/attributes)

The attributes of the matrix, such as whether it’s symmetrical or triangular.

[`SparseAttributes_t`](/documentation/Accelerate/SparseAttributes_t)

A structure that represents the attributes of a matrix.

[`data`](/documentation/Accelerate/DenseMatrix_Float/data)

The array of single-precision, floating-point values in column-major order.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)