combak.f 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. *DECK COMBAK
  2. SUBROUTINE COMBAK (NM, LOW, IGH, AR, AI, INT, M, ZR, ZI)
  3. C***BEGIN PROLOGUE COMBAK
  4. C***PURPOSE Form the eigenvectors of a complex general matrix from the
  5. C eigenvectors of a upper Hessenberg matrix output from
  6. C COMHES.
  7. C***LIBRARY SLATEC (EISPACK)
  8. C***CATEGORY D4C4
  9. C***TYPE COMPLEX (ELMBAK-S, COMBAK-C)
  10. C***KEYWORDS EIGENVALUES, EIGENVECTORS, EISPACK
  11. C***AUTHOR Smith, B. T., et al.
  12. C***DESCRIPTION
  13. C
  14. C This subroutine is a translation of the ALGOL procedure COMBAK,
  15. C NUM. MATH. 12, 349-368(1968) by Martin and Wilkinson.
  16. C HANDBOOK FOR AUTO. COMP., VOL.II-LINEAR ALGEBRA, 339-358(1971).
  17. C
  18. C This subroutine forms the eigenvectors of a COMPLEX GENERAL
  19. C matrix by back transforming those of the corresponding
  20. C upper Hessenberg matrix determined by COMHES.
  21. C
  22. C On INPUT
  23. C
  24. C NM must be set to the row dimension of the two-dimensional
  25. C array parameters, AR, AI, ZR and ZI, as declared in the
  26. C calling program dimension statement. NM is an INTEGER
  27. C variable.
  28. C
  29. C LOW and IGH are two INTEGER variables determined by the
  30. C balancing subroutine CBAL. If CBAL has not been used,
  31. C set LOW=1 and IGH equal to the order of the matrix.
  32. C
  33. C AR and AI contain the multipliers which were used in the
  34. C reduction by COMHES in their lower triangles below
  35. C the subdiagonal. AR and AI are two-dimensional REAL
  36. C arrays, dimensioned AR(NM,IGH) and AI(NM,IGH).
  37. C
  38. C INT contains information on the rows and columns
  39. C interchanged in the reduction by COMHES. Only
  40. C elements LOW through IGH are used. INT is a
  41. C one-dimensional INTEGER array, dimensioned INT(IGH).
  42. C
  43. C M is the number of eigenvectors to be back transformed.
  44. C M is an INTEGER variable.
  45. C
  46. C ZR and ZI contain the real and imaginary parts, respectively,
  47. C of the eigenvectors to be back transformed in their first M
  48. C columns. ZR and ZI are two-dimensional REAL arrays,
  49. C dimensioned ZR(NM,M) and ZI(NM,M).
  50. C
  51. C On OUTPUT
  52. C
  53. C ZR and ZI contain the real and imaginary parts, respectively,
  54. C of the transformed eigenvectors in their first M columns.
  55. C
  56. C Questions and comments should be directed to B. S. Garbow,
  57. C APPLIED MATHEMATICS DIVISION, ARGONNE NATIONAL LABORATORY
  58. C ------------------------------------------------------------------
  59. C
  60. C***REFERENCES B. T. Smith, J. M. Boyle, J. J. Dongarra, B. S. Garbow,
  61. C Y. Ikebe, V. C. Klema and C. B. Moler, Matrix Eigen-
  62. C system Routines - EISPACK Guide, Springer-Verlag,
  63. C 1976.
  64. C***ROUTINES CALLED (NONE)
  65. C***REVISION HISTORY (YYMMDD)
  66. C 760101 DATE WRITTEN
  67. C 890831 Modified array declarations. (WRB)
  68. C 890831 REVISION DATE from Version 3.2
  69. C 891214 Prologue converted to Version 4.0 format. (BAB)
  70. C 920501 Reformatted the REFERENCES section. (WRB)
  71. C***END PROLOGUE COMBAK
  72. C
  73. INTEGER I,J,M,LA,MM,MP,NM,IGH,KP1,LOW,MP1
  74. REAL AR(NM,*),AI(NM,*),ZR(NM,*),ZI(NM,*)
  75. REAL XR,XI
  76. INTEGER INT(*)
  77. C
  78. C***FIRST EXECUTABLE STATEMENT COMBAK
  79. IF (M .EQ. 0) GO TO 200
  80. LA = IGH - 1
  81. KP1 = LOW + 1
  82. IF (LA .LT. KP1) GO TO 200
  83. C .......... FOR MP=IGH-1 STEP -1 UNTIL LOW+1 DO -- ..........
  84. DO 140 MM = KP1, LA
  85. MP = LOW + IGH - MM
  86. MP1 = MP + 1
  87. C
  88. DO 110 I = MP1, IGH
  89. XR = AR(I,MP-1)
  90. XI = AI(I,MP-1)
  91. IF (XR .EQ. 0.0E0 .AND. XI .EQ. 0.0E0) GO TO 110
  92. C
  93. DO 100 J = 1, M
  94. ZR(I,J) = ZR(I,J) + XR * ZR(MP,J) - XI * ZI(MP,J)
  95. ZI(I,J) = ZI(I,J) + XR * ZI(MP,J) + XI * ZR(MP,J)
  96. 100 CONTINUE
  97. C
  98. 110 CONTINUE
  99. C
  100. I = INT(MP)
  101. IF (I .EQ. MP) GO TO 140
  102. C
  103. DO 130 J = 1, M
  104. XR = ZR(I,J)
  105. ZR(I,J) = ZR(MP,J)
  106. ZR(MP,J) = XR
  107. XI = ZI(I,J)
  108. ZI(I,J) = ZI(MP,J)
  109. ZI(MP,J) = XI
  110. 130 CONTINUE
  111. C
  112. 140 CONTINUE
  113. C
  114. 200 RETURN
  115. END