A high-performance general-purpose compute library

Sort an array over a given dimension and return the original indices. More...

Functions

AFAPI void sort (array &out, array &indices, const array &in, const unsigned dim=0, const bool isAscending=true)
 C++ Interface to sort an array over a given dimension and to return the original indices. More...
 
AFAPI af_err af_sort_index (af_array *out, af_array *indices, const af_array in, const unsigned dim, const bool isAscending)
 C Interface to sort an array over a given dimension and to return the original indices. More...
 

Detailed Description

Sort an array over a given dimension and return the original indices.

Output type is u32.

Function Documentation

◆ af_sort_index()

AFAPI af_err af_sort_index ( af_array out,
af_array indices,
const af_array  in,
const unsigned  dim,
const bool  isAscending 
)

C Interface to sort an array over a given dimension and to return the original indices.

Parameters
[out]outsorted output
[out]indicesindices from the input
[in]ininput array
[in]dimdimension along which the sort occurs
[in]isAscendingspecifies the sorting order
Returns
AF_SUCCESS, if function returns successfully, else an af_err code is given

◆ sort()

AFAPI void sort ( array out,
array indices,
const array in,
const unsigned  dim = 0,
const bool  isAscending = true 
)

C++ Interface to sort an array over a given dimension and to return the original indices.

Parameters
[out]outsorted output
[out]indicesindices from the input
[in]ininput array
[in]dimdimension along which the sort occurs, 0 denotes the first non-singleton dimension
[in]isAscendingspecifies the sorting order