<!--
{
  "availability" : [
    "iOS: 10.0.0 -",
    "iPadOS: 10.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.13.0 -",
    "tvOS: 10.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "MetalPerformanceShaders",
  "identifier" : "/documentation/MetalPerformanceShaders/MPSMatrixMultiplication/init(device:transposeLeft:transposeRight:resultRows:resultColumns:interiorColumns:alpha:beta:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "Metal Performance Shaders"
    ],
    "preciseIdentifier" : "c:objc(cs)MPSMatrixMultiplication(im)initWithDevice:transposeLeft:transposeRight:resultRows:resultColumns:interiorColumns:alpha:beta:"
  },
  "title" : "init(device:transposeLeft:transposeRight:resultRows:resultColumns:interiorColumns:alpha:beta:)"
}
-->

# init(device:transposeLeft:transposeRight:resultRows:resultColumns:interiorColumns:alpha:beta:)

Initializes a matrix multiplication kernel.

```
init(device: any MTLDevice, transposeLeft: Bool, transposeRight: Bool, resultRows: Int, resultColumns: Int, interiorColumns: Int, alpha: Double, beta: Double)
```

## Parameters

`device`

The device on which the matrix multiplication kernel will run.

`transposeLeft`

A boolean value that indicates if the left input matrix should be used in its transposed form. If the value is <doc://com.apple.documentation/documentation/Swift/true>, then `op(A) = A**T`; otherwise, `op(A) = A`.

`transposeRight`

A boolean value that indicates if the right input matrix should be used in its transposed form. If the value is <doc://com.apple.documentation/documentation/Swift/true>, then `op(B) = B**T`; otherwise, `op(B) = B`.

`resultRows`

The number of rows in the result matrix (`M` in the *BLAS GEMM* description).

`resultColumns`

The number of columns in the result matrix (`N` in the *BLAS GEMM* description).

`interiorColumns`

The number of columns of the left input matrix after the appropriate transpose operation has been applied (`K` in the *BLAS GEMM* description).

`alpha`

The scale factor to apply to the product, specified in `double` precision. This value will be converted to the appropriate precision in the implementation itself, subject to rounding and/or clamping as necessary.

`beta`

The scale factor to apply to the initial values of `C`, specified in `double` precision. This value will be converted to the appropriate precision in the implementation itself, subject to rounding and/or clamping as necessary.

## Return Value

A valid [`MPSMatrixMultiplication`](/documentation/MetalPerformanceShaders/MPSMatrixMultiplication) object or `nil`, if failure.

---

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)