Documentation
|
|
The C++ interface for sortdim. More...
| array | sortdim (const array &in, int dim=0) |
| Sort treating one dimension as keys in specific order. More... | |
| array | sortdim (const array &in, int dim, unsigned norder, const int *h_order) |
| Sort treating one dimension as keys in specific order. More... | |
The C++ interface for sortdim.
Sorting an array reorders the elements in the array along the dimension specified.
The defualt order is ascending order. That is, the smallest element along the dimension is places at the first index location and the largest element is placed at the last location. To sort in descending order, set the isdescending flag to true.
The indices array parameter can be used to retrieve the indices of the elements before the sort.
The next sort function can sort the values of an array (value) based on another array (key). The function first sorts the key array and uses the indices from this sort to reorder the value array.
The function sortdim uses one of the dimensions as key to sort the array.
| array af::sortdim | ( | const array & | in, |
| int | dim = 0 |
||
| ) |
| array af::sortdim | ( | const array & | in, |
| int | dim, | ||
| unsigned | norder, | ||
| const int * | h_order | ||
| ) |
Sort treating one dimension as keys in specific order.
The function sortdim uses one of the dimensions as key to sort the array.
The horder parameter can be used to specify the key of the order and ascending or descending sort.
| [in] | in | |
| [in] | dim | dimension along which to sort |
| [in] | h_order | Host array specifying key order and directions of sort |
| [in] | norder | Number of elements in h_order |