dsli2.f 5.5 KB

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