tuple_sort_indextuple_sort_indexTupleSortIndexTupleSortIndextuple_sort_index (Operator)
Name
tuple_sort_indextuple_sort_indexTupleSortIndexTupleSortIndextuple_sort_index
— Sort the elements of a tuple and return the indices of the sorted tuple.
Signature
Herror tuple_sort_index(const Hlong Tuple, Hlong* Indices)
Herror T_tuple_sort_index(const Htuple Tuple, Htuple* Indices)
def tuple_sort_index(tuple: MaybeSequence[Union[float, int, str]]) -> Sequence[int]
def tuple_sort_index_s(tuple: MaybeSequence[Union[float, int, str]]) -> int
Description
tuple_sort_indextuple_sort_indexTupleSortIndexTupleSortIndextuple_sort_index
sorts all elements of TupleTupleTupletupletuple
in
ascending order and returns the indices of the elements of the
sorted tuple (in relation to the input tuple TupleTupleTupletupletuple
) with
IndicesIndicesIndicesindicesindices
. As a precondition the single elements of
TupleTupleTupletupletuple
must be comparable. Thus, TupleTupleTupletupletuple
must
either exclusively consist of strings or it must only contain
(integer or floating point) numbers. In the latter case integers
and floating point numbers may be mixed.
Exception: Empty input tuple
If the input tuple is empty, the operator returns an empty tuple.
HDevelop In-line Operation
HDevelop provides an in-line operation for tuple_sort_indextuple_sort_indexTupleSortIndexTupleSortIndextuple_sort_index
,
which can be used in an expression in the following syntax:
Indices := sort_index(Tuple)
Execution Information
- Multithreading type: independent (runs in parallel even with exclusive operators).
- Multithreading scope: global (may be called from any thread).
- Processed without parallelization.
Parameters
TupleTupleTupletupletuple
(input_control) tuple(-array) →
HTupleMaybeSequence[Union[float, int, str]]HTupleHtuple (integer / real / string) (int / long / double / string) (Hlong / double / HString) (Hlong / double / char*)
Input tuple.
IndicesIndicesIndicesindicesindices
(output_control) integer(-array) →
HTupleSequence[int]HTupleHtuple (integer) (int / long) (Hlong) (Hlong)
Sorted tuple.
Alternatives
tuple_sorttuple_sortTupleSortTupleSorttuple_sort
,
tuple_inversetuple_inverseTupleInverseTupleInversetuple_inverse
Module
Foundation