|
AFAPI void | topk (array &values, array &indices, const array &in, const int k, const int dim=-1, const topkFunction order=AF_TOPK_MAX) |
| C++ Interface for finding top k elements along a given dimension. More...
|
|
AFAPI af_err | af_topk (af_array *values, af_array *indices, const af_array in, const int k, const int dim, const af_topk_function order) |
| C Interface for finding top k elements along a given dimension. More...
|
|
This function returns the top k values along a given dimension of the input array. The indices along with their values are returned. If the input is a multi-dimensional array, the indices will be the index of the value in that dimension. Order of duplicate values are not preserved. This function is optimized for small values of k.
This function performs the operation across all dimensions of the input array.
- Note
- {Currently, topk elements can be found only along dimension 0.}
◆ af_topk()
C Interface for finding top k elements along a given dimension.
- Parameters
-
[out] | values | The values of the top k elements along the dim dimension |
[out] | indices | The indices of the top k elements along the dim dimension |
[in] | in | Input af::array with at least k elements along dim |
[in] | k | The number of elements to be retriefed along the dim dimension |
[in] | dim | The dimension along which top k elements are extracted. (Must be 0) |
[in] | order | If Descending the highest values are returned. Otherwise the lowest values are returned |
- Note
- {This function is optimized for small values of k.}
-
{The order of the returned keys may not be in the same order as the appear in the input array}
◆ topk()
C++ Interface for finding top k elements along a given dimension.
- Parameters
-
[out] | values | The values of the top k elements along the dim dimension |
[out] | indices | The indices of the top k elements along the dim dimension |
[in] | in | Input af::array with at least k elements along dim |
[in] | k | The number of elements to be retriefed along the dim dimension |
[in] | dim | The dimension along which top k elements are extracted. (Must be 0) |
[in] | order | If Descending the highest values are returned. Otherwise the lowest values are returned |
- Note
- {This function is optimized for small values of k.}
-
{The order of the returned keys may not be in the same order as the appear in the input array}