      SUBROUTINE HSR4(A,LA,M,N)
      INTEGER I,J,K,L,LA,M,N
      REAL A(LA,1),S
      K = M
      IF ( M .GT. N ) GOTO 10
      WRITE(6,*) 'ERROR: ARGUMENT M MUST BE .GT. N IN SUBROUTINE HSR4'
      STOP
10    S = -A(K,N)
      DO 20 I = N,M
20         A(I,K) = S*A(I,N)
      A(K,K) = 1. + A(K,K)
      L = N
30    J = L
      L = L - 1
      IF ( L .EQ. 0 ) GOTO 60
      S = 0.
      DO 40 I = J,M
40         S = S + A(I,L)*A(I,K)
      A(L,K) = -S*A(L,L)
      DO 50 I = J,M
50         A(I,K) = A(I,K) - S*A(I,L)
      GOTO 30
60    K = K - 1
      IF ( K .GT. N ) GOTO 10
      K = M - N
      DO 70 J = 1,K
           DO 70 I = 1,M
70              A(I,J) = A(I,J+N)
      RETURN
      END
