sort#
- class brainunit.math.sort(a, axis=-1, *, kind=None, order=None, stable=True, descending=False, **kwargs)#
Return a sorted copy of a quantity or an array.
- Parameters:
a (
Array| saiunit.Quantity) – Array or quantity to be sorted.axis (
int|None) – 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) – Sorting algorithm. The default is ‘quicksort’.order (
None) – When a is a quantity, it can be a string or a sequence of strings, which is interpreted as an order the quantity should be sorted. The default is None.stable (
bool) – Whether to use a stable sorting algorithm. The default is True.descending (
bool) – Whether to sort in descending order. The default is False.
- Returns:
res – Sorted copy of the input array.
- Return type:
Array| saiunit.Quantity
Examples
>>> import saiunit as u >>> a = [3, 1, 2] * u.meter >>> u.math.sort(a)