sllti2.f 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. *DECK SLLTI2
  2. SUBROUTINE SLLTI2 (N, B, X, NEL, IEL, JEL, EL, DINV)
  3. C***BEGIN PROLOGUE SLLTI2
  4. C***PURPOSE SLAP Backsolve routine for LDL' Factorization.
  5. C Routine to solve a system of the form L*D*L' X = B,
  6. C where L is a unit lower triangular matrix and D is a
  7. C diagonal matrix and ' means transpose.
  8. C***LIBRARY SLATEC (SLAP)
  9. C***CATEGORY D2E
  10. C***TYPE SINGLE PRECISION (SLLTI2-S, DLLTI2-D)
  11. C***KEYWORDS INCOMPLETE FACTORIZATION, ITERATIVE PRECONDITION, SLAP,
  12. C SPARSE, SYMMETRIC LINEAR SYSTEM SOLVE
  13. C***AUTHOR Greenbaum, Anne, (Courant Institute)
  14. C Seager, Mark K., (LLNL)
  15. C Lawrence Livermore National Laboratory
  16. C PO BOX 808, L-60
  17. C Livermore, CA 94550 (510) 423-3141
  18. C seager@llnl.gov
  19. C***DESCRIPTION
  20. C
  21. C *Usage:
  22. C INTEGER N, NEL, IEL(NEL), JEL(NEL)
  23. C REAL B(N), X(N), EL(NEL), DINV(N)
  24. C
  25. C CALL SLLTI2( N, B, X, NEL, IEL, JEL, EL, DINV )
  26. C
  27. C *Arguments:
  28. C N :IN Integer
  29. C Order of the Matrix.
  30. C B :IN Real B(N).
  31. C Right hand side vector.
  32. C X :OUT Real X(N).
  33. C Solution to L*D*L' x = b.
  34. C NEL :IN Integer.
  35. C Number of non-zeros in the EL array.
  36. C IEL :IN Integer IEL(NEL).
  37. C JEL :IN Integer JEL(NEL).
  38. C EL :IN Real EL(NEL).
  39. C IEL, JEL, EL contain the unit lower triangular factor of
  40. C the incomplete decomposition of the A matrix stored in
  41. C SLAP Row format. The diagonal of ones *IS* stored. This
  42. C structure can be set up by the SS2LT routine. See the
  43. C "Description", below for more details about the SLAP Row
  44. C format.
  45. C DINV :IN Real DINV(N).
  46. C Inverse of the diagonal matrix D.
  47. C
  48. C *Description:
  49. C This routine is supplied with the SLAP package as a routine
  50. C to perform the MSOLVE operation in the SCG iteration routine
  51. C for the driver routine SSICCG. It must be called via the
  52. C SLAP MSOLVE calling sequence convention interface routine
  53. C SSLLI.
  54. C **** THIS ROUTINE ITSELF DOES NOT CONFORM TO THE ****
  55. C **** SLAP MSOLVE CALLING CONVENTION ****
  56. C
  57. C IEL, JEL, EL should contain the unit lower triangular factor
  58. C of the incomplete decomposition of the A matrix stored in
  59. C SLAP Row format. This IC factorization can be computed by
  60. C the SSICS routine. The diagonal (which is all one's) is
  61. C stored.
  62. C
  63. C ==================== S L A P Row format ====================
  64. C
  65. C This routine requires that the matrix A be stored in the
  66. C SLAP Row format. In this format the non-zeros are stored
  67. C counting across rows (except for the diagonal entry, which
  68. C must appear first in each "row") and are stored in the real
  69. C array A. In other words, for each row in the matrix put the
  70. C diagonal entry in A. Then put in the other non-zero
  71. C elements going across the row (except the diagonal) in
  72. C order. The JA array holds the column index for each
  73. C non-zero. The IA array holds the offsets into the JA, A
  74. C arrays for the beginning of each row. That is,
  75. C JA(IA(IROW)), A(IA(IROW)) points to the beginning of the
  76. C IROW-th row in JA and A. JA(IA(IROW+1)-1), A(IA(IROW+1)-1)
  77. C points to the end of the IROW-th row. Note that we always
  78. C have IA(N+1) = NELT+1, where N is the number of rows in
  79. C the matrix and NELT is the number of non-zeros in the
  80. C matrix.
  81. C
  82. C Here is an example of the SLAP Row storage format for a 5x5
  83. C Matrix (in the A and JA arrays '|' denotes the end of a row):
  84. C
  85. C 5x5 Matrix SLAP Row format for 5x5 matrix on left.
  86. C 1 2 3 4 5 6 7 8 9 10 11
  87. C |11 12 0 0 15| A: 11 12 15 | 22 21 | 33 35 | 44 | 55 51 53
  88. C |21 22 0 0 0| JA: 1 2 5 | 2 1 | 3 5 | 4 | 5 1 3
  89. C | 0 0 33 0 35| IA: 1 4 6 8 9 12
  90. C | 0 0 0 44 0|
  91. C |51 0 53 0 55|
  92. C
  93. C With the SLAP Row format the "inner loop" of this routine
  94. C should vectorize on machines with hardware support for
  95. C vector gather/scatter operations. Your compiler may require
  96. C a compiler directive to convince it that there are no
  97. C implicit vector dependencies. Compiler directives for the
  98. C Alliant FX/Fortran and CRI CFT/CFT77 compilers are supplied
  99. C with the standard SLAP distribution.
  100. C
  101. C***SEE ALSO SSICCG, SSICS
  102. C***REFERENCES (NONE)
  103. C***ROUTINES CALLED (NONE)
  104. C***REVISION HISTORY (YYMMDD)
  105. C 871119 DATE WRITTEN
  106. C 881213 Previous REVISION DATE
  107. C 890915 Made changes requested at July 1989 CML Meeting. (MKS)
  108. C 890922 Numerous changes to prologue to make closer to SLATEC
  109. C standard. (FNF)
  110. C 890929 Numerous changes to reduce SP/DP differences. (FNF)
  111. C 910411 Prologue converted to Version 4.0 format. (BAB)
  112. C 920511 Added complete declaration section. (WRB)
  113. C 921113 Corrected C***CATEGORY line. (FNF)
  114. C 930701 Updated CATEGORY section. (FNF, WRB)
  115. C***END PROLOGUE SLLTI2
  116. C .. Scalar Arguments ..
  117. INTEGER N, NEL
  118. C .. Array Arguments ..
  119. REAL B(N), DINV(N), EL(NEL), X(N)
  120. INTEGER IEL(NEL), JEL(NEL)
  121. C .. Local Scalars ..
  122. INTEGER I, IBGN, IEND, IROW
  123. C***FIRST EXECUTABLE STATEMENT SLLTI2
  124. C
  125. C Solve L*y = b, storing result in x.
  126. C
  127. DO 10 I=1,N
  128. X(I) = B(I)
  129. 10 CONTINUE
  130. DO 30 IROW = 1, N
  131. IBGN = IEL(IROW) + 1
  132. IEND = IEL(IROW+1) - 1
  133. IF( IBGN.LE.IEND ) THEN
  134. CLLL. OPTION ASSERT (NOHAZARD)
  135. CDIR$ IVDEP
  136. CVD$ NOCONCUR
  137. CVD$ NODEPCHK
  138. DO 20 I = IBGN, IEND
  139. X(IROW) = X(IROW) - EL(I)*X(JEL(I))
  140. 20 CONTINUE
  141. ENDIF
  142. 30 CONTINUE
  143. C
  144. C Solve D*Z = Y, storing result in X.
  145. C
  146. DO 40 I=1,N
  147. X(I) = X(I)*DINV(I)
  148. 40 CONTINUE
  149. C
  150. C Solve L-trans*X = Z.
  151. C
  152. DO 60 IROW = N, 2, -1
  153. IBGN = IEL(IROW) + 1
  154. IEND = IEL(IROW+1) - 1
  155. IF( IBGN.LE.IEND ) THEN
  156. CLLL. OPTION ASSERT (NOHAZARD)
  157. CDIR$ IVDEP
  158. CVD$ NOCONCUR
  159. CVD$ NODEPCHK
  160. DO 50 I = IBGN, IEND
  161. X(JEL(I)) = X(JEL(I)) - EL(I)*X(IROW)
  162. 50 CONTINUE
  163. ENDIF
  164. 60 CONTINUE
  165. C
  166. RETURN
  167. C------------- LAST LINE OF SLLTI2 FOLLOWS ----------------------------
  168. END