cppsl.f 2.5 KB

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