[ILNumerics Computing Engine]

**Namespace:**ILNumerics

**Assembly:**ILNumerics.Computing (in ILNumerics.Computing.dll) Version: 5.3.0.0 (5.3.7131.2749)

public static RetArray<sbyte> sort( BaseArray<sbyte> A, OutArray<long> Indices, int dim = -1, bool descending = false )

#### Parameters

- A
- Type: ILNumericsBaseArraySByte

Input array. - Indices
- Type: ILNumericsOutArrayInt64

[Output] On return contains the indices required to sort the array. - dim (Optional)
- Type: SystemInt32

The index of the working dimension or -1 for determining the working dimension automatically (default). - descending (Optional)
- Type: SystemBoolean

[Optional] Determins the sorting direction. Default: (false) ascending.

#### Return Value

Type: RetArraySByteNew array with the same shape as A.

The working dimension for dim = -1 depends on the value of ArrayStyle. For numpy style it starts with the last dimension to search for a non-singleton dimension. For ILNumericsV4 the search starts with the first dimension (index #0).

If Indices is of the same shape as (non-empty, non-scalar) A on entry, its content is sorted with the values of A. Otherwise and if Indices is null or not of the same shape as A the function will resize Indices and fill it with zero based indices along the working dimension and sort these together with A.

It is recommended to initialize Indices with 0 or empty``1(InArrayInt64, StorageOrders) to indicate that the indices are required. If A is scalar and Indices is not null, any predefined value of Indices is ignored and 0 is returned in Indices. That means that initializing Indices with 1 or any other scalar literal (for ease of use) does work also, as long as A is not scalar.

[ILNumerics Computing Engine]