# nlcpy.argsort

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

Returns the indices that would sort an array.

Perform an indirect sort along the given axis using the radix sort. It returns an array of indices of the same shape as a that index data along the given axis in sorted order.

Parameters
aarray_like

Array to sort.

axisint or None, optional

Axis along which to sort. The default is -1 (the last axis). If None, the flattened array is used.

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

This argument is not supported. The default is 'None'.

Returns
index_arrayndarray

Array of indices that sort a along the specified axis. If a is one-dimensional, `a[index_array]` yields a sorted a. More generally,

`sort`

Describes sorting algorithms used.

`ndarray.sort`

Method to sort an array in-place.

NotImplementedError:

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

• If order is not None.

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

Examples

One dimensional array:

```>>> import nlcpy as vp
>>> x = vp.array([3, 1, 2])
>>> vp.argsort(x)
array([1, 2, 0])
```

Two-dimensional array:

```>>> x = vp.array([[0, 3], [2, 2]])
>>> x
array([[0, 3],
[2, 2]])
>>> ind = vp.argsort(x, axis=0)  # sorts along first axis (down)
>>> ind
array([[0, 1],
[1, 0]])
>>> ind = vp.argsort(x, axis=1)  # sorts along last axis (across)
>>> ind
array([[0, 1],
[0, 1]])
```