trbak1.f 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. *DECK TRBAK1
  2. SUBROUTINE TRBAK1 (NM, N, A, E, M, Z)
  3. C***BEGIN PROLOGUE TRBAK1
  4. C***PURPOSE Form the eigenvectors of real symmetric matrix from
  5. C the eigenvectors of a symmetric tridiagonal matrix formed
  6. C by TRED1.
  7. C***LIBRARY SLATEC (EISPACK)
  8. C***CATEGORY D4C4
  9. C***TYPE SINGLE PRECISION (TRBAK1-S)
  10. C***KEYWORDS EIGENVECTORS OF A REAL SYMMETRIC MATRIX, 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 TRBAK1,
  15. C NUM. MATH. 11, 181-195(1968) by Martin, Reinsch, and Wilkinson.
  16. C HANDBOOK FOR AUTO. COMP., VOL.II-LINEAR ALGEBRA, 212-226(1971).
  17. C
  18. C This subroutine forms the eigenvectors of a REAL SYMMETRIC
  19. C matrix by back transforming those of the corresponding
  20. C symmetric tridiagonal matrix determined by TRED1.
  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 N is the order of the matrix. N is an INTEGER variable.
  29. C N must be less than or equal to NM.
  30. C
  31. C A contains information about the orthogonal transformations
  32. C used in the reduction by TRED1 in its strict lower
  33. C triangle. A is a two-dimensional REAL array, dimensioned
  34. C A(NM,N).
  35. C
  36. C E contains the subdiagonal elements of the tridiagonal matrix
  37. C in its last N-1 positions. E(1) is arbitrary. These
  38. C elements provide the remaining information about the
  39. C orthogonal transformations. E is a one-dimensional REAL
  40. C array, dimensioned E(N).
  41. C
  42. C M is the number of columns of Z to be back transformed.
  43. C M is an INTEGER variable.
  44. C
  45. C Z contains the eigenvectors to be back transformed in its
  46. C first M columns. Z is a two-dimensional REAL array,
  47. C dimensioned Z(NM,M).
  48. C
  49. C On Output
  50. C
  51. C Z contains the transformed eigenvectors in its first M columns.
  52. C
  53. C Note that TRBAK1 preserves vector Euclidean norms.
  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 TRBAK1
  71. C
  72. INTEGER I,J,K,L,M,N,NM
  73. REAL A(NM,*),E(*),Z(NM,*)
  74. REAL S
  75. C
  76. C***FIRST EXECUTABLE STATEMENT TRBAK1
  77. IF (M .EQ. 0) GO TO 200
  78. IF (N .EQ. 1) GO TO 200
  79. C
  80. DO 140 I = 2, N
  81. L = I - 1
  82. IF (E(I) .EQ. 0.0E0) GO TO 140
  83. C
  84. DO 130 J = 1, M
  85. S = 0.0E0
  86. C
  87. DO 110 K = 1, L
  88. 110 S = S + A(I,K) * Z(K,J)
  89. C .......... DIVISOR BELOW IS NEGATIVE OF H FORMED IN TRED1.
  90. C DOUBLE DIVISION AVOIDS POSSIBLE UNDERFLOW ..........
  91. S = (S / A(I,L)) / E(I)
  92. C
  93. DO 120 K = 1, L
  94. 120 Z(K,J) = Z(K,J) + S * A(I,K)
  95. C
  96. 130 CONTINUE
  97. C
  98. 140 CONTINUE
  99. C
  100. 200 RETURN
  101. END