SUBROUTINE ISORT(X,Y,N,KFLAG) C***BEGIN PROLOGUE ISORT C***DATE WRITTEN 761118 (YYMMDD) C***REVISION DATE 820801 (YYMMDD) C***CATEGORY NO. N6A2A C***KEYWORDS QUICKSORT,SINGLETON QUICKSORT,SORT,SORTING C***AUTHOR JONES, R. E., (SNLA) C KAHANER, D. K., (NBS) C WISNIEWSKI, J. A., (SNLA) C***PURPOSE ISORT sorts integer array X and optionally makes the same C interchanges in integer array Y. The array X may be C sorted in increasing order or decreasing order. A C slightly modified QUICKSORT algorithm is used. C***DESCRIPTION C C Written by Rondall E Jones C Modified by John A. Wisniewski to use the Singleton QUICKSORT C algorithm. Date 18 November 1976. C C Further modified by David K. Kahaner C NATIONAL BUREAU OF STANDARDS C August, 1981 C C Abstract C ISORT sorts integer array X and optionally makes the same C interchanges in integer array Y. The array X may be sorted in C INCREASING order or DECREASING order. A slightly modified C QUICKSORT algorithm is used. C C Reference C Singleton,R.C., Algorithm 347, An Efficient Algorithm For C Sorting With Minimal Storage, CACM,12(3),1969,185-7. C C Description of Parameters C X - integer array of values to be sorted C Y - integer array to be (optionally) carried along C N - number of values in integer array X to be sorted C KFLAG - control parameter C = 2 means sort X in INCREASING order and carry Y along. C = 1 means sort X in INCREASING order (ignoring Y) C =-1 means sort X in DECREASING order (ignoring Y) C =-2 means sort X in DECREASING order and carry Y along. C***REFERENCES SINGLETON, R. C., ALGORITHM 347, AN EFFICIENT C ALGORITHM FOR SORTING WITH MINIMAL STORAGE, CACM, C VOL. 12, NO. 3, 1969, PP. 185-187. C***ROUTINES CALLED XERROR C***END PROLOGUE ISORT