rst.f 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. *DECK RST
  2. SUBROUTINE RST (NM, N, W, E, MATZ, Z, IERR)
  3. C***BEGIN PROLOGUE RST
  4. C***PURPOSE Compute the eigenvalues and, optionally, the eigenvectors
  5. C of a real symmetric tridiagonal matrix.
  6. C***LIBRARY SLATEC (EISPACK)
  7. C***CATEGORY D4A5
  8. C***TYPE SINGLE PRECISION (RST-S)
  9. C***KEYWORDS EIGENVALUES, EIGENVECTORS, EISPACK
  10. C***AUTHOR Smith, B. T., et al.
  11. C***DESCRIPTION
  12. C
  13. C This subroutine calls the recommended sequence of
  14. C subroutines from the eigensystem subroutine package (EISPACK)
  15. C to find the eigenvalues and eigenvectors (if desired)
  16. C of a REAL SYMMETRIC TRIDIAGONAL matrix.
  17. C
  18. C On Input
  19. C
  20. C NM must be set to the row dimension of the two-dimensional
  21. C array parameter, Z, as declared in the calling program
  22. C dimension statement. NM is an INTEGER variable.
  23. C
  24. C N is the order of the matrix. N is an INTEGER variable.
  25. C N must be less than or equal to NM.
  26. C
  27. C W contains the diagonal elements of the real symmetric
  28. C tridiagonal matrix. W is a one-dimensional REAL array,
  29. C dimensioned W(N).
  30. C
  31. C E contains the subdiagonal elements of the matrix in its last
  32. C N-1 positions. E(1) is arbitrary. E is a one-dimensional
  33. C REAL array, dimensioned E(N).
  34. C
  35. C MATZ is an INTEGER variable set equal to zero if only
  36. C eigenvalues are desired. Otherwise, it is set to any
  37. C non-zero integer for both eigenvalues and eigenvectors.
  38. C
  39. C On Output
  40. C
  41. C W contains the eigenvalues in ascending order.
  42. C
  43. C Z contains the eigenvectors if MATZ is not zero. The eigen-
  44. C vectors are orthonormal. Z is a two-dimensional REAL array,
  45. C dimensioned Z(NM,N).
  46. C
  47. C IERR is an INTEGER flag set to
  48. C Zero for normal return,
  49. C 10*N if N is greater than NM,
  50. C J if the J-th eigenvalue has not been
  51. C determined after 30 iterations.
  52. C The eigenvalues and eigenvectors in the W and Z
  53. C arrays should be correct for indices
  54. C 1, 2, ..., IERR-1.
  55. C
  56. C Questions and comments should be directed to B. S. Garbow,
  57. C APPLIED MATHEMATICS DIVISION, ARGONNE NATIONAL LABORATORY
  58. C ------------------------------------------------------------------
  59. C
  60. C***REFERENCES B. T. Smith, J. M. Boyle, J. J. Dongarra, B. S. Garbow,
  61. C Y. Ikebe, V. C. Klema and C. B. Moler, Matrix Eigen-
  62. C system Routines - EISPACK Guide, Springer-Verlag,
  63. C 1976.
  64. C***ROUTINES CALLED IMTQL1, IMTQL2
  65. C***REVISION HISTORY (YYMMDD)
  66. C 760101 DATE WRITTEN
  67. C 890831 Modified array declarations. (WRB)
  68. C 890831 REVISION DATE from Version 3.2
  69. C 891214 Prologue converted to Version 4.0 format. (BAB)
  70. C 920501 Reformatted the REFERENCES section. (WRB)
  71. C***END PROLOGUE RST
  72. C
  73. INTEGER I,J,N,NM,IERR,MATZ
  74. REAL W(*),E(*),Z(NM,*)
  75. C
  76. C***FIRST EXECUTABLE STATEMENT RST
  77. IF (N .LE. NM) GO TO 10
  78. IERR = 10 * N
  79. GO TO 50
  80. C
  81. 10 IF (MATZ .NE. 0) GO TO 20
  82. C .......... FIND EIGENVALUES ONLY ..........
  83. CALL IMTQL1(N,W,E,IERR)
  84. GO TO 50
  85. C .......... FIND BOTH EIGENVALUES AND EIGENVECTORS ..........
  86. 20 DO 40 I = 1, N
  87. C
  88. DO 30 J = 1, N
  89. Z(J,I) = 0.0E0
  90. 30 CONTINUE
  91. C
  92. Z(I,I) = 1.0E0
  93. 40 CONTINUE
  94. C
  95. CALL IMTQL2(NM,N,W,E,Z,IERR)
  96. 50 RETURN
  97. END