Returns the indices that would sort the array along an axis.
Arguments
- x
(
arrayish)
Input array.- axis
(
integer(1)|NULL)
Axis along which to compute the sort permutation. Negative values count from the end, i.e.-1refers to the last axis. IfNULL(default), uses the last axis.- 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 x. For a size-0 axis, the output is an empty i32
array of the same shape (a valid empty permutation).
as_array(x)[as_array(nv_argsort(x))] 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.