home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Geek Gadgets 1
/
ADE-1.bin
/
ade-dist
/
eispack-1.0-src.tgz
/
tar.out
/
contrib
/
eispack
/
tests
/
rg.f
< prev
next >
Wrap
Text File
|
1996-09-28
|
3KB
|
78 lines
SUBROUTINE RG(NM,N,A,WR,WI,MATZ,Z,IV1,FV1,IERR)
C
INTEGER N,NM,IS1,IS2,IERR,MATZ
DOUBLE PRECISION A(NM,N),WR(N),WI(N),Z(NM,N),FV1(N)
INTEGER IV1(N)
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 ------------------------------------------------------------------
C
write(6,*)' in rg'
IF (N .LE. NM) GO TO 10
IERR = 10 * N
GO TO 50
C
10 continue
write(6,*)' call balanc'
CALL BALANC(NM,N,A,IS1,IS2,FV1)
write(6,*)'call elmhes'
CALL ELMHES(NM,N,IS1,IS2,A,IV1)
IF (MATZ .NE. 0) GO TO 20
C .......... FIND EIGENVALUES ONLY ..........
write(6,*)' call hqr'
CALL HQR(NM,N,IS1,IS2,A,WR,WI,IERR)
GO TO 50
C .......... FIND BOTH EIGENVALUES AND EIGENVECTORS ..........
20 continue
write(6,*)'call eltran'
CALL ELTRAN(NM,N,IS1,IS2,A,IV1,Z)
write(6,*)' call hqr2'
CALL HQR2(NM,N,IS1,IS2,A,WR,WI,Z,IERR)
IF (IERR .NE. 0) GO TO 50
write(6,*)' call balbak'
CALL BALBAK(NM,N,IS1,IS2,FV1,N,Z)
50 RETURN
END