htrib3.f 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. *DECK HTRIB3
  2. SUBROUTINE HTRIB3 (NM, N, A, TAU, M, ZR, ZI)
  3. C***BEGIN PROLOGUE HTRIB3
  4. C***PURPOSE Compute the eigenvectors of a complex Hermitian matrix from
  5. C the eigenvectors of a real symmetric tridiagonal matrix
  6. C output from HTRID3.
  7. C***LIBRARY SLATEC (EISPACK)
  8. C***CATEGORY D4C4
  9. C***TYPE SINGLE PRECISION (HTRIB3-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 TRBAK3, 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 HTRID3.
  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, A, ZR, and ZI, as declared in the calling
  27. C program dimension statement. NM is an INTEGER variable.
  28. C
  29. C N is the order of the matrix. N is an INTEGER variable.
  30. C N must be less than or equal to NM.
  31. C
  32. C A contains some information about the unitary transformations
  33. C used in the reduction by HTRID3. A is a two-dimensional
  34. C REAL array, dimensioned A(NM,N).
  35. C
  36. C TAU contains further information about the transformations.
  37. C TAU is a one-dimensional REAL array, dimensioned TAU(2,N).
  38. C
  39. C M is the number of eigenvectors to be back transformed.
  40. C M is an INTEGER variable.
  41. C
  42. C ZR contains the eigenvectors to be back transformed in its
  43. C first M columns. The contents of ZI are immaterial. ZR and
  44. C ZI are two-dimensional REAL arrays, dimensioned ZR(NM,M) and
  45. C ZI(NM,M).
  46. C
  47. C On OUTPUT
  48. C
  49. C ZR and ZI contain the real and imaginary parts, respectively,
  50. C of the transformed eigenvectors in their first M columns.
  51. C
  52. C NOTE that the last component of each returned vector
  53. C is real and that vector Euclidean norms are preserved.
  54. C
  55. C Questions and comments should be directed to B. S. Garbow,
  56. C APPLIED MATHEMATICS DIVISION, ARGONNE NATIONAL LABORATORY
  57. C ------------------------------------------------------------------
  58. C
  59. C***REFERENCES B. T. Smith, J. M. Boyle, J. J. Dongarra, B. S. Garbow,
  60. C Y. Ikebe, V. C. Klema and C. B. Moler, Matrix Eigen-
  61. C system Routines - EISPACK Guide, Springer-Verlag,
  62. C 1976.
  63. C***ROUTINES CALLED (NONE)
  64. C***REVISION HISTORY (YYMMDD)
  65. C 760101 DATE WRITTEN
  66. C 890831 Modified array declarations. (WRB)
  67. C 890831 REVISION DATE from Version 3.2
  68. C 891214 Prologue converted to Version 4.0 format. (BAB)
  69. C 920501 Reformatted the REFERENCES section. (WRB)
  70. C***END PROLOGUE HTRIB3
  71. C
  72. INTEGER I,J,K,L,M,N,NM
  73. REAL A(NM,*),TAU(2,*),ZR(NM,*),ZI(NM,*)
  74. REAL H,S,SI
  75. C
  76. C***FIRST EXECUTABLE STATEMENT HTRIB3
  77. IF (M .EQ. 0) GO TO 200
  78. C .......... TRANSFORM THE EIGENVECTORS OF THE REAL SYMMETRIC
  79. C TRIDIAGONAL MATRIX TO THOSE OF THE HERMITIAN
  80. C TRIDIAGONAL MATRIX. ..........
  81. DO 50 K = 1, N
  82. C
  83. DO 50 J = 1, M
  84. ZI(K,J) = -ZR(K,J) * TAU(2,K)
  85. ZR(K,J) = ZR(K,J) * TAU(1,K)
  86. 50 CONTINUE
  87. C
  88. IF (N .EQ. 1) GO TO 200
  89. C .......... RECOVER AND APPLY THE HOUSEHOLDER MATRICES ..........
  90. DO 140 I = 2, N
  91. L = I - 1
  92. H = A(I,I)
  93. IF (H .EQ. 0.0E0) GO TO 140
  94. C
  95. DO 130 J = 1, M
  96. S = 0.0E0
  97. SI = 0.0E0
  98. C
  99. DO 110 K = 1, L
  100. S = S + A(I,K) * ZR(K,J) - A(K,I) * ZI(K,J)
  101. SI = SI + A(I,K) * ZI(K,J) + A(K,I) * ZR(K,J)
  102. 110 CONTINUE
  103. C .......... DOUBLE DIVISIONS AVOID POSSIBLE UNDERFLOW ..........
  104. S = (S / H) / H
  105. SI = (SI / H) / H
  106. C
  107. DO 120 K = 1, L
  108. ZR(K,J) = ZR(K,J) - S * A(I,K) - SI * A(K,I)
  109. ZI(K,J) = ZI(K,J) - SI * A(I,K) + S * A(K,I)
  110. 120 CONTINUE
  111. C
  112. 130 CONTINUE
  113. C
  114. 140 CONTINUE
  115. C
  116. 200 RETURN
  117. END