| 1 |
subroutine rg(nm,n,a,wr,wi,matz,z,iv1,fv1,ierr) |
| 2 |
c |
| 3 |
integer n,nm,is1,is2,ierr,matz |
| 4 |
double precision a(nm,n),wr(n),wi(n),z(nm,n),fv1(n) |
| 5 |
integer iv1(n) |
| 6 |
c |
| 7 |
c this subroutine calls the recommended sequence of |
| 8 |
c subroutines from the eigensystem subroutine package (eispack) |
| 9 |
c to find the eigenvalues and eigenvectors (if desired) |
| 10 |
c of a real general matrix. |
| 11 |
c |
| 12 |
c on input |
| 13 |
c |
| 14 |
c nm must be set to the row dimension of the two-dimensional |
| 15 |
c array parameters as declared in the calling program |
| 16 |
c dimension statement. |
| 17 |
c |
| 18 |
c n is the order of the matrix a. |
| 19 |
c |
| 20 |
c a contains the real general matrix. |
| 21 |
c |
| 22 |
c matz is an integer variable set equal to zero if |
| 23 |
c only eigenvalues are desired. otherwise it is set to |
| 24 |
c any non-zero integer for both eigenvalues and eigenvectors. |
| 25 |
c |
| 26 |
c on output |
| 27 |
c |
| 28 |
c wr and wi contain the real and imaginary parts, |
| 29 |
c respectively, of the eigenvalues. complex conjugate |
| 30 |
c pairs of eigenvalues appear consecutively with the |
| 31 |
c eigenvalue having the positive imaginary part first. |
| 32 |
c |
| 33 |
c z contains the real and imaginary parts of the eigenvectors |
| 34 |
c if matz is not zero. if the j-th eigenvalue is real, the |
| 35 |
c j-th column of z contains its eigenvector. if the j-th |
| 36 |
c eigenvalue is complex with positive imaginary part, the |
| 37 |
c j-th and (j+1)-th columns of z contain the real and |
| 38 |
c imaginary parts of its eigenvector. the conjugate of this |
| 39 |
c vector is the eigenvector for the conjugate eigenvalue. |
| 40 |
c |
| 41 |
c ierr is an integer output variable set equal to an error |
| 42 |
c completion code described in the documentation for hqr |
| 43 |
c and hqr2. the normal completion code is zero. |
| 44 |
c |
| 45 |
c iv1 and fv1 are temporary storage arrays. |
| 46 |
c |
| 47 |
c questions and comments should be directed to burton s. garbow, |
| 48 |
c mathematics and computer science div, argonne national laboratory |
| 49 |
c |
| 50 |
c this version dated august 1983. |
| 51 |
c |
| 52 |
c ------------------------------------------------------------------ |
| 53 |
c |
| 54 |
if (n .le. nm) go to 10 |
| 55 |
ierr = 10 * n |
| 56 |
go to 50 |
| 57 |
c |
| 58 |
10 call balanc(nm,n,a,is1,is2,fv1) |
| 59 |
call elmhes(nm,n,is1,is2,a,iv1) |
| 60 |
if (matz .ne. 0) go to 20 |
| 61 |
c .......... find eigenvalues only .......... |
| 62 |
call hqr(nm,n,is1,is2,a,wr,wi,ierr) |
| 63 |
go to 50 |
| 64 |
c .......... find both eigenvalues and eigenvectors .......... |
| 65 |
20 call eltran(nm,n,is1,is2,a,iv1,z) |
| 66 |
call hqr2(nm,n,is1,is2,a,wr,wi,z,ierr) |
| 67 |
if (ierr .ne. 0) go to 50 |
| 68 |
call balbak(nm,n,is1,is2,fv1,n,z) |
| 69 |
50 return |
| 70 |
end |