PDA_SAARx

Sorts the rows of a two dimensional array into ascending order

Description:

This routine returns a list of row sorted indices to an array (rows and columns span the first and second dimensions, respectively). This means that the data in the first row is sorted, any tied positions are then sorted by the corresponding values of the data in the second row, any tied values here are then sorted using the values in the third row and so on until the array is completely value ordered, or all rows have been used.

The sort is stable so any completely tied columns preserve their original order.

Invocation

CALL PDA_SAAR[x]( A, NDEC, N, M, IP, LINK, IFAIL )

Arguments

A( NDEC, M ) = ? (Given)
The matrix to be ranked row by row.
NDEC = INTEGER (Given)
The declared size of the first dimension of A. This should be two elements larger than the size of A to be sorted (i.e. N). The dimensions IP and LINK should also be declared as this size (i.e A should be at least A(N+2,M)).
N = INTEGER (Given)
The number of rows of A to be used (this should not be bigger than NDEC-2).
M = INTEGER (Given)
The number of columns of A to be used.
IP( NDEC ) = INTEGER (Returned)
The indices of A when ranked into ascending order.
LINK( NDEC ) = INTEGER (Given and Returned)
Workspace.
IFAIL = INTEGER (Returned)
Non zero if a bounds error has been detected.

Notes: