ILNumerics Ultimate VS

ILMathsort Method (BaseArrayInt32, OutArrayInt64, Int32, Boolean)

ILNumerics Ultimate VS Documentation
ILNumerics - Technical Application Development
Sort elements of A along the specified dimension. Computes indices also.

[ILNumerics Computing Engine]

Namespace:  ILNumerics
Assembly:  ILNumerics.Computing (in ILNumerics.Computing.dll) Version: 5.4.0.0 (5.4.7431.3055)
Syntax

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

Parameters

A
Type: ILNumericsBaseArrayInt32
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: RetArrayInt32
New array with the same shape as A.
Remarks

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]

See Also

Reference