---
title: Compression and gathering functions
framework: accelerate
role: collectionGroup
role_heading: API Collection
path: accelerate/compression-and-gathering-functions
---

# Compression and gathering functions

Compress vectors based on the nonzero elements in a gating vector, or gather vectors based on a separate vector that contains indices.

## Topics

### Vector compression

- [compress(_:gatingVector:nonZeroGatingCount:)](accelerate/vdsp/compress(_:gatingvector:nonzerogatingcount:)-3c7yk.md)
- [compress(_:gatingVector:nonZeroGatingCount:)](accelerate/vdsp/compress(_:gatingvector:nonzerogatingcount:)-93v23.md)
- [compress(_:gatingVector:result:)](accelerate/vdsp/compress(_:gatingvector:result:)-7fvy9.md)
- [compress(_:gatingVector:result:)](accelerate/vdsp/compress(_:gatingvector:result:)-2yse4.md)

### Vector gathering functions

- [gather(_:indices:)](accelerate/vdsp/gather(_:indices:)-4jwvh.md)
- [gather(_:indices:)](accelerate/vdsp/gather(_:indices:)-4yt3o.md)
- [gather(_:indices:result:)](accelerate/vdsp/gather(_:indices:result:)-7erii.md)
- [gather(_:indices:result:)](accelerate/vdsp/gather(_:indices:result:)-34yzg.md)

## See Also

### Vector operations

- [Copying, element swapping, and merging functions](accelerate/copying-element-swapping-and-merging-functions.md)
- [Reversing and sorting functions](accelerate/reversing-and-sorting-functions.md)
