Description:
This routine
reorders an array (in place) using an permutation vector. This is most likely the output from one of the
sorting routines PDA_QSI[A|D][x]
Invocation
CALL PDA_RINP[x]( PERM, N, X, IFAIL )
Arguments
PERM( N ) = INTEGER (Given and Returned)
The index vector. Note this is modified
but should be returned in the same state as when input. Indices may not be negative.
N = INTEGER
(Given)
Number of elements.
X( N ) = ? (Given and Returned)
The array to reorder.
IFAIL =
INTEGER (Returned)
Status flag. Set 0 for success, otherwise the permutation isn’t correct.
Notes:
-
Re-ordering is trivial if two arrays are available.
-
DO I = 1, N
-
-
XX( I ) = X( PERM( I )
-
END DO
The XX array contains the sorted values on completion.
-
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 X argument should match the routine
being used.
Timing
Proportional to N.