snbdi.f 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. *DECK SNBDI
  2. SUBROUTINE SNBDI (ABE, LDA, N, ML, MU, IPVT, DET)
  3. C***BEGIN PROLOGUE SNBDI
  4. C***PURPOSE Compute the determinant of a band matrix using the factors
  5. C computed by SNBCO or SNBFA.
  6. C***LIBRARY SLATEC
  7. C***CATEGORY D3A2
  8. C***TYPE SINGLE PRECISION (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 SNBDI computes the determinant of a band matrix
  14. C using the factors computed by SNBCO or SNBFA.
  15. C If the inverse is needed, use SNBSL N times.
  16. C
  17. C On Entry
  18. C
  19. C ABE REAL(LDA, NC)
  20. C the output from SNBCO or SNBFA.
  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 SNBCO or SNBFA.
  37. C
  38. C On Return
  39. C
  40. C DET REAL(2)
  41. C determinant of original matrix.
  42. C Determinant = DET(1) * 10.0**DET(2)
  43. C with 1.0 .LE. ABS(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 800725 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 SNBDI
  56. INTEGER LDA,N,ML,MU,IPVT(*)
  57. REAL ABE(LDA,*),DET(2)
  58. C
  59. REAL TEN
  60. INTEGER I
  61. C***FIRST EXECUTABLE STATEMENT SNBDI
  62. DET(1) = 1.0E0
  63. DET(2) = 0.0E0
  64. TEN = 10.0E0
  65. DO 50 I = 1, N
  66. IF (IPVT(I) .NE. I) DET(1) = -DET(1)
  67. DET(1) = ABE(I,ML+1)*DET(1)
  68. IF (DET(1) .EQ. 0.0E0) GO TO 60
  69. 10 IF (ABS(DET(1)) .GE. 1.0E0) GO TO 20
  70. DET(1) = TEN*DET(1)
  71. DET(2) = DET(2) - 1.0E0
  72. GO TO 10
  73. 20 CONTINUE
  74. 30 IF (ABS(DET(1)) .LT. TEN) GO TO 40
  75. DET(1) = DET(1)/TEN
  76. DET(2) = DET(2) + 1.0E0
  77. GO TO 30
  78. 40 CONTINUE
  79. 50 CONTINUE
  80. 60 CONTINUE
  81. RETURN
  82. END