method
Sort an array in-place.
Refer to dpnp.sort for full documentation.
axis (int, optional) --
Axis along which to sort. The default is -1, which sorts along
the last axis.
Default: -1.
kind ({None, "stable", "mergesort", "radixsort"}, optional) --
Sorting algorithm. The default is None, which uses parallel
merge-sort or parallel radix-sort algorithms depending on the array
data type.
Default: None.
descending (bool, optional) --
Sort order. If True, the array must be sorted in descending
order (by value). If False, the array must be sorted in
ascending order (by value).
Default: False.
stable ({None, bool}, optional) --
Sort stability. If True, the returned array will maintain the
relative order of a values which compare as equal. The same
behavior applies when set to False or None.
Internally, this option selects kind="stable".
Default: None.
See also
dpnp.sortReturn a sorted copy of an array.
dpnp.argsortReturn the indices that would sort an array.
dpnp.lexsortIndirect stable sort on multiple keys.
dpnp.searchsortedFind elements in a sorted array.
dpnp.partitionPartial sort.
Note
axis in dpnp.sort could be integer or None. If None,
the array is flattened before sorting. However, axis in
dpnp.ndarray.sort can only be integer since it sorts an array
in-place.
Examples
>>> import dpnp as np
>>> a = np.array([[1, 4], [3, 1]])
>>> a.sort(axis=1)
>>> a
array([[1, 4],
[1, 3]])
>>> a.sort(axis=0)
>>> a
array([[1, 1],
[3, 4]])