<!--
{
  "availability" : [
    "iOS: 10.0.0 - 11.0.0",
    "iPadOS: 10.0.0 - 11.0.0",
    "macOS: 10.13.0 -",
    "tvOS: 10.0.0 - 11.0.0",
    "visionOS: 1.0.0 - 1.0.0"
  ],
  "documentType" : "symbol",
  "framework" : "MetalPerformanceShaders",
  "identifier" : "/documentation/MetalPerformanceShaders/MPSMatrixDescriptor/init(dimensions:columns:rowBytes:dataType:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "Metal Performance Shaders"
    ],
    "preciseIdentifier" : "c:objc(cs)MPSMatrixDescriptor(cm)matrixDescriptorWithDimensions:columns:rowBytes:dataType:"
  },
  "title" : "init(dimensions:columns:rowBytes:dataType:)"
}
-->

# init(dimensions:columns:rowBytes:dataType:)

Creates a matrix descriptor with the specified dimensions and data type.

```
convenience init(dimensions rows: Int, columns: Int, rowBytes: Int, dataType: MPSDataType)
```

## Parameters

`rows`

The number of rows in the matrix.

`columns`

The number of columns in the matrix.

`rowBytes`

The stride, in bytes, between corresponding elements of consecutive rows in the matrix.

`dataType`

The type of the data to be stored in the matrix.

## Return Value

A valid [`MPSMatrixDescriptor`](/documentation/MetalPerformanceShaders/MPSMatrixDescriptor) object.

## Discussion

For performance considerations, the optimal row stride may not necessarily be equal to the number of columns in the matrix. The [`rowBytes(fromColumns:dataType:)`](/documentation/MetalPerformanceShaders/MPSMatrixDescriptor/rowBytes(fromColumns:dataType:)) method may be used to help you determine this value.

---

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)