htribk.f 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. *DECK HTRIBK
  2. SUBROUTINE HTRIBK (NM, N, AR, AI, TAU, M, ZR, ZI)
  3. C***BEGIN PROLOGUE HTRIBK
  4. C***PURPOSE Form the eigenvectors of a complex Hermitian matrix from
  5. C the eigenvectors of a real symmetric tridiagonal matrix
  6. C output from HTRIDI.
  7. C***LIBRARY SLATEC (EISPACK)
  8. C***CATEGORY D4C4
  9. C***TYPE SINGLE PRECISION (HTRIBK-S)
  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 a complex analogue of
  15. C the ALGOL procedure TRBAK1, NUM. MATH. 11, 181-195(1968)
  16. C by Martin, Reinsch, and Wilkinson.
  17. C HANDBOOK FOR AUTO. COMP., VOL.II-LINEAR ALGEBRA, 212-226(1971).
  18. C
  19. C This subroutine forms the eigenvectors of a COMPLEX HERMITIAN
  20. C matrix by back transforming those of the corresponding
  21. C real symmetric tridiagonal matrix determined by HTRIDI.
  22. C
  23. C On INPUT
  24. C
  25. C NM must be set to the row dimension of the two-dimensional
  26. C array parameters, AR, AI, ZR, and ZI, as declared in the
  27. C calling program dimension statement. NM is an INTEGER
  28. C variable.
  29. C
  30. C N is the order of the matrix. N is an INTEGER variable.
  31. C N must be less than or equal to NM.
  32. C
  33. C AR and AI contain some information about the unitary
  34. C transformations used in the reduction by HTRIDI in the
  35. C strict lower triangle of AR and the full lower triangle of
  36. C AI. The remaining upper parts of the matrices are arbitrary.
  37. C AR and AI are two-dimensional REAL arrays, dimensioned
  38. C AR(NM,N) and AI(NM,N).
  39. C
  40. C TAU contains further information about the transformations.
  41. C TAU is a one-dimensional REAL array, dimensioned TAU(2,N).
  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 contains the eigenvectors to be back transformed in its first
  47. C M columns. The contents of ZI are immaterial. ZR and ZI are
  48. C two-dimensional REAL arrays, dimensioned ZR(NM,M) and
  49. C 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 Note that the last component of each returned vector
  57. C is real and that vector Euclidean norms are preserved.
  58. C
  59. C Questions and comments should be directed to B. S. Garbow,
  60. C APPLIED MATHEMATICS DIVISION, ARGONNE NATIONAL LABORATORY
  61. C ------------------------------------------------------------------
  62. C
  63. C***REFERENCES B. T. Smith, J. M. Boyle, J. J. Dongarra, B. S. Garbow,
  64. C Y. Ikebe, V. C. Klema and C. B. Moler, Matrix Eigen-
  65. C system Routines - EISPACK Guide, Springer-Verlag,
  66. C 1976.
  67. C***ROUTINES CALLED (NONE)
  68. C***REVISION HISTORY (YYMMDD)
  69. C 760101 DATE WRITTEN
  70. C 890831 Modified array declarations. (WRB)
  71. C 890831 REVISION DATE from Version 3.2
  72. C 891214 Prologue converted to Version 4.0 format. (BAB)
  73. C 920501 Reformatted the REFERENCES section. (WRB)
  74. C***END PROLOGUE HTRIBK
  75. C
  76. INTEGER I,J,K,L,M,N,NM
  77. REAL AR(NM,*),AI(NM,*),TAU(2,*),ZR(NM,*),ZI(NM,*)
  78. REAL H,S,SI
  79. C
  80. C***FIRST EXECUTABLE STATEMENT HTRIBK
  81. IF (M .EQ. 0) GO TO 200
  82. C .......... TRANSFORM THE EIGENVECTORS OF THE REAL SYMMETRIC
  83. C TRIDIAGONAL MATRIX TO THOSE OF THE HERMITIAN
  84. C TRIDIAGONAL MATRIX. ..........
  85. DO 50 K = 1, N
  86. C
  87. DO 50 J = 1, M
  88. ZI(K,J) = -ZR(K,J) * TAU(2,K)
  89. ZR(K,J) = ZR(K,J) * TAU(1,K)
  90. 50 CONTINUE
  91. C
  92. IF (N .EQ. 1) GO TO 200
  93. C .......... RECOVER AND APPLY THE HOUSEHOLDER MATRICES ..........
  94. DO 140 I = 2, N
  95. L = I - 1
  96. H = AI(I,I)
  97. IF (H .EQ. 0.0E0) GO TO 140
  98. C
  99. DO 130 J = 1, M
  100. S = 0.0E0
  101. SI = 0.0E0
  102. C
  103. DO 110 K = 1, L
  104. S = S + AR(I,K) * ZR(K,J) - AI(I,K) * ZI(K,J)
  105. SI = SI + AR(I,K) * ZI(K,J) + AI(I,K) * ZR(K,J)
  106. 110 CONTINUE
  107. C .......... DOUBLE DIVISIONS AVOID POSSIBLE UNDERFLOW ..........
  108. S = (S / H) / H
  109. SI = (SI / H) / H
  110. C
  111. DO 120 K = 1, L
  112. ZR(K,J) = ZR(K,J) - S * AR(I,K) - SI * AI(I,K)
  113. ZI(K,J) = ZI(K,J) - SI * AR(I,K) + S * AI(I,K)
  114. 120 CONTINUE
  115. C
  116. 130 CONTINUE
  117. C
  118. 140 CONTINUE
  119. C
  120. 200 RETURN
  121. END