array_api_extra.argpartition¶
- array_api_extra.argpartition(a, kth, /, axis=-1, *, xp=None)¶
Perform an indirect partition along the given axis.
It returns an array of indices of the same shape as a that index data along the given axis in partitioned order.
- Parameters:
- Returns:
Array of indices that partition a along the specified axis.
- Return type:
index_array
Notes
If xp implements
argpartitionor an equivalent function e.g.topkfor torch), complexity will likely be O(n). If not, this function simply callsxp.argsortand complexity is O(n log n).