## SUBROUTINE RG(NM,N,A,WR,WI,MATZ,Z,IV1,FV1,IERR)

RG calls the recommended sequence of EISPACK subroutines to find the eigenvalues and, if desired, the eigenvectors of a real, general matrix.

NM
Input, INTEGER NM, the row dimension (first dimension) of the two dimensional arrays as declared in the calling program.

N
Input, INTEGER N, the order (=size=number of rows=number of columns) of the matrix whose eigenvalues are sought.

A
Input/output, REAL A(NM,N), on input, the matrix, which is overwritten on output.

WR
Output, REAL WR(N), the real parts of the eigenvalues.

WI
Output, REAL WI(N), the imaginary parts of the eigenvalues.

MATZ
Input, INTEGER MATZ, set to 0 if only eigenvalues are desired. Otherwise all eigenvectors will also be calculated.

Z
Output, REAL Z(NM,N), if MATZ is not zero, Z contains the eigenvectors of A. If the J-th eigenvalue is real, the J-th column of Z is its eigenvector. If the J-th eigenvalue is complex with positive real part (then the J+1-th eigenvalue is its complex conjugate), its eigenvector has real part in the J-th column of Z and imaginary part in the J+1-th column of Z.

IV1
Work vector, INTEGER IV1(N).

FV1
Work vector, REAL FV1(N).

IERR
Output, INTEGER IERR, an error flag. 0 if no errors, or J if eigenvalues 1 through J were not found.     