Documentation
|
|
The C++ interface for sort. More...
| array | sort (const array &in, int dim=-1, bool isdescending=false) |
| Sort array along dimension. More... | |
| void | sort (array &values, array &indices, const array &in, int dim=-1, bool isdescending=false) |
| Sort array along dimension and return original indices of sorted values. More... | |
| void | sort (array &outkeys, array &outvalues, const array &keys, const array &values, bool isdescending=false) |
Sort array values based on keys along dimension. More... | |
The C++ interface for sort.
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::sort | ( | const array & | in, |
| int | dim = -1, |
||
| bool | isdescending = false |
||
| ) |
Sort array along dimension.
| [in] | in | |
| [in] | dim | dimension along which to operate (-1 indicates first non-singleton dimension) |
| [in] | isdescending | true if descending order, false (default) in ascending order |
| void af::sort | ( | array & | values, |
| array & | indices, | ||
| const array & | in, | ||
| int | dim = -1, |
||
| bool | isdescending = false |
||
| ) |
Sort array along dimension and return original indices of sorted values.
| [out] | values | |
| [out] | indices | |
| [in] | in | |
| [in] | dim | dimension along which to operate (-1 indicates first non-singleton dimension) |
| [in] | isdescending | true if descending order, false (default) in ascending order |
| void af::sort | ( | array & | outkeys, |
| array & | outvalues, | ||
| const array & | keys, | ||
| const array & | values, | ||
| bool | isdescending = false |
||
| ) |
Sort array values based on keys along dimension.
| [out] | outkeys | |
| [out] | outvalues | |
| [in] | keys | |
| [in] | values | |
| [in] | isdescending | true if descending order, false (default) in ascending order |