balbak.f 3.4 KB

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