# rpqr79.f

          SUBROUTINE RPQR79 (NDEG, COEFF, ROOT, IERR, WORK)
    C***BEGIN PROLOGUE  RPQR79
    C***PURPOSE  Find the zeros of a polynomial with real coefficients.
    C***LIBRARY   SLATEC
    C***CATEGORY  F1A1A
    C***TYPE      SINGLE PRECISION (RPQR79-S, CPQR79-C)
    C***KEYWORDS  COMPLEX POLYNOMIAL, POLYNOMIAL ROOTS, POLYNOMIAL ZEROS
    C***AUTHOR  Vandevender, W. H., (SNLA)
    C***DESCRIPTION
    C
    C   Abstract
    C       This routine computes all zeros of a polynomial of degree NDEG
    C       with real coefficients by computing the eigenvalues of the
    C       companion matrix.
    C
    C   Description of Parameters
    C       The user must dimension all arrays appearing in the call list
    C            COEFF(NDEG+1), ROOT(NDEG), WORK(NDEG*(NDEG+2))
    C
    C    --Input--
    C      NDEG    degree of polynomial
    C
    C      COEFF   REAL coefficients in descending order.  i.e.,
    C              P(Z)= COEFF(1)*(Z**NDEG) + COEFF(NDEG)*Z + COEFF(NDEG+1)
    C
    C      WORK    REAL work array of dimension at least NDEG*(NDEG+2)
    C
    C   --Output--
    C      ROOT    COMPLEX vector of roots
    C
    C      IERR    Output Error Code
    C           - Normal Code
    C          0  means the roots were computed.
    C           - Abnormal Codes
    C          1  more than 30 QR iterations on some eigenvalue of the
    C             companion matrix
    C          2  COEFF(1)=0.0
    C          3  NDEG is invalid (less than or equal to 0)
    C
    C***REFERENCES  (NONE)
    C***ROUTINES CALLED  HQR, XERMSG
    C***REVISION HISTORY  (YYMMDD)
    C   800601  DATE WRITTEN
    C   890505  REVISION DATE from Version 3.2
    C   891214  Prologue converted to Version 4.0 format.  (BAB)
    C   900315  CALLs to XERROR changed to CALLs to XERMSG.  (THJ)
    C   911010  Code reworked and simplified.  (RWC and WRB)
    C***END PROLOGUE  RPQR79