---
title: "rowBytes(fromColumns:dataType:)"
framework: metalperformanceshaders
role: symbol
role_heading: Type Method
path: "metalperformanceshaders/mpsmatrixdescriptor/rowbytes(fromcolumns:datatype:)"
---

# rowBytes(fromColumns:dataType:)

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

## Declaration

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

Return Value The recommended matrix row stride, in bytes.

## Discussion

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).

## See Also

### Methods

- [init(dimensions:columns:rowBytes:dataType:)](metalperformanceshaders/mpsmatrixdescriptor/init(dimensions:columns:rowbytes:datatype:).md)
- [rowBytes(forColumns:dataType:)](metalperformanceshaders/mpsmatrixdescriptor/rowbytes(forcolumns:datatype:).md)
