elmbak.f 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. *DECK ELMBAK
  2. SUBROUTINE ELMBAK (NM, LOW, IGH, A, INT, M, Z)
  3. C***BEGIN PROLOGUE ELMBAK
  4. C***PURPOSE Form the eigenvectors of a real general matrix from the
  5. C eigenvectors of the upper Hessenberg matrix output from
  6. C ELMHES.
  7. C***LIBRARY SLATEC (EISPACK)
  8. C***CATEGORY D4C4
  9. C***TYPE SINGLE PRECISION (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 ELMBAK,
  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 REAL GENERAL
  19. C matrix by back transforming those of the corresponding
  20. C upper Hessenberg matrix determined by ELMHES.
  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, A and Z, as declared in the calling
  26. C program dimension statement. NM is an INTEGER variable.
  27. C
  28. C LOW and IGH are two INTEGER variables determined by the
  29. C balancing subroutine BALANC. If BALANC has not been
  30. C used, set LOW=1 and IGH equal to the order of the matrix.
  31. C
  32. C A contains the multipliers which were used in the reduction
  33. C by ELMHES in its lower triangle below the subdiagonal.
  34. C A is a two-dimensional REAL array, dimensioned A(NM,IGH).
  35. C
  36. C INT contains information on the rows and columns interchanged
  37. C in the reduction by ELMHES. Only elements LOW through IGH
  38. C are used. INT is a one-dimensional INTEGER array,
  39. C dimensioned INT(IGH).
  40. C
  41. C M is the number of columns of Z to be back transformed.
  42. C M is an INTEGER variable.
  43. C
  44. C Z contains the real and imaginary parts of the eigenvectors
  45. C to be back transformed in its first M columns. Z is a
  46. C two-dimensional REAL array, dimensioned Z(NM,M).
  47. C
  48. C On OUTPUT
  49. C
  50. C Z contains the real and imaginary parts of the transformed
  51. C eigenvectors in its first M columns.
  52. C
  53. C Questions and comments should be directed to B. S. Garbow,
  54. C APPLIED MATHEMATICS DIVISION, ARGONNE NATIONAL LABORATORY
  55. C ------------------------------------------------------------------
  56. C
  57. C***REFERENCES B. T. Smith, J. M. Boyle, J. J. Dongarra, B. S. Garbow,
  58. C Y. Ikebe, V. C. Klema and C. B. Moler, Matrix Eigen-
  59. C system Routines - EISPACK Guide, Springer-Verlag,
  60. C 1976.
  61. C***ROUTINES CALLED (NONE)
  62. C***REVISION HISTORY (YYMMDD)
  63. C 760101 DATE WRITTEN
  64. C 890831 Modified array declarations. (WRB)
  65. C 890831 REVISION DATE from Version 3.2
  66. C 891214 Prologue converted to Version 4.0 format. (BAB)
  67. C 920501 Reformatted the REFERENCES section. (WRB)
  68. C***END PROLOGUE ELMBAK
  69. C
  70. INTEGER I,J,M,LA,MM,MP,NM,IGH,KP1,LOW,MP1
  71. REAL A(NM,*),Z(NM,*)
  72. REAL X
  73. INTEGER INT(*)
  74. C
  75. C***FIRST EXECUTABLE STATEMENT ELMBAK
  76. IF (M .EQ. 0) GO TO 200
  77. LA = IGH - 1
  78. KP1 = LOW + 1
  79. IF (LA .LT. KP1) GO TO 200
  80. C .......... FOR MP=IGH-1 STEP -1 UNTIL LOW+1 DO -- ..........
  81. DO 140 MM = KP1, LA
  82. MP = LOW + IGH - MM
  83. MP1 = MP + 1
  84. C
  85. DO 110 I = MP1, IGH
  86. X = A(I,MP-1)
  87. IF (X .EQ. 0.0E0) GO TO 110
  88. C
  89. DO 100 J = 1, M
  90. 100 Z(I,J) = Z(I,J) + X * Z(MP,J)
  91. C
  92. 110 CONTINUE
  93. C
  94. I = INT(MP)
  95. IF (I .EQ. MP) GO TO 140
  96. C
  97. DO 130 J = 1, M
  98. X = Z(I,J)
  99. Z(I,J) = Z(MP,J)
  100. Z(MP,J) = X
  101. 130 CONTINUE
  102. C
  103. 140 CONTINUE
  104. C
  105. 200 RETURN
  106. END