dpbfa.f 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. *DECK DPBFA
  2. SUBROUTINE DPBFA (ABD, LDA, N, M, INFO)
  3. C***BEGIN PROLOGUE DPBFA
  4. C***PURPOSE Factor a real symmetric positive definite matrix stored in
  5. C in band form.
  6. C***LIBRARY SLATEC (LINPACK)
  7. C***CATEGORY D2B2
  8. C***TYPE DOUBLE PRECISION (SPBFA-S, DPBFA-D, CPBFA-C)
  9. C***KEYWORDS BANDED, LINEAR ALGEBRA, LINPACK, MATRIX FACTORIZATION,
  10. C POSITIVE DEFINITE
  11. C***AUTHOR Moler, C. B., (U. of New Mexico)
  12. C***DESCRIPTION
  13. C
  14. C DPBFA factors a double precision symmetric positive definite
  15. C matrix stored in band form.
  16. C
  17. C DPBFA is usually called by DPBCO, but it can be called
  18. C directly with a saving in time if RCOND is not needed.
  19. C
  20. C On Entry
  21. C
  22. C ABD DOUBLE PRECISION(LDA, N)
  23. C the matrix to be factored. The columns of the upper
  24. C triangle are stored in the columns of ABD and the
  25. C diagonals of the upper triangle are stored in the
  26. C rows of ABD . See the comments below for details.
  27. C
  28. C LDA INTEGER
  29. C the leading dimension of the array ABD .
  30. C LDA must be .GE. M + 1 .
  31. C
  32. C N INTEGER
  33. C the order of the matrix A .
  34. C
  35. C M INTEGER
  36. C the number of diagonals above the main diagonal.
  37. C 0 .LE. M .LT. N .
  38. C
  39. C On Return
  40. C
  41. C ABD an upper triangular matrix R , stored in band
  42. C form, so that A = TRANS(R)*R .
  43. C
  44. C INFO INTEGER
  45. C = 0 for normal return.
  46. C = K if the leading minor of order K is not
  47. C positive definite.
  48. C
  49. C Band Storage
  50. C
  51. C If A is a symmetric positive definite band matrix,
  52. C the following program segment will set up the input.
  53. C
  54. C M = (band width above diagonal)
  55. C DO 20 J = 1, N
  56. C I1 = MAX(1, J-M)
  57. C DO 10 I = I1, J
  58. C K = I-J+M+1
  59. C ABD(K,J) = A(I,J)
  60. C 10 CONTINUE
  61. C 20 CONTINUE
  62. C
  63. C***REFERENCES J. J. Dongarra, J. R. Bunch, C. B. Moler, and G. W.
  64. C Stewart, LINPACK Users' Guide, SIAM, 1979.
  65. C***ROUTINES CALLED DDOT
  66. C***REVISION HISTORY (YYMMDD)
  67. C 780814 DATE WRITTEN
  68. C 890531 Changed all specific intrinsics to generic. (WRB)
  69. C 890831 Modified array declarations. (WRB)
  70. C 890831 REVISION DATE from Version 3.2
  71. C 891214 Prologue converted to Version 4.0 format. (BAB)
  72. C 900326 Removed duplicate information from DESCRIPTION section.
  73. C (WRB)
  74. C 920501 Reformatted the REFERENCES section. (WRB)
  75. C***END PROLOGUE DPBFA
  76. INTEGER LDA,N,M,INFO
  77. DOUBLE PRECISION ABD(LDA,*)
  78. C
  79. DOUBLE PRECISION DDOT,T
  80. DOUBLE PRECISION S
  81. INTEGER IK,J,JK,K,MU
  82. C***FIRST EXECUTABLE STATEMENT DPBFA
  83. DO 30 J = 1, N
  84. INFO = J
  85. S = 0.0D0
  86. IK = M + 1
  87. JK = MAX(J-M,1)
  88. MU = MAX(M+2-J,1)
  89. IF (M .LT. MU) GO TO 20
  90. DO 10 K = MU, M
  91. T = ABD(K,J) - DDOT(K-MU,ABD(IK,JK),1,ABD(MU,J),1)
  92. T = T/ABD(M+1,JK)
  93. ABD(K,J) = T
  94. S = S + T*T
  95. IK = IK - 1
  96. JK = JK + 1
  97. 10 CONTINUE
  98. 20 CONTINUE
  99. S = ABD(M+1,J) - S
  100. IF (S .LE. 0.0D0) GO TO 40
  101. ABD(M+1,J) = SQRT(S)
  102. 30 CONTINUE
  103. INFO = 0
  104. 40 CONTINUE
  105. RETURN
  106. END