1
c-----------------------------------------------------------------------
7
c Sort the array X1 in the order specified by WHICH and optionally
8
c applies the permutation to the array X2.
12
c ( WHICH, APPLY, N, X1, X2 )
15
c WHICH Character*2. (Input)
16
c 'LM' -> X1 is sorted into increasing order of magnitude.
17
c 'SM' -> X1 is sorted into decreasing order of magnitude.
18
c 'LA' -> X1 is sorted into increasing order of algebraic.
19
c 'SA' -> X1 is sorted into decreasing order of algebraic.
21
c APPLY Logical. (Input)
22
c APPLY = .TRUE. -> apply the sorted order to X2.
23
c APPLY = .FALSE. -> do not apply the sorted order to X2.
28
c X1 Real array of length N. (INPUT/OUTPUT)
29
c The array to be sorted.
31
c X2 Real array of length N. (INPUT/OUTPUT)
32
c Only referenced if APPLY = .TRUE.
36
c-----------------------------------------------------------------------
41
c Danny Sorensen Phuong Vu
42
c Richard Lehoucq CRPC / Rice University
43
c Dept. of Computational & Houston, Texas
49
c 12/16/93: Version ' 2.1'.
50
c Adapted from the sort routine in LANSO.
52
c\SCCS Information: @(#)
53
c FILE: sortr.F SID: 2.3 DATE OF SID: 4/19/96 RELEASE: 2
57
c-----------------------------------------------------------------------
59
subroutine ssortr (which, apply, n, x1, x2)
61
c %------------------%
62
c | Scalar Arguments |
63
c %------------------%
74
& x1(0:n-1), x2(0:n-1)
84
c %-----------------------%
85
c | Executable Statements |
86
c %-----------------------%
90
if (which .eq. 'SA') then
92
c X1 is sorted into decreasing order of algebraic.
95
if (igap .eq. 0) go to 9000
102
if (x1(j).lt.x1(j+igap)) then
120
else if (which .eq. 'SM') then
122
c X1 is sorted into decreasing order of magnitude.
125
if (igap .eq. 0) go to 9000
132
if (abs(x1(j)).lt.abs(x1(j+igap))) then
150
else if (which .eq. 'LA') then
152
c X1 is sorted into increasing order of algebraic.
155
if (igap .eq. 0) go to 9000
162
if (x1(j).gt.x1(j+igap)) then
180
else if (which .eq. 'LM') then
182
c X1 is sorted into increasing order of magnitude.
185
if (igap .eq. 0) go to 9000
190
if (j.lt.0) go to 120
192
if (abs(x1(j)).gt.abs(x1(j+igap))) then