figi.f 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. *DECK FIGI
  2. SUBROUTINE FIGI (NM, N, T, D, E, E2, IERR)
  3. C***BEGIN PROLOGUE FIGI
  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 (FIGI-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, this subroutine reduces it to a symmetric
  16. C tridiagonal matrix with the same eigenvalues. If, further,
  17. C a zero product only occurs when both factors are zero,
  18. C the reduced matrix is similar to the original matrix.
  19. C
  20. C On INPUT
  21. C
  22. C NM must be set to the row dimension of the two-dimensional
  23. C array parameter, T, as declared in the calling program
  24. C dimension statement. NM is an INTEGER variable.
  25. C
  26. C N is the order of the matrix T. N is an INTEGER variable.
  27. C N must be less than or equal to NM.
  28. C
  29. C T contains the nonsymmetric matrix. Its subdiagonal is
  30. C stored in the last N-1 positions of the first column,
  31. C its diagonal in the N positions of the second column,
  32. C and its superdiagonal in the first N-1 positions of
  33. C the third column. T(1,1) and T(N,3) are arbitrary.
  34. C T is a two-dimensional REAL array, dimensioned T(NM,3).
  35. C
  36. C On OUTPUT
  37. C
  38. C T is unaltered.
  39. C
  40. C D contains the diagonal elements of the tridiagonal symmetric
  41. C matrix. D is a one-dimensional REAL array, dimensioned D(N).
  42. C
  43. C E contains the subdiagonal elements of the tridiagonal
  44. C symmetric matrix in its last N-1 positions. E(1) is not set.
  45. C E is a one-dimensional REAL array, dimensioned E(N).
  46. C
  47. C E2 contains the squares of the corresponding elements of E.
  48. C E2 may coincide with E if the squares are not needed.
  49. C E2 is a one-dimensional REAL array, dimensioned E2(N).
  50. C
  51. C IERR is an INTEGER flag set to
  52. C Zero for normal return,
  53. C N+I if T(I,1)*T(I-1,3) is negative and a symmetric
  54. C matrix cannot be produced with FIGI,
  55. C -(3*N+I) if T(I,1)*T(I-1,3) is zero with one factor
  56. C non-zero. In this case, the eigenvectors of
  57. C the symmetric matrix are not simply related
  58. C to those of T and should not be sought.
  59. C
  60. C Questions and comments should be directed to B. S. Garbow,
  61. C APPLIED MATHEMATICS DIVISION, ARGONNE NATIONAL LABORATORY
  62. C ------------------------------------------------------------------
  63. C
  64. C***REFERENCES B. T. Smith, J. M. Boyle, J. J. Dongarra, B. S. Garbow,
  65. C Y. Ikebe, V. C. Klema and C. B. Moler, Matrix Eigen-
  66. C system Routines - EISPACK Guide, Springer-Verlag,
  67. C 1976.
  68. C***ROUTINES CALLED (NONE)
  69. C***REVISION HISTORY (YYMMDD)
  70. C 760101 DATE WRITTEN
  71. C 890831 Modified array declarations. (WRB)
  72. C 890831 REVISION DATE from Version 3.2
  73. C 891214 Prologue converted to Version 4.0 format. (BAB)
  74. C 920501 Reformatted the REFERENCES section. (WRB)
  75. C***END PROLOGUE FIGI
  76. C
  77. INTEGER I,N,NM,IERR
  78. REAL T(NM,3),D(*),E(*),E2(*)
  79. C
  80. C***FIRST EXECUTABLE STATEMENT FIGI
  81. IERR = 0
  82. C
  83. DO 100 I = 1, N
  84. IF (I .EQ. 1) GO TO 90
  85. E2(I) = T(I,1) * T(I-1,3)
  86. IF (E2(I)) 1000, 60, 80
  87. 60 IF (T(I,1) .EQ. 0.0E0 .AND. T(I-1,3) .EQ. 0.0E0) GO TO 80
  88. C .......... SET ERROR -- PRODUCT OF SOME PAIR OF OFF-DIAGONAL
  89. C ELEMENTS IS ZERO WITH ONE MEMBER NON-ZERO ..........
  90. IERR = -(3 * N + I)
  91. 80 E(I) = SQRT(E2(I))
  92. 90 D(I) = T(I,2)
  93. 100 CONTINUE
  94. C
  95. GO TO 1001
  96. C .......... SET ERROR -- PRODUCT OF SOME PAIR OF OFF-DIAGONAL
  97. C ELEMENTS IS NEGATIVE ..........
  98. 1000 IERR = N + I
  99. 1001 RETURN
  100. END