 
      SUBROUTINE RG(NM,N,A,WR,WI,MATZ,Z,IV1,FV1,IERR)
C***BEGIN PROLOGUE  RG
C***DATE WRITTEN   760101   (YYMMDD)
C***REVISION DATE  830518   (YYMMDD)
C***CATEGORY NO.  D4A2
C***KEYWORDS  EIGENVALUES,EIGENVECTORS,EISPACK
C***AUTHOR  SMITH, B. T., ET AL.
C***PURPOSE  Computes eigenvalues and, optionally, eigenvectors of a
C            real general matrix.
C***DESCRIPTION
C
C     This subroutine calls the recommended sequence of
C     subroutines from the eigensystem subroutine package (EISPACK)
C     To find the eigenvalues and eigenvectors (if desired)
C     of a REAL GENERAL matrix.
C
C     On Input
C
C        NM  must be set to the row dimension of the two-dimensional
C        array parameters as declared in the calling program
C        dimension statement.
C
C        N  is the order of the matrix  A.
C
C        A  contains the real general matrix.
C
C        MATZ  is an integer variable set equal to zero if
C        only eigenvalues are desired.  Otherwise it is set to
C        any non-zero integer for both eigenvalues and eigenvectors.
C
C     On Output
C
C        WR  and  WI  contain the real and imaginary parts,
C        respectively, of the eigenvalues.  Complex conjugate
C        pairs of eigenvalues appear consecutively with the
C        eigenvalue having the positive imaginary part first.
C
C        Z  contains the real and imaginary parts of the eigenvectors
C        if MATZ is not zero.  If the J-th eigenvalue is real, the
C        J-th column of  Z  contains its eigenvector.  If the J-TH
C        eigenvalue is complex with positive imaginary part, the
C        J-th and (J+1)-th columns of  Z  contain the real and
C        imaginary parts of its eigenvector.  The conjugate of this
C        vector is the eigenvector for the conjugate eigenvalue.
C
C        IERR  is an integer output variable set equal to an
C        error completion code described in section 2B of the
C        documentation.  The normal completion code is zero.
C
C        IV1  and  FV1  are temporary storage arrays.
C
C     Questions and comments should be directed to B. S. Garbow,
C     APPLIED MATHEMATICS DIVISION, ARGONNE NATIONAL LABORATORY
C     ------------------------------------------------------------------
C***REFERENCES  B. T. SMITH, J. M. BOYLE, J. J. DONGARRA, B. S. GARBOW,
C                 Y. IKEBE, V. C. KLEMA, C. B. MOLER, *MATRIX EIGEN-
C                 SYSTEM ROUTINES - EISPACK GUIDE*, SPRINGER-VERLAG,
C                 1976.
C***ROUTINES CALLED  BALANC,BALBAK,ELMHES,ELTRAN,HQR,HQR2
C***END PROLOGUE  RG
 
 
