---
title: "encode(commandBuffer:inputMatrix:resultIndexMatrix:resultValueMatrix:)"
framework: metalperformanceshaders
role: symbol
role_heading: Instance Method
path: "metalperformanceshaders/mpsmatrixfindtopk/encode(commandbuffer:inputmatrix:resultindexmatrix:resultvaluematrix:)"
---

# encode(commandBuffer:inputMatrix:resultIndexMatrix:resultValueMatrix:)

## Declaration

```swift
func encode(commandBuffer: any MTLCommandBuffer, inputMatrix: MPSMatrix, resultIndexMatrix: MPSMatrix, resultValueMatrix: MPSMatrix)
```
