Table of contents
orderi_c ( Order of an integer array )
void orderi_c ( ConstSpiceInt * array,
SpiceInt * iorder )
Determine the order of elements in an integer array.
VARIABLE I/O DESCRIPTION
-------- --- --------------------------------------------------
array I Input array.
ndim I Dimension of array.
iorder O Order vector for array.
array is the input array.
ndim is the number of elements in the input array.
iorder is the order vector for the input array.
iorder is the index of the smallest element
of array; iorder is the index of the next
smallest; and so on.
The elements of iorder range from zero to ndim-1.
1) A negative input dimension causes this routine to leave the
output order vector unchanged.
orderi_c finds the index of the smallest element of the input
array. This becomes the first element of the order vector.
The process is repeated for the rest of the elements.
The order vector returned by orderi_c may be used by any of
the reord*_c routines to sort sets of related arrays, as shown
in the example below.
In the following example, the order*_c and reord*_c routines are
used to sort four related arrays (containing the names,
masses, integer ID codes, and visual magnitudes for a group
of satellites). This is representative of the typical use of
Sort the object arrays by ID code.
orderi_c ( codes, n, iorder );
reordc_c ( iorder, n, namlen, names );
reordd_c ( iorder, n, masses );
reordi_c ( iorder, n, codes );
reordd_c ( iorder, n, vmags );
N.J. Bachman (JPL)
J. Diaz del Rio (ODC Space)
I.M. Underwood (JPL)
-CSPICE Version 1.0.2, 10-AUG-2021 (JDR)
Edited the header to comply with NAIF standard.
-CSPICE Version 1.0.1, 23-MAR-2010 (NJB)
Header example was updated to show use of this routine.
-Exceptions section was updated. Header sections were
-CSPICE Version 1.0.0, 08-JUL-2002 (NJB) (IMU)
order of an integer array