      SUBROUTINE TSLV1 (N,R,C,IC,D,T,IT,JT,IU,B,X,Y)
      INTEGER R(N), C(N), IC(N)
      INTEGER IT(1), JT(1), IU(N)
      REAL B(N), D(N), T(1), X(N), Y(N)
C
C            SOLVE YU = B BY FORWARD SUBSTITUTION
C
      DO 10 K = 1,N
      LK = C(K)
   10 Y(K) = B(LK)
C
      DO 21 K = 1,N
      IF (Y(K) .EQ. 0.0) GO TO 21
      JMIN = IU(K)
      JMAX = IT(K+1) - 1
      IF (JMIN .GT. JMAX) GO TO 21
         DO 20 JJ = JMIN,JMAX
         LJ = JT(JJ)
         J = IC(LJ)
   20    Y(J) = Y(J) - T(JJ)*Y(K)
   21 CONTINUE
C
C            SOLVE XL = Y BY BACKWARD SUBSTITUTION
C
      X(N) = Y(N)/D(N)
      IF (N .EQ. 1) RETURN
C
      K = N
      Y(N) = X(N)
      DO 32 I = 2,N
      JMIN = IT(K)
      JMAX = IU(K) - 1
      IF (JMIN .GT. JMAX) GO TO 31
         DO 30 JJ = JMIN,JMAX
         LJ = JT(JJ)
         J = IC(LJ)
   30    Y(J) = Y(J) - T(JJ)*Y(K)
   31 K = K - 1
   32 Y(K) = Y(K)/D(K)
C
      DO 40 K = 1,N
      LK = R(K)
   40 X(LK) = Y(K)
      RETURN
      END
