rt.f 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. *DECK RT
  2. SUBROUTINE RT (NM, N, A, W, MATZ, Z, FV1, IERR)
  3. C***BEGIN PROLOGUE RT
  4. C***PURPOSE Compute the eigenvalues and eigenvectors of a special real
  5. C tridiagonal matrix.
  6. C***LIBRARY SLATEC (EISPACK)
  7. C***CATEGORY D4A5
  8. C***TYPE SINGLE PRECISION (RT-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 subroutines
  14. C from the eigensystem subroutine package (EISPACK) to find the
  15. C eigenvalues and eigenvectors (if desired) of a special REAL
  16. C TRIDIAGONAL matrix. The property of the matrix required for use
  17. C of this subroutine is that the products of pairs of corresponding
  18. C off-diagonal elements be all non-negative. If eigenvectors are
  19. C desired, no product can be zero unless both factors are zero.
  20. C
  21. C On Input
  22. C
  23. C NM must be set to the row dimension of the two-dimensional
  24. C array parameter, A and Z, as declared in the calling
  25. C program dimension statement. NM is an INTEGER variable.
  26. C
  27. C N is the order of the matrix A. N is an INTEGER variable.
  28. C N must be less than or equal to NM.
  29. C
  30. C A contains the special real tridiagonal matrix in its first
  31. C three columns. The subdiagonal elements are stored in the
  32. C last N-1 positions of the first column, the diagonal elements
  33. C in the second column, and the superdiagonal elements in the
  34. C first N-1 positions of the third column. Elements A(1,1) and
  35. C A(N,3) are arbitrary. A is a two-dimensional REAL array,
  36. C dimensioned A(NM,3).
  37. C
  38. C MATZ is an INTEGER variable set equal to zero if only
  39. C eigenvalues are desired. Otherwise, it is set to any
  40. C non-zero integer for both eigenvalues and eigenvectors.
  41. C
  42. C On Output
  43. C
  44. C W contains the eigenvalues in ascending order. W is a
  45. C one-dimensional REAL array, dimensioned W(N).
  46. C
  47. C Z contains the eigenvectors if MATZ is not zero. The eigen-
  48. C vectors are not normalized. Z is a two-dimensional REAL
  49. C array, dimensioned Z(NM,N).
  50. C
  51. C IERR is an INTEGER flag set to
  52. C Zero for normal return,
  53. C 10*N if N is greater than NM,
  54. C N+J if A(J,1)*A(J-1,3) is negative,
  55. C 2*N+J if the product is zero with one factor non-zero,
  56. C and MATZ is non-zero;
  57. C J if the J-th eigenvalue has not been
  58. C determined after 30 iterations.
  59. C The eigenvalues and eigenvectors in the W and Z
  60. C arrays should be correct for indices
  61. C 1, 2, ..., IERR-1.
  62. C
  63. C FV1 is a one-dimensional REAL array used for temporary storage,
  64. C dimensioned FV1(N).
  65. C
  66. C Questions and comments should be directed to B. S. Garbow,
  67. C APPLIED MATHEMATICS DIVISION, ARGONNE NATIONAL LABORATORY
  68. C ------------------------------------------------------------------
  69. C
  70. C***REFERENCES B. T. Smith, J. M. Boyle, J. J. Dongarra, B. S. Garbow,
  71. C Y. Ikebe, V. C. Klema and C. B. Moler, Matrix Eigen-
  72. C system Routines - EISPACK Guide, Springer-Verlag,
  73. C 1976.
  74. C***ROUTINES CALLED FIGI, FIGI2, IMTQL1, IMTQL2
  75. C***REVISION HISTORY (YYMMDD)
  76. C 760101 DATE WRITTEN
  77. C 890831 Modified array declarations. (WRB)
  78. C 890831 REVISION DATE from Version 3.2
  79. C 891214 Prologue converted to Version 4.0 format. (BAB)
  80. C 920501 Reformatted the REFERENCES section. (WRB)
  81. C***END PROLOGUE RT
  82. C
  83. INTEGER N,NM,IERR,MATZ
  84. REAL A(NM,3),W(*),Z(NM,*),FV1(*)
  85. C
  86. C***FIRST EXECUTABLE STATEMENT RT
  87. IF (N .LE. NM) GO TO 10
  88. IERR = 10 * N
  89. GO TO 50
  90. C
  91. 10 IF (MATZ .NE. 0) GO TO 20
  92. C .......... FIND EIGENVALUES ONLY ..........
  93. CALL FIGI(NM,N,A,W,FV1,FV1,IERR)
  94. IF (IERR .GT. 0) GO TO 50
  95. CALL IMTQL1(N,W,FV1,IERR)
  96. GO TO 50
  97. C .......... FIND BOTH EIGENVALUES AND EIGENVECTORS ..........
  98. 20 CALL FIGI2(NM,N,A,W,FV1,Z,IERR)
  99. IF (IERR .NE. 0) GO TO 50
  100. CALL IMTQL2(NM,N,W,FV1,Z,IERR)
  101. 50 RETURN
  102. END