---
title: MPSMatrixFindTopK
framework: metalperformanceshaders
role: symbol
role_heading: Class
path: metalperformanceshaders/mpsmatrixfindtopk
---

# MPSMatrixFindTopK

A kernel for computing the top-K values and their corresponding indices in a matrix.

## Declaration

```swift
class MPSMatrixFindTopK
```

## Topics

### Initializers

- [init(coder:device:)](metalperformanceshaders/mpsmatrixfindtopk/init(coder:device:).md)
- [init(device:numberOfTopKValues:)](metalperformanceshaders/mpsmatrixfindtopk/init(device:numberoftopkvalues:).md)

### Instance Properties

- [indexOffset](metalperformanceshaders/mpsmatrixfindtopk/indexoffset.md)
- [numberOfTopKValues](metalperformanceshaders/mpsmatrixfindtopk/numberoftopkvalues.md)
- [sourceColumns](metalperformanceshaders/mpsmatrixfindtopk/sourcecolumns.md)
- [sourceRows](metalperformanceshaders/mpsmatrixfindtopk/sourcerows.md)

### Instance Methods

- [copy(with:device:)](metalperformanceshaders/mpsmatrixfindtopk/copy(with:device:).md)
- [encode(commandBuffer:inputMatrix:resultIndexMatrix:resultValueMatrix:)](metalperformanceshaders/mpsmatrixfindtopk/encode(commandbuffer:inputmatrix:resultindexmatrix:resultvaluematrix:).md)

## Relationships

### Inherits From

- [MPSMatrixUnaryKernel](metalperformanceshaders/mpsmatrixunarykernel.md)

### Conforms To

- [CVarArg](swift/cvararg.md)
- [CustomDebugStringConvertible](swift/customdebugstringconvertible.md)
- [CustomStringConvertible](swift/customstringconvertible.md)
- [Equatable](swift/equatable.md)
- [Hashable](swift/hashable.md)
- [NSCoding](foundation/nscoding.md)
- [NSCopying](foundation/nscopying.md)
- [NSObjectProtocol](objectivec/nsobjectprotocol.md)
- [NSSecureCoding](foundation/nssecurecoding.md)

## See Also

### Matrix Arithmetic Operations

- [MPSMatrixSum](metalperformanceshaders/mpsmatrixsum.md)
- [MPSMatrixMultiplication](metalperformanceshaders/mpsmatrixmultiplication.md)
- [MPSMatrixVectorMultiplication](metalperformanceshaders/mpsmatrixvectormultiplication.md)
