3 SUBROUTINE slasrt2( ID, N, D, KEY, INFO )
60 parameter(
SELECT = 20 )
63 INTEGER DIR, ENDD, I, J, START, STKPNT, TMPKEY
64 REAL D1, D2, D3, DMNMX, TMP
67 INTEGER STACK( 2, 32 )
83 IF( lsame( id,
'D' ) )
THEN
85 ELSE IF( lsame( id,
'I' ) )
THEN
90 ELSE IF( n.LT.0 )
THEN
94 CALL xerbla(
'SLASRT2', -info )
107 start = stack( 1, stkpnt )
108 endd = stack( 2, stkpnt )
110 IF( endd-start.GT.0 )
THEN
118 DO 30 i = start + 1, endd
119 DO 20 j = i, start + 1, -1
120 IF( d( j ).GT.d( j-1 ) )
THEN
125 key( j ) = key( j-1 )
137 DO 50 i = start + 1, endd
138 DO 40 j = i, start + 1, -1
139 IF( d( j ).LT.d( j-1 ) )
THEN
144 key( j ) = key( j-1 )
154 ELSE IF( endd-start.GT.
SELECT )
THEN
162 i = ( start+endd ) / 2
167 ELSE IF( d3.LT.d2 )
THEN
175 ELSE IF( d3.LT.d1 )
THEN
191 IF( d( j ).LT.dmnmx )
195 IF( d( i ).GT.dmnmx )
206 IF( j-start.GT.endd-j-1 )
THEN
208 stack( 1, stkpnt ) = start
209 stack( 2, stkpnt ) = j
211 stack( 1, stkpnt ) = j + 1
212 stack( 2, stkpnt ) = endd
215 stack( 1, stkpnt ) = j + 1
216 stack( 2, stkpnt ) = endd
218 stack( 1, stkpnt ) = start
219 stack( 2, stkpnt ) = j
230 IF( d( j ).GT.dmnmx )
234 IF( d( i ).LT.dmnmx )
245 IF( j-start.GT.endd-j-1 )
THEN
247 stack( 1, stkpnt ) = start
248 stack( 2, stkpnt ) = j
250 stack( 1, stkpnt ) = j + 1
251 stack( 2, stkpnt ) = endd
254 stack( 1, stkpnt ) = j + 1
255 stack( 2, stkpnt ) = endd
257 stack( 1, stkpnt ) = start
258 stack( 2, stkpnt ) = j