KPG1_IS3x

Sorts an array of data into increasing order, also shuffling two ancillary arrays correspondingly

Description:

The routine uses an insert sort method. This has proven itself the quickest for sorting small sets of data lots of times, as in image stacking using ordered statistics. The method looks at the second value, compares this with the first if swaps if necessary, then it looks at the third, looks at the previous values swaps with the lowest (or not at all) and so on until all values have been passed. It is fast (for the case above ) simply because of the very few lines of operation. The sort is extended to the ancillary data DDAT, and PDAT these maintain their correspondence with the ORDDAT dataset on exit.

Invocation

CALL KPG1_IS3x( ORDDAT, DDAT, PDAT, NENT, STATUS )

Arguments

ORDDAT( NENT ) = ? (Given and Returned)
The data to order. On output it contains the data in increasing order.
DDAT( NENT ) = ? (Given and Returned)
A list of data associated with ORDDAT which needs to retain its correspondence with the items in ORDDAT.
PDAT( NENT ) = INTEGER (Given and Returned)
A list of data associated with ORDDAT which needs to retain its correspondence with the items in ORDDAT (probably pointers).
NENT = INTEGER (Given)
The number of entries in ORDDAT.
STATUS = INTEGER (Given and Returned)
The global status.

Notes: