      SUBROUTINE TR2 (A,MDIMA,U,S,I1,I2,J1,J2)
C
C        THIS ROUTINE PERFORMS THE HOUSEHOLDER TRANSFORMATION
C               H = I - S * U * U'
C        ON COLUMNS J1+1 TO J1+J2 OF A, THIS FROM ROWS I1 TO I2.
C
      DOUBLE PRECISION A(MDIMA,1),U(1),S,INPROD,Y
      DO 20 I = I1,I2
         INPROD = 0.0D0
         DO 10 J = 1,J2
   10       INPROD = INPROD+U(J)*A(I,J1+J)
         Y = INPROD*S
         DO 20 J = 1,J2
   20       A(I,J1+J) = A(I,J1+J)-U(J)*Y
      RETURN
      END
