!+ Subroutine to solve tridaigonal equations.
!
! Method:
!	A set of tridiagonal equations is solved by Gaussian
!	elimination. The eliminative step proceeds downward through
!	the atmosphere.
!
! Current Owner of Code: J. M. Edwards
!
! History:
!	Version		Date			Comment
!	1.0		12-04-95		First Version under RCS
!						(J. M. Edwards)
!
! Description of Code:
!   FORTRAN 77  with extensions listed in documentation.
!
!- ---------------------------------------------------------------------
      SUBROUTINE TRIDIAG_SOLVER_DOWN(M, N
     &   , A3, B
     &   , X
     &   , PM, PN
     &   , RHO, SIGMA
     &   )
!
!
      IMPLICIT NONE
!
!
!     DUMMY VARIABLES.
      INTEGER	!, INTENT(IN)
     &     M
!             NUMBER OF SETS OF EQUATIONS
     &   , N
!             NUMBER OF EQUATIONS IN EACH SET
     &   , PM
!             ARRAY SIZE FOR NUMBER OF SETS
     &   , PN
!             ARRAY SIZE FOR NUMBER OF EQUATIONS
      REAL*8	!, INTENT(IN)
     &     A3(PM, 3, PN)
!             TRIDIAGONAL MATRICES
     &   , B(PM, PN)
!             RIGHT-HAND SIDES
      REAL*8	!, INTENT(OUT)
     &     X(PM, PN)
!             SOLUTION VECTORS
!
!     LOCAL VARIABLES.
      INTEGER
     &     I
!             LOOP VARIABLE
     &   , L
!             LOOP VARIABLE
      REAL*8
     &     RHO(PM, PN)
!             COEFFICIENT IN RECURRENCE
     &   , SIGMA(PM, PN)
!             TERM IN RECURRENCE
     &   , TEMP
!             TEMPORARY VARIABLE
!
!
!
!     PROCEED BACKWARD THROUGH THE EQUATIONS PERFORMING GUASSIAN
!     ELIMINATION TO FORM A RECURRENCE.
      DO L=1, M
         RHO(L, 1)=-A3(L, 3, 1)/A3(L, 2, 1)
         SIGMA(L, 1)=B(L, 1)/A3(L, 2, 1)
      ENDDO
      DO I=2, N-1
         DO L=1, M
            TEMP=A3(L, 2, I)+A3(L, 1, I)*RHO(L, I-1)
            RHO(L, I)=-A3(L, 3, I)/TEMP
            SIGMA(L, I)=(B(L, I)-A3(L, 1, I)*SIGMA(L, I-1))/TEMP
         ENDDO
      ENDDO
!
!     FORWARD SUBSTITUTING LOOP.
      DO L=1, M
         X(L, N)=(B(L, N)-A3(L, 1, N)*SIGMA(L, N-1))
     &      /(A3(L, 2, N)+A3(L, 1, N)*RHO(L, N-1))
      ENDDO
      DO I=N-1, 1, -1
         DO L=1, M
            X(L, I)=RHO(L, I)*X(L, I+1)+SIGMA(L, I)
         ENDDO
      ENDDO
!
!
      RETURN
      END
