cbabk2.f 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. *DECK CBABK2
  2. SUBROUTINE CBABK2 (NM, N, LOW, IGH, SCALE, M, ZR, ZI)
  3. C***BEGIN PROLOGUE CBABK2
  4. C***PURPOSE Form the eigenvectors of a complex general matrix from the
  5. C eigenvectors of matrix output from CBAL.
  6. C***LIBRARY SLATEC (EISPACK)
  7. C***CATEGORY D4C4
  8. C***TYPE COMPLEX (BALBAK-S, CBABK2-C)
  9. C***KEYWORDS EIGENVECTORS, EISPACK
  10. C***AUTHOR Smith, B. T., et al.
  11. C***DESCRIPTION
  12. C
  13. C This subroutine is a translation of the ALGOL procedure
  14. C CBABK2, which is a complex version of BALBAK,
  15. C NUM. MATH. 13, 293-304(1969) by Parlett and Reinsch.
  16. C HANDBOOK FOR AUTO. COMP., VOL.II-LINEAR ALGEBRA, 315-326(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 balanced matrix determined by CBAL.
  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, ZR and ZI, as declared in the calling
  26. C program dimension statement. NM is an INTEGER variable.
  27. C
  28. C N is the order of the matrix Z=(ZR,ZI). N is an INTEGER
  29. C variable. N must be less than or equal to NM.
  30. C
  31. C LOW and IGH are INTEGER variables determined by CBAL.
  32. C
  33. C SCALE contains information determining the permutations and
  34. C scaling factors used by CBAL. SCALE is a one-dimensional
  35. C REAL array, dimensioned SCALE(N).
  36. C
  37. C M is the number of eigenvectors to be back transformed.
  38. C M is an INTEGER variable.
  39. C
  40. C ZR and ZI contain the real and imaginary parts, respectively,
  41. C of the eigenvectors to be back transformed in their first
  42. C M columns. ZR and ZI are two-dimensional REAL arrays,
  43. C dimensioned ZR(NM,M) and ZI(NM,M).
  44. C
  45. C On OUTPUT
  46. C
  47. C ZR and ZI contain the real and imaginary parts,
  48. C respectively, of the transformed eigenvectors
  49. C in their first M columns.
  50. C
  51. C Questions and comments should be directed to B. S. Garbow,
  52. C APPLIED MATHEMATICS DIVISION, ARGONNE NATIONAL LABORATORY
  53. C ------------------------------------------------------------------
  54. C
  55. C***REFERENCES B. T. Smith, J. M. Boyle, J. J. Dongarra, B. S. Garbow,
  56. C Y. Ikebe, V. C. Klema and C. B. Moler, Matrix Eigen-
  57. C system Routines - EISPACK Guide, Springer-Verlag,
  58. C 1976.
  59. C***ROUTINES CALLED (NONE)
  60. C***REVISION HISTORY (YYMMDD)
  61. C 760101 DATE WRITTEN
  62. C 890831 Modified array declarations. (WRB)
  63. C 890831 REVISION DATE from Version 3.2
  64. C 891214 Prologue converted to Version 4.0 format. (BAB)
  65. C 920501 Reformatted the REFERENCES section. (WRB)
  66. C***END PROLOGUE CBABK2
  67. C
  68. INTEGER I,J,K,M,N,II,NM,IGH,LOW
  69. REAL SCALE(*),ZR(NM,*),ZI(NM,*)
  70. REAL S
  71. C
  72. C***FIRST EXECUTABLE STATEMENT CBABK2
  73. IF (M .EQ. 0) GO TO 200
  74. IF (IGH .EQ. LOW) GO TO 120
  75. C
  76. DO 110 I = LOW, IGH
  77. S = SCALE(I)
  78. C .......... LEFT HAND EIGENVECTORS ARE BACK TRANSFORMED
  79. C IF THE FOREGOING STATEMENT IS REPLACED BY
  80. C S=1.0E0/SCALE(I). ..........
  81. DO 100 J = 1, M
  82. ZR(I,J) = ZR(I,J) * S
  83. ZI(I,J) = ZI(I,J) * S
  84. 100 CONTINUE
  85. C
  86. 110 CONTINUE
  87. C .......... FOR I=LOW-1 STEP -1 UNTIL 1,
  88. C IGH+1 STEP 1 UNTIL N DO -- ..........
  89. 120 DO 140 II = 1, N
  90. I = II
  91. IF (I .GE. LOW .AND. I .LE. IGH) GO TO 140
  92. IF (I .LT. LOW) I = LOW - II
  93. K = SCALE(I)
  94. IF (K .EQ. I) GO TO 140
  95. C
  96. DO 130 J = 1, M
  97. S = ZR(I,J)
  98. ZR(I,J) = ZR(K,J)
  99. ZR(K,J) = S
  100. S = ZI(I,J)
  101. ZI(I,J) = ZI(K,J)
  102. ZI(K,J) = S
  103. 130 CONTINUE
  104. C
  105. 140 CONTINUE
  106. C
  107. 200 RETURN
  108. END