      SUBROUTINE HSR3(A,LA,M,N)
      INTEGER I,J,K,L,LA,M,N
      REAL A(LA,1),S
      K = N
      IF ( M .GE. N ) GOTO 10
      WRITE(6,*) 'ERROR: ARGUMENT M MUST BE .GE. N IN SUBROUTINE HSR3'
      STOP
10    S = -A(K,K)
      DO 20 I = K,M
20         A(I,K) = S*A(I,K)
      A(K,K) = 1. + A(K,K)
      IF ( K .EQ. 1 ) RETURN
      L = K
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
      GOTO 10
      END
