[−][src]Function arrayfire::topk
pub fn topk<T>(
input: &Array<T>,
k: u32,
dim: i32,
order: TopkFn
) -> (Array<T>, Array<u32>) where
T: HasAfEnum,
Find top k elements along a given dimension
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. Currently, topk elements can be found only along dimension 0.
Parameters
input
is the values from which top k elements are to be retrievedk
is the number of top elements to be retrievedim
is the dimension along which the retrieval operation has to performedorder
is an enum that can take values of type TopkFn
Return Values
A tuple(couple) of Array's with the first Array containing the topk values with the second Array containing the indices of the topk values in the input data.