rsb.f 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. *DECK RSB
  2. SUBROUTINE RSB (NM, N, MB, A, W, MATZ, Z, FV1, FV2, IERR)
  3. C***BEGIN PROLOGUE RSB
  4. C***PURPOSE Compute the eigenvalues and, optionally, the eigenvectors
  5. C of a symmetric band matrix.
  6. C***LIBRARY SLATEC (EISPACK)
  7. C***CATEGORY D4A6
  8. C***TYPE SINGLE PRECISION (RSB-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 BAND 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 parameters, A and Z, as declared in the calling
  22. C program dimension statement. NM is an INTEGER variable.
  23. C
  24. C N is the order of the matrix A. N is an INTEGER variable.
  25. C N must be less than or equal to NM.
  26. C
  27. C MB is the half band width of the matrix, defined as the
  28. C number of adjacent diagonals, including the principal
  29. C diagonal, required to specify the non-zero portion of the
  30. C lower triangle of the matrix. MB must be less than or
  31. C equal to N. MB is an INTEGER variable.
  32. C
  33. C A contains the lower triangle of the real symmetric band
  34. C matrix. Its lowest subdiagonal is stored in the last
  35. C N+1-MB positions of the first column, its next subdiagonal
  36. C in the last N+2-MB positions of the second column, further
  37. C subdiagonals similarly, and finally its principal diagonal
  38. C in the N positions of the last column. Contents of storage
  39. C locations not part of the matrix are arbitrary. A is a
  40. C two-dimensional REAL array, dimensioned A(NM,MB).
  41. C
  42. C MATZ is an INTEGER variable set equal to zero if only
  43. C eigenvalues are desired. Otherwise, it is set to any
  44. C non-zero integer for both eigenvalues and eigenvectors.
  45. C
  46. C On Output
  47. C
  48. C A has been destroyed.
  49. C
  50. C W contains the eigenvalues in ascending order. W is a one-
  51. C dimensional REAL array, dimensioned W(N).
  52. C
  53. C Z contains the eigenvectors if MATZ is not zero. The
  54. C eigenvectors are orthonormal. Z is a two-dimensional
  55. C REAL array, dimensioned Z(NM,N).
  56. C
  57. C IERR is an INTEGER flag set to
  58. C Zero for normal return,
  59. C 10*N if N is greater than NM,
  60. C 12*N if MB is either non-positive or greater than N,
  61. C J if the J-th eigenvalue has not been
  62. C determined after 30 iterations.
  63. C The eigenvalues and eigenvectors, if requested,
  64. C should be correct for indices 1, 2, ..., IERR-1.
  65. C
  66. C FV1 and FV2 are one-dimensional REAL arrays used for temporary
  67. C storage, dimensioned FV1(N) and FV2(N).
  68. C
  69. C Questions and comments should be directed to B. S. Garbow,
  70. C APPLIED MATHEMATICS DIVISION, ARGONNE NATIONAL LABORATORY
  71. C ------------------------------------------------------------------
  72. C
  73. C***REFERENCES B. T. Smith, J. M. Boyle, J. J. Dongarra, B. S. Garbow,
  74. C Y. Ikebe, V. C. Klema and C. B. Moler, Matrix Eigen-
  75. C system Routines - EISPACK Guide, Springer-Verlag,
  76. C 1976.
  77. C***ROUTINES CALLED BANDR, TQL2, TQLRAT
  78. C***REVISION HISTORY (YYMMDD)
  79. C 760101 DATE WRITTEN
  80. C 890831 Modified array declarations. (WRB)
  81. C 890831 REVISION DATE from Version 3.2
  82. C 891214 Prologue converted to Version 4.0 format. (BAB)
  83. C 920501 Reformatted the REFERENCES section. (WRB)
  84. C***END PROLOGUE RSB
  85. C
  86. INTEGER N,MB,NM,IERR,MATZ
  87. REAL A(NM,*),W(*),Z(NM,*),FV1(*),FV2(*)
  88. LOGICAL TF
  89. C
  90. C***FIRST EXECUTABLE STATEMENT RSB
  91. IF (N .LE. NM) GO TO 5
  92. IERR = 10 * N
  93. GO TO 50
  94. 5 IF (MB .GT. 0) GO TO 10
  95. IERR = 12 * N
  96. GO TO 50
  97. 10 IF (MB .LE. N) GO TO 15
  98. IERR = 12 * N
  99. GO TO 50
  100. C
  101. 15 IF (MATZ .NE. 0) GO TO 20
  102. C .......... FIND EIGENVALUES ONLY ..........
  103. TF = .FALSE.
  104. CALL BANDR(NM,N,MB,A,W,FV1,FV2,TF,Z)
  105. CALL TQLRAT(N,W,FV2,IERR)
  106. GO TO 50
  107. C .......... FIND BOTH EIGENVALUES AND EIGENVECTORS ..........
  108. 20 TF = .TRUE.
  109. CALL BANDR(NM,N,MB,A,W,FV1,FV1,TF,Z)
  110. CALL TQL2(NM,N,W,FV1,Z,IERR)
  111. 50 RETURN
  112. END