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

# DenseMatrix_Double

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

```
struct DenseMatrix_Double
```

## 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_Double`](/documentation/Accelerate/DenseMatrix_Double) 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_Double`](/documentation/Accelerate/DenseMatrix_Double) 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_Double(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_Double/init(rowCount:columnCount:columnStride:attributes:data:))

Creates a new matrix of double-precision values.

### Inspecting a Matrix’s Structure and Data

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

The number of rows in the matrix.

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

The number of columns in the matrix.

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

The stride between matrix columns, in elements.

[`attributes`](/documentation/Accelerate/DenseMatrix_Double/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_Double/data)

The array of double-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)