---
title: MPSMatrix
framework: metalperformanceshaders
role: symbol
role_heading: Class
path: metalperformanceshaders/mpsmatrix
---

# MPSMatrix

A 2D array of data that stores the data’s values.

## Declaration

```swift
class MPSMatrix
```

## Overview

Overview MPSMatrix objects serve as inputs and outputs of MPSMatrixMultiplication objects. Matrix data is assumed to be stored in row-major order. note: An MPSMatrix object maintains its internal storage using a MTLBuffer object. Thus, the same rules for maintaining coherency of the buffer’s data between CPU memory and GPU memory also apply to an MPSMatrix object.

## Topics

### Methods

- [init(buffer:descriptor:)](metalperformanceshaders/mpsmatrix/init(buffer:descriptor:).md)

### Properties

- [device](metalperformanceshaders/mpsmatrix/device.md)
- [rows](metalperformanceshaders/mpsmatrix/rows.md)
- [columns](metalperformanceshaders/mpsmatrix/columns.md)
- [dataType](metalperformanceshaders/mpsmatrix/datatype.md)
- [rowBytes](metalperformanceshaders/mpsmatrix/rowbytes.md)
- [data](metalperformanceshaders/mpsmatrix/data.md)
- [matrices](metalperformanceshaders/mpsmatrix/matrices.md)
- [matrixBytes](metalperformanceshaders/mpsmatrix/matrixbytes.md)

### Initializers

- [init(buffer:offset:descriptor:)](metalperformanceshaders/mpsmatrix/init(buffer:offset:descriptor:).md)
- [init(device:descriptor:)](metalperformanceshaders/mpsmatrix/init(device:descriptor:).md)

### Instance Properties

- [offset](metalperformanceshaders/mpsmatrix/offset.md)

### Instance Methods

- [resourceSize()](metalperformanceshaders/mpsmatrix/resourcesize().md)
- [synchronize(on:)](metalperformanceshaders/mpsmatrix/synchronize(on:).md)

## Relationships

### Inherits From

- [NSObject](objectivec/nsobject-swift.class.md)

### Inherited By

- [MPSTemporaryMatrix](metalperformanceshaders/mpstemporarymatrix.md)

### Conforms To

- [CVarArg](swift/cvararg.md)
- [CustomDebugStringConvertible](swift/customdebugstringconvertible.md)
- [CustomStringConvertible](swift/customstringconvertible.md)
- [Equatable](swift/equatable.md)
- [Hashable](swift/hashable.md)
- [NSObjectProtocol](objectivec/nsobjectprotocol.md)

## See Also

### Matrices

- [MPSMatrixDescriptor](metalperformanceshaders/mpsmatrixdescriptor.md)
- [MPSTemporaryMatrix](metalperformanceshaders/mpstemporarymatrix.md)
