nlcpy.sort

nlcpy.sort(a, axis=- 1, kind=None, order=None)[ソース]

Returns a sorted copy of an array.

Parameters
aarray_like

Array to be sorted.

axisint or None, optional

Axis along which to sort. If None, the array is flattened before sorting. The default is -1, which sorts along the last axis.

kind{'None','stable'}, optional

Sorting algorithm. The default is 'stable', kind only supported 'stable'. ('None' is treated as 'stable'.)

orderstr or list of str, optional

In the current NLCPy, This argument is not supported. The default is 'None'.

Returns
sorted_arrayndarray

Array of the same type and shape as a.

参考

ndarray.sort

Method to sort an array in-place.

argsort

Indirect sort.

注釈

'stable' uses the radix sort for all data types.

制限事項

NotImplementedError:

  • If kind is not None and kind != 'stable'.

  • If order is not None.

  • If 'c' is contained in a.dtype.kind.

Examples

>>> import nlcpy as vp
>>> a = vp.array([[1,4],[3,1]])
>>> vp.sort(a)                # sort along the last axis
array([[1, 4],
       [1, 3]])
>>> vp.sort(a, axis=None)     # sort the flattened array
array([1, 1, 3, 4])
>>> vp.sort(a, axis=0)        # sort along the first axis
array([[1, 1],
       [3, 4]])