**ORDERS**
The **ORDERS** routine is a fast and stable multipurpose sort.
USAGE: CALL ORDERS(IN,ISORT,IDATA,INDEX,N,M,I1,I2)
Input arguments:
IN - INDICATOR OF KEY FORM AND INDEX STATE
IN = 0 INITIALIZE INDEXES AND SORT CHARACTERS
IN = 1 INITIALIZE INDEXES AND SORT INTEGERS
IN = 2 INITIALIZE INDEXES AND SORT REAL NUMBERS
IN = 10 SORT CHARACTERS WITH INDEXES AS IS
IN = 11 SORT INTEGERS WITH INDEXES AS IS
IN = 12 SORT REAL NUMBERS WITH INDEXES ASIS
ISORT - WORK ARRAY WITH THE SAME DIMENSION AS IDATA
IDATA - ARRAY OF SORT KEYS AS DESCRIBED BY IN
INDEX - ARRAY OF INDEXES REPRESENTING THE SORTED IDATA
N - DIMENSION OF ISORT, IDATA, AND INDEX
M - OFFSET (IN KEY-WORDS) BETWEEN SUCCESSIVE MEMBERS OF IDATA
I1 - BYTE LENGTH OF THE KEY-WORDS
I2 - NOT USED; INCLUDED FOR COMPATABILITY WITH ORIGINAL CRAY
ROUTINE
Output arguments:
INDEX - ARRAY OF INDEXES REPRESENTING THE SORTED 'IDATA'
REMARKS:
The one byte radix method was selected for orders because it
offers a good ratio of memory requirement to operation count
for producing a sort. Because of recursive manipulation of indexes
in one of the loops, this may actually take slightly longer on some
vector machines than a (more work intensive) one bit radix method.
In general, though, the one byte method is faster. Any larger radix
presents exponentially increasing memory required. NOTE that the
implementation uses very little local data space, and only modesT
user-supplied memory.
W3lib.tar |
Library contains Fortran 90 decoder/encoder
routines for GRIB edition 1. (Fortran90)
Date posted: 2/22/2007 |