A high-performance general-purpose compute library

- Main Page
- Tutorials
- Release Notes
- Examples

Functions
sort
ArrayFire Functions | ArrayFire Functions by Category » Vector Algorithms » Sort operations

## Functions
AFAPI array | sort (const array &in, const unsigned dim=0, const bool isAscending=true)
| C++ Interface to sort an array over a given dimension.
AFAPI af_err | af_sort (af_array *out, const af_array in, const unsigned dim, const bool isAscending)
| C Interface to sort an array over a given dimension.

## Detailed Description

Sort an array over a given dimension.

## Function Documentation

## ◆ af_sort()

AFAPI af_err af_sort | ( | af_array * | out,
|  | const af_array | in,
|  | const unsigned | dim,
|  | const bool | isAscending )

C Interface to sort an array over a given dimension.

Parameters

  [out] | out | sorted output
  [in] | in | input array
  [in] | dim | dimension along which the sort occurs
  [in] | isAscending | specifies the sorting order

Returns
  AF_SUCCESS, if function returns successfully, else an af_err code is given

## ◆ sort()

AFAPI array sort | ( | const array & | in,
|  | const unsigned | dim = 0,
|  | const bool | isAscending = true )

C++ Interface to sort an array over a given dimension.

Parameters

  [in] | in | input array
  [in] | dim | dimension along which the sort occurs, 0 denotes the first non-singleton dimension
  [in] | isAscending | specifies the sorting order

Returns
  sorted output