Sorting, Searching, and Counting

Sorting

cupy.sort

Returns a sorted copy of an array with a stable sorting algorithm.

cupy.lexsort

Perform an indirect sort using an array of keys.

cupy.argsort

Returns the indices that would sort an array with a stable sorting.

cupy.msort

Returns a copy of an array sorted along the first axis.

cupy.sort_complex

Sort a complex array using the real part first, then the imaginary part.

cupy.partition

Returns a partitioned copy of an array.

cupy.argpartition

Returns the indices that would partially sort an array.

Searching

cupy.argmax

Returns the indices of the maximum along an axis.

cupy.nanargmax

Return the indices of the maximum values in the specified axis ignoring NaNs.

cupy.argmin

Returns the indices of the minimum along an axis.

cupy.nanargmin

Return the indices of the minimum values in the specified axis ignoring NaNs.

cupy.nonzero

Return the indices of the elements that are non-zero.

cupy.flatnonzero

Return indices that are non-zero in the flattened version of a.

cupy.where

Return elements, either from x or y, depending on condition.

cupy.argwhere

Return the indices of the elements that are non-zero.

cupy.searchsorted

Finds indices where elements should be inserted to maintain order.

Counting

cupy.count_nonzero

Counts the number of non-zero values in the array.