      SUBROUTINE lube(a,n,np,indx,b)
C      INTEGER n,np,indx(n)
      IMPLICIT    REAL*8 (A-H,O-Z)
c      REAL a(np,np),b(n)
c      INTEGER i,ii,j,ll
c      REAL sum
      DIMENSION INDX(N), A(NP,NP),B(N)
      ii=0
      do 12 i=1,n
        ll=indx(i)
        sum=b(ll)
        b(ll)=b(i)
        if (ii.ne.0)then
          do 11 j=ii,i-1
            sum=sum-a(i,j)*b(j)
11        continue
        else if (sum.ne.0.D 00) then
          ii=i
        endif
        b(i)=sum
12    continue
      do 14 i=n,1,-1
        sum=b(i)
        do 13 j=i+1,n
          sum=sum-a(i,j)*b(j)
13      continue
        b(i)=sum/a(i,i)
14    continue
      return
      END
