---
title: "init(device:transposeLeft:transposeRight:resultRows:resultColumns:interiorColumns:alpha:beta:)"
framework: metalperformanceshaders
role: symbol
role_heading: Initializer
path: "metalperformanceshaders/mpsmatrixmultiplication/init(device:transposeleft:transposeright:resultrows:resultcolumns:interiorcolumns:alpha:beta:)"
---

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

Initializes a matrix multiplication kernel.

## Declaration

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

Return Value A valid MPSMatrixMultiplication object or nil, if failure.

## See Also

### Methods

- [encode(commandBuffer:leftMatrix:rightMatrix:resultMatrix:)](metalperformanceshaders/mpsmatrixmultiplication/encode(commandbuffer:leftmatrix:rightmatrix:resultmatrix:).md)
