cgbdi.f 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. *DECK CGBDI
  2. SUBROUTINE CGBDI (ABD, LDA, N, ML, MU, IPVT, DET)
  3. C***BEGIN PROLOGUE CGBDI
  4. C***PURPOSE Compute the determinant of a complex band matrix using the
  5. C factors from CGBCO or CGBFA.
  6. C***LIBRARY SLATEC (LINPACK)
  7. C***CATEGORY D3C2
  8. C***TYPE COMPLEX (SGBDI-S, DGBDI-D, CGBDI-C)
  9. C***KEYWORDS BANDED, DETERMINANT, INVERSE, LINEAR ALGEBRA, LINPACK,
  10. C MATRIX
  11. C***AUTHOR Moler, C. B., (U. of New Mexico)
  12. C***DESCRIPTION
  13. C
  14. C CGBDI computes the determinant of a band matrix
  15. C using the factors computed by CGBCO or CGBFA.
  16. C If the inverse is needed, use CGBSL N times.
  17. C
  18. C On Entry
  19. C
  20. C ABD COMPLEX(LDA, N)
  21. C the output from CGBCO or CGBFA.
  22. C
  23. C LDA INTEGER
  24. C the leading dimension of the array ABD .
  25. C
  26. C N INTEGER
  27. C the order of the original matrix.
  28. C
  29. C ML INTEGER
  30. C number of diagonals below the main diagonal.
  31. C
  32. C MU INTEGER
  33. C number of diagonals above the main diagonal.
  34. C
  35. C IPVT INTEGER(N)
  36. C the pivot vector from CGBCO or CGBFA.
  37. C
  38. C On Return
  39. C
  40. C DET COMPLEX(2)
  41. C determinant of original matrix.
  42. C Determinant = DET(1) * 10.0**DET(2)
  43. C with 1.0 .LE. CABS1(DET(1)) .LT. 10.0
  44. C or DET(1) = 0.0 .
  45. C
  46. C***REFERENCES J. J. Dongarra, J. R. Bunch, C. B. Moler, and G. W.
  47. C Stewart, LINPACK Users' Guide, SIAM, 1979.
  48. C***ROUTINES CALLED (NONE)
  49. C***REVISION HISTORY (YYMMDD)
  50. C 780814 DATE WRITTEN
  51. C 890831 Modified array declarations. (WRB)
  52. C 890831 REVISION DATE from Version 3.2
  53. C 891214 Prologue converted to Version 4.0 format. (BAB)
  54. C 900326 Removed duplicate information from DESCRIPTION section.
  55. C (WRB)
  56. C 920501 Reformatted the REFERENCES section. (WRB)
  57. C***END PROLOGUE CGBDI
  58. INTEGER LDA,N,ML,MU,IPVT(*)
  59. COMPLEX ABD(LDA,*),DET(2)
  60. C
  61. REAL TEN
  62. INTEGER I,M
  63. COMPLEX ZDUM
  64. REAL CABS1
  65. C
  66. CABS1(ZDUM) = ABS(REAL(ZDUM)) + ABS(AIMAG(ZDUM))
  67. C***FIRST EXECUTABLE STATEMENT CGBDI
  68. M = ML + MU + 1
  69. DET(1) = (1.0E0,0.0E0)
  70. DET(2) = (0.0E0,0.0E0)
  71. TEN = 10.0E0
  72. DO 50 I = 1, N
  73. IF (IPVT(I) .NE. I) DET(1) = -DET(1)
  74. DET(1) = ABD(M,I)*DET(1)
  75. IF (CABS1(DET(1)) .EQ. 0.0E0) GO TO 60
  76. 10 IF (CABS1(DET(1)) .GE. 1.0E0) GO TO 20
  77. DET(1) = CMPLX(TEN,0.0E0)*DET(1)
  78. DET(2) = DET(2) - (1.0E0,0.0E0)
  79. GO TO 10
  80. 20 CONTINUE
  81. 30 IF (CABS1(DET(1)) .LT. TEN) GO TO 40
  82. DET(1) = DET(1)/CMPLX(TEN,0.0E0)
  83. DET(2) = DET(2) + (1.0E0,0.0E0)
  84. GO TO 30
  85. 40 CONTINUE
  86. 50 CONTINUE
  87. 60 CONTINUE
  88. RETURN
  89. END