rgg.f 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. *DECK RGG
  2. SUBROUTINE RGG (NM, N, A, B, ALFR, ALFI, BETA, MATZ, Z, IERR)
  3. C***BEGIN PROLOGUE RGG
  4. C***PURPOSE Compute the eigenvalues and eigenvectors for a real
  5. C generalized eigenproblem.
  6. C***LIBRARY SLATEC (EISPACK)
  7. C***CATEGORY D4B2
  8. C***TYPE SINGLE PRECISION (RGG-S)
  9. C***KEYWORDS EIGENVALUES, EIGENVECTORS, EISPACK
  10. C***AUTHOR Smith, B. T., et al.
  11. C***DESCRIPTION
  12. C
  13. C This subroutine calls the recommended sequence of
  14. C subroutines from the eigensystem subroutine package (EISPACK)
  15. C to find the eigenvalues and eigenvectors (if desired)
  16. C for the REAL GENERAL GENERALIZED eigenproblem Ax = (LAMBDA)Bx.
  17. C
  18. C On Input
  19. C
  20. C NM must be set to the row dimension of the two-dimensional
  21. C array parameters, A, B, and Z, as declared in the calling
  22. C program dimension statement. NM is an INTEGER variable.
  23. C
  24. C N is the order of the matrices A and B. N is an INTEGER
  25. C variable. N must be less than or equal to NM.
  26. C
  27. C A contains a real general matrix. A is a two-dimensional
  28. C REAL array, dimensioned A(NM,N).
  29. C
  30. C B contains a real general matrix. B is a two-dimensional
  31. C REAL array, dimensioned B(NM,N).
  32. C
  33. C MATZ is an INTEGER variable set equal to zero if only
  34. C eigenvalues are desired. Otherwise, it is set to any
  35. C non-zero integer for both eigenvalues and eigenvectors.
  36. C
  37. C On Output
  38. C
  39. C A and B have been destroyed.
  40. C
  41. C ALFR and ALFI contain the real and imaginary parts,
  42. C respectively, of the numerators of the eigenvalues.
  43. C ALFR and ALFI are one-dimensional REAL arrays,
  44. C dimensioned ALFR(N) and ALFI(N).
  45. C
  46. C BETA contains the denominators of the eigenvalues,
  47. C which are thus given by the ratios (ALFR+I*ALFI)/BETA.
  48. C Complex conjugate pairs of eigenvalues appear consecutively
  49. C with the eigenvalue having the positive imaginary part first.
  50. C BETA is a one-dimensional REAL array, dimensioned BETA(N).
  51. C
  52. C Z contains the real and imaginary parts of the eigenvectors
  53. C if MATZ is not zero. If the J-th eigenvalue is real, the
  54. C J-th column of Z contains its eigenvector. If the J-th
  55. C eigenvalue is complex with positive imaginary part, the
  56. C J-th and (J+1)-th columns of Z contain the real and
  57. C imaginary parts of its eigenvector. The conjugate of this
  58. C vector is the eigenvector for the conjugate eigenvalue.
  59. C Z is a two-dimensional REAL array, dimensioned Z(NM,N).
  60. C
  61. C IERR is an INTEGER flag set to
  62. C Zero for normal return,
  63. C 10*N if N is greater than NM,
  64. C J if the J-th eigenvalue has not been
  65. C determined after a total of 30*N iterations.
  66. C The eigenvalues should be correct for indices
  67. C IERR+1, IERR+2, ..., N, but no eigenvectors are
  68. C computed.
  69. C
  70. C Questions and comments should be directed to B. S. Garbow,
  71. C APPLIED MATHEMATICS DIVISION, ARGONNE NATIONAL LABORATORY
  72. C ------------------------------------------------------------------
  73. C
  74. C***REFERENCES B. T. Smith, J. M. Boyle, J. J. Dongarra, B. S. Garbow,
  75. C Y. Ikebe, V. C. Klema and C. B. Moler, Matrix Eigen-
  76. C system Routines - EISPACK Guide, Springer-Verlag,
  77. C 1976.
  78. C***ROUTINES CALLED QZHES, QZIT, QZVAL, QZVEC
  79. C***REVISION HISTORY (YYMMDD)
  80. C 760101 DATE WRITTEN
  81. C 890831 Modified array declarations. (WRB)
  82. C 890831 REVISION DATE from Version 3.2
  83. C 891214 Prologue converted to Version 4.0 format. (BAB)
  84. C 920501 Reformatted the REFERENCES section. (WRB)
  85. C***END PROLOGUE RGG
  86. C
  87. INTEGER N,NM,IERR,MATZ
  88. REAL A(NM,*),B(NM,*),ALFR(*),ALFI(*),BETA(*),Z(NM,*)
  89. LOGICAL TF
  90. C
  91. C***FIRST EXECUTABLE STATEMENT RGG
  92. IF (N .LE. NM) GO TO 10
  93. IERR = 10 * N
  94. GO TO 50
  95. C
  96. 10 IF (MATZ .NE. 0) GO TO 20
  97. C .......... FIND EIGENVALUES ONLY ..........
  98. TF = .FALSE.
  99. CALL QZHES(NM,N,A,B,TF,Z)
  100. CALL QZIT(NM,N,A,B,0.0E0,TF,Z,IERR)
  101. CALL QZVAL(NM,N,A,B,ALFR,ALFI,BETA,TF,Z)
  102. GO TO 50
  103. C .......... FIND BOTH EIGENVALUES AND EIGENVECTORS ..........
  104. 20 TF = .TRUE.
  105. CALL QZHES(NM,N,A,B,TF,Z)
  106. CALL QZIT(NM,N,A,B,0.0E0,TF,Z,IERR)
  107. CALL QZVAL(NM,N,A,B,ALFR,ALFI,BETA,TF,Z)
  108. IF (IERR .NE. 0) GO TO 50
  109. CALL QZVEC(NM,N,A,B,ALFR,ALFI,BETA,Z)
  110. 50 RETURN
  111. END