Returns the indices that would sort the array along a dimension.
Arguments
- operand
(
arrayish)
Operand.- dim
(
integer(1)|NULL)
Dimension along which to compute the sort permutation. IfNULL(default), uses the last dimension.- decreasing
(
logical(1))
IfTRUE, returns indices that produce a decreasing sort. DefaultFALSE.- stable
(
logical(1))
IfTRUE, the sort is stable: indices for equal values keep their original relative order. DefaultFALSE.
Value
arrayish of dtype i32
Same shape as operand. For a size-0 axis, the output is an empty i32
array of the same shape (a valid empty permutation).
as_array(operand)[as_array(nv_argsort(operand))] reproduces the sorted
array (for 1-D inputs).
NaN handling
NaN values sort to the end (ascending) or beginning
(descending), regardless of sign. +0 and -0 compare equal.