cnbdi.f 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. *DECK CNBDI
  2. SUBROUTINE CNBDI (ABE, LDA, N, ML, MU, IPVT, DET)
  3. C***BEGIN PROLOGUE CNBDI
  4. C***PURPOSE Compute the determinant of a band matrix using the factors
  5. C computed by CNBCO or CNBFA.
  6. C***LIBRARY SLATEC
  7. C***CATEGORY D3C2
  8. C***TYPE COMPLEX (SNBDI-S, DNBDI-D, CNBDI-C)
  9. C***KEYWORDS BANDED, DETERMINANT, LINEAR EQUATIONS, NONSYMMETRIC
  10. C***AUTHOR Voorhees, E. A., (LANL)
  11. C***DESCRIPTION
  12. C
  13. C CNBDI computes the determinant of a band matrix
  14. C using the factors computed by CNBCO or CNBFA.
  15. C If the inverse is needed, use CNBSL N times.
  16. C
  17. C On Entry
  18. C
  19. C ABE COMPLEX(LDA, NC)
  20. C the output from CNBCO or CNBFA.
  21. C NC must be .GE. 2*ML+MU+1 .
  22. C
  23. C LDA INTEGER
  24. C the leading dimension of the array ABE .
  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 CNBCO or CNBFA.
  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 800730 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 920501 Reformatted the REFERENCES section. (WRB)
  55. C***END PROLOGUE CNBDI
  56. INTEGER LDA,N,ML,MU,IPVT(*)
  57. COMPLEX ABE(LDA,*),DET(2)
  58. C
  59. REAL TEN
  60. INTEGER I
  61. COMPLEX ZDUM
  62. REAL CABS1
  63. CABS1(ZDUM) = ABS(REAL(ZDUM)) + ABS(AIMAG(ZDUM))
  64. C
  65. C***FIRST EXECUTABLE STATEMENT CNBDI
  66. DET(1) = (1.0E0,0.0E0)
  67. DET(2) = (0.0E0,0.0E0)
  68. TEN = 10.0E0
  69. DO 50 I = 1, N
  70. IF (IPVT(I) .NE. I) DET(1) = -DET(1)
  71. DET(1) = ABE(I,ML+1)*DET(1)
  72. IF (CABS1(DET(1)) .EQ. 0.0E0) GO TO 60
  73. 10 IF (CABS1(DET(1)) .GE. 1.0E0) GO TO 20
  74. DET(1) = CMPLX(TEN,0.0E0)*DET(1)
  75. DET(2) = DET(2) - (1.0E0,0.0E0)
  76. GO TO 10
  77. 20 CONTINUE
  78. 30 IF (CABS1(DET(1)) .LT. TEN) GO TO 40
  79. DET(1) = DET(1)/CMPLX(TEN,0.0E0)
  80. DET(2) = DET(2) + (1.0E0,0.0E0)
  81. GO TO 30
  82. 40 CONTINUE
  83. 50 CONTINUE
  84. 60 CONTINUE
  85. RETURN
  86. END