85 SUBROUTINE orders(IN,ISORT,IDATA,INDEX,N,M,I1,I2)
87 dimension isort(n),index(n)
88 INTEGER(8) IDATA(M,N),ICHEK,IBYT
90 dimension indx(0:255),kndx(0:255)
91 equivalence(ichek,rchek)
110 if(itype==0)
CALL ordec4(in,isort,idata,index,n,m,i1,i2)
111 if(itype/=0)
CALL order4(in,isort,idata,index,n,m,i1,i2)
114 IF(itype==0)
CALL ordec8(in,isort,idata,index,n,m,i1,i2)
117 print*,
'ORDERS argument i1 (keyword size) can be 4 or 8'
118 print*,
'ORDERS argument i1 here=',i1
129 IF(itype.EQ.1 .AND. ichek.LT.smal) smal = ichek
130 IF(itype.EQ.2 .AND. rchek.LT.smal) smal = rchek
135 IF(itype.EQ.1) ichek = ichek+smal
136 IF(itype.EQ.2) rchek = rchek+smal
152 jbyt = iand(ishft(idata(1,index(i)),-ibyt*8_8),255_8)
153 indx(jbyt) = indx(jbyt)+1
158 kndx(i) = kndx(i-1)+indx(i-1)
162 jbyt = iand(ishft(idata(1,isort(i)),-ibyt*8_8),255_8)
163 index(kndx(jbyt)) = isort(i)
164 kndx(jbyt) = kndx(jbyt)+1
175 IF(itype.EQ.1) ichek = ichek-smal
176 IF(itype.EQ.2) rchek = rchek-smal
188 SUBROUTINE order4(IN,ISORT,IDATA,INDEX,N,M,I1,I2)
190 dimension isort(n),index(n)
191 INTEGER(4) IDATA(M,N),ICHEK,IBYT
193 dimension indx(0:255),kndx(0:255)
194 equivalence(ichek,rchek)
216 IF(itype.EQ.1 .AND. ichek.LT.smal) smal = ichek
217 IF(itype.EQ.2 .AND. rchek.LT.smal) smal = rchek
222 IF(itype.EQ.1) ichek = ichek+smal
223 IF(itype.EQ.2) rchek = rchek+smal
239 jbyt = iand(ishft(idata(1,index(i)),-ibyt*8_4),255_4)
240 indx(jbyt) = indx(jbyt)+1
245 kndx(i) = kndx(i-1)+indx(i-1)
249 jbyt = iand(ishft(idata(1,isort(i)),-ibyt*8_4),255_4)
250 index(kndx(jbyt)) = isort(i)
251 kndx(jbyt) = kndx(jbyt)+1
262 IF(itype.EQ.1) ichek = ichek-smal
263 IF(itype.EQ.2) rchek = rchek-smal
275 SUBROUTINE ordec8(IN,ISORT,IDATA,INDEX,N,M,I1,I2)
277 dimension isort(n),index(n)
278 character(8) IDATA(M,N)
279 dimension indx(0:255),kndx(0:255)
307 jbyt = ichar(idata(1,index(i))(ii:ii))
308 indx(jbyt) = indx(jbyt)+1
313 kndx(i) = kndx(i-1)+indx(i-1)
317 jbyt = ichar(idata(1,isort(i))(ii:ii))
318 index(kndx(jbyt)) = isort(i)
319 kndx(jbyt) = kndx(jbyt)+1
331 SUBROUTINE ordec4(IN,ISORT,IDATA,INDEX,N,M,I1,I2)
333 dimension isort(n),index(n)
334 character(4) IDATA(M,N)
335 dimension indx(0:255),kndx(0:255)
363 jbyt = ichar(idata(1,index(i))(ii:ii))
364 indx(jbyt) = indx(jbyt)+1
369 kndx(i) = kndx(i-1)+indx(i-1)
373 jbyt = ichar(idata(1,isort(i))(ii:ii))
374 index(kndx(jbyt)) = isort(i)
375 kndx(jbyt) = kndx(jbyt)+1
subroutine errexit(iret)
Exit with a return code.
subroutine orders(in, isort, idata, index, n, m, i1, i2)
Orders is a fast and stable sort routine suitable for efficient, multiple-pass sorting on variable le...