# hqr.f

          SUBROUTINE HQR (NM, N, LOW, IGH, H, WR, WI, IERR)
    C***BEGIN PROLOGUE  HQR
    C***PURPOSE  Compute the eigenvalues of a real upper Hessenberg matrix
    C            using the QR method.
    C***LIBRARY   SLATEC (EISPACK)
    C***CATEGORY  D4C2B
    C***TYPE      SINGLE PRECISION (HQR-S, COMQR-C)
    C***KEYWORDS  EIGENVALUES, EIGENVECTORS, EISPACK
    C***AUTHOR  Smith, B. T., et al.
    C***DESCRIPTION
    C
    C     This subroutine is a translation of the ALGOL procedure HQR,
    C     NUM. MATH. 14, 219-231(1970) by Martin, Peters, and Wilkinson.
    C     HANDBOOK FOR AUTO. COMP., VOL.II-LINEAR ALGEBRA, 359-371(1971).
    C
    C     This subroutine finds the eigenvalues of a REAL
    C     UPPER Hessenberg matrix by the QR method.
    C
    C     On INPUT
    C
    C        NM must be set to the row dimension of the two-dimensional
    C          array parameter, H, as declared in the calling program
    C          dimension statement.  NM is an INTEGER variable.
    C
    C        N is the order of the matrix H.  N is an INTEGER variable.
    C          N must be less than or equal to NM.
    C
    C        LOW and IGH are two INTEGER variables determined by the
    C          balancing subroutine  BALANC.  If  BALANC  has not been
    C          used, set LOW=1 and IGH equal to the order of the matrix, N.
    C
    C        H contains the upper Hessenberg matrix.  Information about
    C          the transformations used in the reduction to Hessenberg
    C          form by  ELMHES  or  ORTHES, if performed, is stored
    C          in the remaining triangle under the Hessenberg matrix.
    C          H is a two-dimensional REAL array, dimensioned H(NM,N).
    C
    C     On OUTPUT
    C
    C        H has been destroyed.  Therefore, it must be saved before
    C          calling  HQR  if subsequent calculation and back
    C          transformation of eigenvectors is to be performed.
    C
    C        WR and WI contain the real and imaginary parts, respectively,
    C          of the eigenvalues.  The eigenvalues are unordered except
    C          that complex conjugate pairs of values appear consecutively
    C          with the eigenvalue having the positive imaginary part first.
    C          If an error exit is made, the eigenvalues should be correct
    C          for indices IERR+1, IERR+2, ..., N.  WR and WI are one-
    C          dimensional REAL arrays, dimensioned WR(N) and WI(N).
    C
    C        IERR is an INTEGER flag set to
    C          Zero       for normal return,
    C          J          if the J-th eigenvalue has not been
    C                     determined after a total of 30*N iterations.
    C                     The eigenvalues should be correct for indices
    C                     IERR+1, IERR+2, ..., N.
    C
    C     Questions and comments should be directed to B. S. Garbow,
    C     APPLIED MATHEMATICS DIVISION, ARGONNE NATIONAL LABORATORY
    C     ------------------------------------------------------------------
    C
    C***REFERENCES  B. T. Smith, J. M. Boyle, J. J. Dongarra, B. S. Garbow,
    C                 Y. Ikebe, V. C. Klema and C. B. Moler, Matrix Eigen-
    C                 system Routines - EISPACK Guide, Springer-Verlag,
    C                 1976.
    C***ROUTINES CALLED  (NONE)
    C***REVISION HISTORY  (YYMMDD)
    C   760101  DATE WRITTEN
    C   890531  Changed all specific intrinsics to generic.  (WRB)
    C   890831  Modified array declarations.  (WRB)
    C   890831  REVISION DATE from Version 3.2
    C   891214  Prologue converted to Version 4.0 format.  (BAB)
    C   920501  Reformatted the REFERENCES section.  (WRB)
    C***END PROLOGUE  HQR