Skip to main content

argsort

Function argsort 

Source
pub fn argsort<T, D>(
    a: &Array<T, D>,
    axis: Option<usize>,
) -> FerrayResult<Array<u64, IxDyn>>
where T: Element + PartialOrd + Copy, D: Dimension,
Expand description

Return the indices that would sort an array along the given axis.

When axis is None, the array is flattened before computing indices and a 1-D array is returned.

Returns u64 indices.

Note: NumPy’s np.argsort(a) defaults to axis=-1 (last axis). ferray’s argsort(a, None) flattens instead. To match NumPy’s default, pass the last axis explicitly: argsort(a, Some(a.ndim() - 1)).

Equivalent to numpy.argsort.