The routine will now return an error status as supplied
by PDA_XERMSG.
SUBROUTINE PDA_DSORT (DX, DY, N, KFLAG, STATUS)
***BEGIN PROLOGUE PDA_DSORT
***PURPOSE Sort an array and optionally make the same interchanges in
an auxiliary array. The array may be sorted in increasing
or decreasing order. A slightly modified QUICKSORT
algorithm is used.
***LIBRARY SLATEC
***CATEGORY N6A2B
***TYPE DOUBLE PRECISION (SSORT-S, PDA_DSORT-D, ISORT-I)
***KEYWORDS SINGLETON QUICKSORT, SORT, SORTING
***AUTHOR Jones, R. E., (SNLA)
Wisniewski, J. A., (SNLA)
***DESCRIPTION
PDA_DSORT sorts array DX and optionally makes the same interchanges in
array DY. The array DX may be sorted in increasing order or
decreasing order. A slightly modified quicksort algorithm is used.
Description of Parameters
DX - array of values to be sorted (usually abscissas)
DY - array to be (optionally) carried along
N - number of values in array DX to be sorted
KFLAG - control parameter
= 2 means sort DX in increasing order and carry DY along.
= 1 means sort DX in increasing order (ignoring DY)
= -1 means sort DX in decreasing order (ignoring DY)
= -2 means sort DX in decreasing order and carry DY along.
STATUS - Returned error status.
The status must be zero on entry. This
routine does not check the status on entry.
***REFERENCES R. C. Singleton, Algorithm 347, An efficient algorithm
for sorting with minimal storage, Communications of
the ACM, 12, 3 (1969), pp. 185-187.
***ROUTINES CALLED PDA_XERMSG
***REVISION HISTORY (YYMMDD)
761101 DATE WRITTEN
761118 Modified to use the Singleton quicksort algorithm. (JAW)
890531 Changed all specific intrinsics to generic. (WRB)
890831 Modified array declarations. (WRB)
891009 Removed unreferenced statement labels. (WRB)
891024 Changed category. (WRB)
891024 REVISION DATE from Version 3.2
891214 Prologue converted to Version 4.0 format. (BAB)
900315 CALLs to XERROR changed to CALLs to PDA_XERMSG. (THJ)
901012 Declared all variables; changed X,Y to DX,DY; changed
code to parallel SSORT. (M. McClain)
920501 Reformatted the REFERENCES section. (DWL, WRB)
920519 Clarified error messages. (DWL)
920801 Declarations section rebuilt and code restructured to use
IF-THEN-ELSE-ENDIF. (RWC, WRB)
950403 Implement status. (HME)
***END PROLOGUE PDA_DSORT