1 SUBROUTINE CG(NM,N,AR,AI,WR,WI,MATZ,ZR,ZI,FV1,FV2,FV3,IERR) 2C***BEGIN PROLOGUE CG 3C***DATE WRITTEN 760101 (YYMMDD) 4C***REVISION DATE 830518 (YYMMDD) 5C***CATEGORY NO. D4A4 6C***KEYWORDS EIGENVALUES,EIGENVECTORS,EISPACK 7C***AUTHOR SMITH, B. T., ET AL. 8C***PURPOSE Computes the eigenvalues and, optionally, the eigenvectors 9C of a complex general matrix. 10C***DESCRIPTION 11C 12C This subroutine calls the recommended sequence of 13C subroutines from the eigensystem subroutine package (EISPACK) 14C to find the eigenvalues and eigenvectors (if desired) 15C of a COMPLEX GENERAL matrix. 16C 17C On INPUT 18C 19C NM must be set to the row dimension of the two-dimensional 20C array parameters as declared in the calling program 21C dimension statement. 22C 23C N is the order of the matrix A=(AR,AI). 24C 25C AR and AI contain the real and imaginary parts, 26C respectively, of the complex general matrix. 27C 28C MATZ is an integer variable set equal to zero if 29C only eigenvalues are desired. Otherwise it is set to 30C any non-zero integer for both eigenvalues and eigenvectors. 31C 32C On OUTPUT 33C 34C WR and WI contain the real and imaginary parts, 35C respectively, of the eigenvalues. 36C 37C ZR and ZI contain the real and imaginary parts, 38C respectively, of the eigenvectors if MATZ is not zero. 39C 40C IERR is an integer output variable set equal to an 41C error completion code described in section 2B of the 42C documentation. The normal completion code is zero. 43C 44C FV1, FV2, and FV3 are temporary storage arrays. 45C 46C Questions and comments should be directed to B. S. Garbow, 47C APPLIED MATHEMATICS DIVISION, ARGONNE NATIONAL LABORATORY 48C ------------------------------------------------------------------ 49C***REFERENCES B. T. SMITH, J. M. BOYLE, J. J. DONGARRA, B. S. GARBOW, 50C Y. IKEBE, V. C. KLEMA, C. B. MOLER, *MATRIX EIGEN- 51C SYSTEM ROUTINES - EISPACK GUIDE*, SPRINGER-VERLAG, 52C 1976. 53C***ROUTINES CALLED CBABK2,CBAL,COMQR,COMQR2,CORTH 54C***END PROLOGUE CG 55C 56 INTEGER N,NM,IS1,IS2,IERR,MATZ 57 REAL AR(NM,N),AI(NM,N),WR(N),WI(N),ZR(NM,N),ZI(NM,N) 58 REAL FV1(N),FV2(N),FV3(N) 59C 60C***FIRST EXECUTABLE STATEMENT CG 61 IF (N .LE. NM) GO TO 10 62 IERR = 10 * N 63 GO TO 50 64C 65 10 CALL CBAL(NM,N,AR,AI,IS1,IS2,FV1) 66 CALL CORTH(NM,N,IS1,IS2,AR,AI,FV2,FV3) 67 IF (MATZ .NE. 0) GO TO 20 68C .......... FIND EIGENVALUES ONLY .......... 69 CALL COMQR(NM,N,IS1,IS2,AR,AI,WR,WI,IERR) 70 GO TO 50 71C .......... FIND BOTH EIGENVALUES AND EIGENVECTORS .......... 72 20 CALL COMQR2(NM,N,IS1,IS2,FV2,FV3,AR,AI,WR,WI,ZR,ZI,IERR) 73 IF (IERR .NE. 0) GO TO 50 74 CALL CBABK2(NM,N,IS1,IS2,FV1,N,ZR,ZI) 75 50 RETURN 76 END 77