<!--
{
  "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/rowBytes(fromColumns:dataType:)",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "Metal Performance Shaders"
    ],
    "preciseIdentifier" : "c:objc(cs)MPSMatrixDescriptor(cm)rowBytesFromColumns:dataType:"
  },
  "title" : "rowBytes(fromColumns:dataType:)"
}
-->

# rowBytes(fromColumns:dataType:)

Determines the recommended matrix row stride, in bytes, for a given number of columns.

```
class func rowBytes(fromColumns columns: Int, dataType: MPSDataType) -> Int
```

## Parameters

`columns`

The number of columns in the matrix.

`dataType`

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

## Return Value

The recommended matrix row stride, in bytes.

## Discussion

The optimal stride between the rows of a matrix is not necessarily equivalent to the number of columns in the matrix. This method returns the row stride, in bytes, which gives the best performance for a given number of columns. Using this row stride to construct your matrix descriptor is recommended, but not required (as long as the stride used is still large enough to allocate a full row of data).

---

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)