cposl.f 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. *DECK CPOSL
  2. SUBROUTINE CPOSL (A, LDA, N, B)
  3. C***BEGIN PROLOGUE CPOSL
  4. C***PURPOSE Solve the complex Hermitian positive definite linear system
  5. C using the factors computed by CPOCO or CPOFA.
  6. C***LIBRARY SLATEC (LINPACK)
  7. C***CATEGORY D2D1B
  8. C***TYPE COMPLEX (SPOSL-S, DPOSL-D, CPOSL-C)
  9. C***KEYWORDS LINEAR ALGEBRA, LINPACK, MATRIX, POSITIVE DEFINITE, SOLVE
  10. C***AUTHOR Moler, C. B., (U. of New Mexico)
  11. C***DESCRIPTION
  12. C
  13. C CPOSL solves the COMPLEX Hermitian positive definite system
  14. C A * X = B
  15. C using the factors computed by CPOCO or CPOFA.
  16. C
  17. C On Entry
  18. C
  19. C A COMPLEX(LDA, N)
  20. C the output from CPOCO or CPOFA.
  21. C
  22. C LDA INTEGER
  23. C the leading dimension of the array A .
  24. C
  25. C N INTEGER
  26. C the order of the matrix A .
  27. C
  28. C B COMPLEX(N)
  29. C the right hand side vector.
  30. C
  31. C On Return
  32. C
  33. C B the solution vector X .
  34. C
  35. C Error Condition
  36. C
  37. C A division by zero will occur if the input factor contains
  38. C a zero on the diagonal. Technically this indicates
  39. C singularity but it is usually caused by improper subroutine
  40. C arguments. It will not occur if the subroutines are called
  41. C correctly and INFO .EQ. 0 .
  42. C
  43. C To compute INVERSE(A) * C where C is a matrix
  44. C with P columns
  45. C CALL CPOCO(A,LDA,N,RCOND,Z,INFO)
  46. C IF (RCOND is too small .OR. INFO .NE. 0) GO TO ...
  47. C DO 10 J = 1, P
  48. C CALL CPOSL(A,LDA,N,C(1,J))
  49. C 10 CONTINUE
  50. C
  51. C***REFERENCES J. J. Dongarra, J. R. Bunch, C. B. Moler, and G. W.
  52. C Stewart, LINPACK Users' Guide, SIAM, 1979.
  53. C***ROUTINES CALLED CAXPY, CDOTC
  54. C***REVISION HISTORY (YYMMDD)
  55. C 780814 DATE WRITTEN
  56. C 890831 Modified array declarations. (WRB)
  57. C 890831 REVISION DATE from Version 3.2
  58. C 891214 Prologue converted to Version 4.0 format. (BAB)
  59. C 900326 Removed duplicate information from DESCRIPTION section.
  60. C (WRB)
  61. C 920501 Reformatted the REFERENCES section. (WRB)
  62. C***END PROLOGUE CPOSL
  63. INTEGER LDA,N
  64. COMPLEX A(LDA,*),B(*)
  65. C
  66. COMPLEX CDOTC,T
  67. INTEGER K,KB
  68. C
  69. C SOLVE CTRANS(R)*Y = B
  70. C
  71. C***FIRST EXECUTABLE STATEMENT CPOSL
  72. DO 10 K = 1, N
  73. T = CDOTC(K-1,A(1,K),1,B(1),1)
  74. B(K) = (B(K) - T)/A(K,K)
  75. 10 CONTINUE
  76. C
  77. C SOLVE R*X = Y
  78. C
  79. DO 20 KB = 1, N
  80. K = N + 1 - KB
  81. B(K) = B(K)/A(K,K)
  82. T = -B(K)
  83. CALL CAXPY(K-1,T,A(1,K),1,B(1),1)
  84. 20 CONTINUE
  85. RETURN
  86. END