!+ Subroutine to perfrom back-substitution in SVD.
!
! Method:
!	Straightforward back-substitution.
!
! 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 BACK_SUBSTITUTE(U, W, V
     &   , N_ROW, N_COLUMN
     &   , ROW_DIMENSION, COLUMN_DIMENSION
     &   , B, X
     &   , TMP
     &   )
!
!
      IMPLICIT NONE
!
!
!     INCLUDE HEADER FILES.
      INCLUDE 'incl/prec_machine.ucf'
      INCLUDE 'incl/precision_svd.tcf'
!
!     DUMMY VARIABLES.
      INTEGER 	!, INTENT(IN)
     &     N_ROW
!             NUMBER OF ROWS
     &   , N_COLUMN
!             NUMBER OF COLUMNS
     &   , ROW_DIMENSION
!             FIRST DIMENSION
     &   , COLUMN_DIMENSION
!             SECOND DIMENSION
      REAL*8 	!, INTENT(IN)
     &     U(ROW_DIMENSION, COLUMN_DIMENSION)
!             U-MATRIX
     &   , W(COLUMN_DIMENSION)
!             DIAGONAL MATRIX
     &   , V(COLUMN_DIMENSION, COLUMN_DIMENSION)
!             V-MATRIX
     &   , B(ROW_DIMENSION)
!             RIGHT HAND SIDE
     &   , TMP(COLUMN_DIMENSION)
!             TEMPORARY STORE
      REAL*8 	!, INTENT(IN)
     &     X(COLUMN_DIMENSION)
!             SOLUTION
!
!     LOCAL VARIABLES.
      INTEGER
     &     I
!             LOOP VARIABLE
     &   , J
!             LOOP VARIABLE
     &   , JJ
!             "
      REAL*8
     &     S
!             SUMMING VARIABLE
!
!
!     CALCULATE UT.B
      DO J=1, N_COLUMN
         S=0.0D+00
         IF (ABS(W(J)).GT.TOL_SVD) THEN
            DO I=1, N_ROW
               S=S+U(I, J)*B(I)
            ENDDO
            S=S/W(J)
         ENDIF
         TMP(J)=S
      ENDDO
      DO J=1, N_COLUMN
         S=0.0D+00
         DO JJ=1, N_COLUMN
            S=S+V(J, JJ)*TMP(JJ)
         ENDDO
         X(J)=S
      ENDDO
!
!
      RETURN
      END
