sgbdi.f 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. *DECK SGBDI
  2. SUBROUTINE SGBDI (ABD, LDA, N, ML, MU, IPVT, DET)
  3. C***BEGIN PROLOGUE SGBDI
  4. C***PURPOSE Compute the determinant of a band matrix using the factors
  5. C computed by SGBCO or SGBFA.
  6. C***LIBRARY SLATEC (LINPACK)
  7. C***CATEGORY D3A2
  8. C***TYPE SINGLE PRECISION (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 SGBDI computes the determinant of a band matrix
  15. C using the factors computed by SBGCO or SGBFA.
  16. C If the inverse is needed, use SGBSL N times.
  17. C
  18. C On Entry
  19. C
  20. C ABD REAL(LDA, N)
  21. C the output from SBGCO or SGBFA.
  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 SBGCO or SGBFA.
  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 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 SGBDI
  58. INTEGER LDA,N,ML,MU,IPVT(*)
  59. REAL ABD(LDA,*),DET(2)
  60. C
  61. REAL TEN
  62. INTEGER I,M
  63. C***FIRST EXECUTABLE STATEMENT SGBDI
  64. M = ML + MU + 1
  65. DET(1) = 1.0E0
  66. DET(2) = 0.0E0
  67. TEN = 10.0E0
  68. DO 50 I = 1, N
  69. IF (IPVT(I) .NE. I) DET(1) = -DET(1)
  70. DET(1) = ABD(M,I)*DET(1)
  71. IF (DET(1) .EQ. 0.0E0) GO TO 60
  72. 10 IF (ABS(DET(1)) .GE. 1.0E0) GO TO 20
  73. DET(1) = TEN*DET(1)
  74. DET(2) = DET(2) - 1.0E0
  75. GO TO 10
  76. 20 CONTINUE
  77. 30 IF (ABS(DET(1)) .LT. TEN) GO TO 40
  78. DET(1) = DET(1)/TEN
  79. DET(2) = DET(2) + 1.0E0
  80. GO TO 30
  81. 40 CONTINUE
  82. 50 CONTINUE
  83. 60 CONTINUE
  84. RETURN
  85. END