subroutine ssort(a,l,nc) implicit none include 'max.inc' c c Purpose: to sort input array "a" by increasing values of a(1,*) c c Inputs: c + a: input data array, l lines by nc columns c + l: number of lines c + nc: number of colums c c Outputs: c + a: data array, sorted by increasing values of a(1,*) c c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - double precision a(1:Nmax,1:Nc_mx),b(1:Nmax) integer l,f,n2,s,t,ls,i,is,j,js,nc,jj double precision ah,bh,tmp(1:Nc_mx) c label integer strlen character*(Nchar_mx) label label='subroutine ssort' c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - do i=1,l b(i)=i enddo f=1 if (l.le.f) return n2=(l-f+1)/2 s=1023 do 100 t=1,10 if (s.gt.n2) goto 90 ls=l-s do 20 i=f,ls is=i+s do jj=1,nc tmp(jj)=a(is,jj) enddo bh=b(is) j=i js=is 5 if (tmp(1).ge.a(j,1)) goto 10 do jj=1,nc a(js,jj)=a(j,jj) enddo b(js)=b(j) js=j j=j-s if (j.ge.f) goto 5 10 continue do jj=1,nc a(js,jj)=tmp(jj) enddo b(js)=bh 20 continue 90 s=s/2 100 continue return end