figi2.f 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. *DECK FIGI2
  2. SUBROUTINE FIGI2 (NM, N, T, D, E, Z, IERR)
  3. C***BEGIN PROLOGUE FIGI2
  4. C***PURPOSE Transforms certain real non-symmetric tridiagonal matrix
  5. C to symmetric tridiagonal matrix.
  6. C***LIBRARY SLATEC (EISPACK)
  7. C***CATEGORY D4C1C
  8. C***TYPE SINGLE PRECISION (FIGI2-S)
  9. C***KEYWORDS EIGENVALUES, EIGENVECTORS, EISPACK
  10. C***AUTHOR Smith, B. T., et al.
  11. C***DESCRIPTION
  12. C
  13. C Given a NONSYMMETRIC TRIDIAGONAL matrix such that the products
  14. C of corresponding pairs of off-diagonal elements are all
  15. C non-negative, and zero only when both factors are zero, this
  16. C subroutine reduces it to a SYMMETRIC TRIDIAGONAL matrix
  17. C using and accumulating diagonal similarity transformations.
  18. C
  19. C On INPUT
  20. C
  21. C NM must be set to the row dimension of the two-dimensional
  22. C array parameters, T and Z, as declared in the calling
  23. C program dimension statement. NM is an INTEGER variable.
  24. C
  25. C N is the order of the matrix T. N is an INTEGER variable.
  26. C N must be less than or equal to NM.
  27. C
  28. C T contains the nonsymmetric matrix. Its subdiagonal is
  29. C stored in the last N-1 positions of the first column,
  30. C its diagonal in the N positions of the second column,
  31. C and its superdiagonal in the first N-1 positions of
  32. C the third column. T(1,1) and T(N,3) are arbitrary.
  33. C T is a two-dimensional REAL array, dimensioned T(NM,3).
  34. C
  35. C On OUTPUT
  36. C
  37. C T is unaltered.
  38. C
  39. C D contains the diagonal elements of the tridiagonal symmetric
  40. C matrix. D is a one-dimensional REAL array, dimensioned D(N).
  41. C
  42. C E contains the subdiagonal elements of the tridiagonal
  43. C symmetric matrix in its last N-1 positions. E(1) is not set.
  44. C E is a one-dimensional REAL array, dimensioned E(N).
  45. C
  46. C Z contains the diagonal transformation matrix produced in the
  47. C symmetrization. Z is a two-dimensional REAL array,
  48. C dimensioned Z(NM,N).
  49. C
  50. C IERR is an INTEGER flag set to
  51. C Zero for normal return,
  52. C N+I if T(I,1)*T(I-1,3) is negative,
  53. C 2*N+I if T(I,1)*T(I-1,3) is zero with one factor
  54. C non-zero. In these cases, there does not exist
  55. C a symmetrizing similarity transformation which
  56. C is essential for the validity of the later
  57. C eigenvector computation.
  58. C
  59. C Questions and comments should be directed to B. S. Garbow,
  60. C APPLIED MATHEMATICS DIVISION, ARGONNE NATIONAL LABORATORY
  61. C ------------------------------------------------------------------
  62. C
  63. C***REFERENCES B. T. Smith, J. M. Boyle, J. J. Dongarra, B. S. Garbow,
  64. C Y. Ikebe, V. C. Klema and C. B. Moler, Matrix Eigen-
  65. C system Routines - EISPACK Guide, Springer-Verlag,
  66. C 1976.
  67. C***ROUTINES CALLED (NONE)
  68. C***REVISION HISTORY (YYMMDD)
  69. C 760101 DATE WRITTEN
  70. C 890831 Modified array declarations. (WRB)
  71. C 890831 REVISION DATE from Version 3.2
  72. C 891214 Prologue converted to Version 4.0 format. (BAB)
  73. C 920501 Reformatted the REFERENCES section. (WRB)
  74. C***END PROLOGUE FIGI2
  75. C
  76. INTEGER I,J,N,NM,IERR
  77. REAL T(NM,3),D(*),E(*),Z(NM,*)
  78. REAL H
  79. C
  80. C***FIRST EXECUTABLE STATEMENT FIGI2
  81. IERR = 0
  82. C
  83. DO 100 I = 1, N
  84. C
  85. DO 50 J = 1, N
  86. 50 Z(I,J) = 0.0E0
  87. C
  88. IF (I .EQ. 1) GO TO 70
  89. H = T(I,1) * T(I-1,3)
  90. IF (H) 900, 60, 80
  91. 60 IF (T(I,1) .NE. 0.0E0 .OR. T(I-1,3) .NE. 0.0E0) GO TO 1000
  92. E(I) = 0.0E0
  93. 70 Z(I,I) = 1.0E0
  94. GO TO 90
  95. 80 E(I) = SQRT(H)
  96. Z(I,I) = Z(I-1,I-1) * E(I) / T(I-1,3)
  97. 90 D(I) = T(I,2)
  98. 100 CONTINUE
  99. C
  100. GO TO 1001
  101. C .......... SET ERROR -- PRODUCT OF SOME PAIR OF OFF-DIAGONAL
  102. C ELEMENTS IS NEGATIVE ..........
  103. 900 IERR = N + I
  104. GO TO 1001
  105. C .......... SET ERROR -- PRODUCT OF SOME PAIR OF OFF-DIAGONAL
  106. C ELEMENTS IS ZERO WITH ONE MEMBER NON-ZERO ..........
  107. 1000 IERR = 2 * N + I
  108. 1001 RETURN
  109. END