### 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.
Workspace.
##### IFAIL = INTEGER (Returned)
Non zero if a bounds error has been detected.

#### Notes:

• There is a routine for each of the data types integer, real and double precision; replace [x] in the routine name by I, R or D as appropriate. The data type of the A argument should match the routine being used.