2
SUBROUTINE DSLUI4 (N, B, X, IL, JL, L, DINV, IU, JU, U)
3
C***BEGIN PROLOGUE DSLUI4
4
C***PURPOSE SLAP Backsolve for LDU Factorization.
5
C Routine to solve a system of the form (L*D*U)' X = B,
6
C where L is a unit lower triangular matrix, D is a diagonal
7
C matrix, and U is a unit upper triangular matrix and '
9
C***LIBRARY SLATEC (SLAP)
11
C***TYPE DOUBLE PRECISION (SSLUI4-S, DSLUI4-D)
12
C***KEYWORDS ITERATIVE PRECONDITION, NON-SYMMETRIC LINEAR SYSTEM SOLVE,
14
C***AUTHOR Greenbaum, Anne, (Courant Institute)
15
C Seager, Mark K., (LLNL)
16
C Lawrence Livermore National Laboratory
18
C Livermore, CA 94550 (510) 423-3141
23
C INTEGER N, IL(NL), JL(NL), IU(NU), JU(NU)
24
C DOUBLE PRECISION B(N), X(N), L(NL), DINV(N), U(NU)
26
C CALL DSLUI4( N, B, X, IL, JL, L, DINV, IU, JU, U )
30
C Order of the Matrix.
31
C B :IN Double Precision B(N).
33
C X :OUT Double Precision X(N).
34
C Solution of (L*D*U)trans x = b.
35
C IL :IN Integer IL(NL).
36
C JL :IN Integer JL(NL).
37
C L :IN Double Precision L(NL).
38
C IL, JL, L contain the unit lower triangular factor of the
39
C incomplete decomposition of some matrix stored in SLAP Row
40
C format. The diagonal of ones *IS* stored. This structure
41
C can be set up by the DSILUS routine. See the
42
C "Description", below for more details about the SLAP
43
C format. (NL is the number of non-zeros in the L array.)
44
C DINV :IN Double Precision DINV(N).
45
C Inverse of the diagonal matrix D.
46
C IU :IN Integer IU(NU).
47
C JU :IN Integer JU(NU).
48
C U :IN Double Precision U(NU).
49
C IU, JU, U contain the unit upper triangular factor of the
50
C incomplete decomposition of some matrix stored in SLAP
51
C Column format. The diagonal of ones *IS* stored. This
52
C structure can be set up by the DSILUS routine. See the
53
C "Description", below for more details about the SLAP
54
C format. (NU is the number of non-zeros in the U array.)
57
C This routine is supplied with the SLAP package as a routine
58
C to perform the MTSOLV operation in the SBCG iteration
59
C routine for the driver DSLUBC. It must be called via the
60
C SLAP MTSOLV calling sequence convention interface routine
62
C **** THIS ROUTINE ITSELF DOES NOT CONFORM TO THE ****
63
C **** SLAP MSOLVE CALLING CONVENTION ****
65
C IL, JL, L should contain the unit lower triangular factor of
66
C the incomplete decomposition of the A matrix stored in SLAP
67
C Row format. IU, JU, U should contain the unit upper factor
68
C of the incomplete decomposition of the A matrix stored in
69
C SLAP Column format This ILU factorization can be computed by
70
C the DSILUS routine. The diagonals (which are all one's) are
73
C =================== S L A P Column format ==================
75
C This routine requires that the matrix A be stored in the
76
C SLAP Column format. In this format the non-zeros are stored
77
C counting down columns (except for the diagonal entry, which
78
C must appear first in each "column") and are stored in the
79
C double precision array A. In other words, for each column
80
C in the matrix put the diagonal entry in A. Then put in the
81
C other non-zero elements going down the column (except the
82
C diagonal) in order. The IA array holds the row index for
83
C each non-zero. The JA array holds the offsets into the IA,
84
C A arrays for the beginning of each column. That is,
85
C IA(JA(ICOL)), A(JA(ICOL)) points to the beginning of the
86
C ICOL-th column in IA and A. IA(JA(ICOL+1)-1),
87
C A(JA(ICOL+1)-1) points to the end of the ICOL-th column.
88
C Note that we always have JA(N+1) = NELT+1, where N is the
89
C number of columns in the matrix and NELT is the number of
90
C non-zeros in the matrix.
92
C Here is an example of the SLAP Column storage format for a
93
C 5x5 Matrix (in the A and IA arrays '|' denotes the end of a
96
C 5x5 Matrix SLAP Column format for 5x5 matrix on left.
97
C 1 2 3 4 5 6 7 8 9 10 11
98
C |11 12 0 0 15| A: 11 21 51 | 22 12 | 33 53 | 44 | 55 15 35
99
C |21 22 0 0 0| IA: 1 2 5 | 2 1 | 3 5 | 4 | 5 1 3
100
C | 0 0 33 0 35| JA: 1 4 6 8 9 12
104
C ==================== S L A P Row format ====================
106
C This routine requires that the matrix A be stored in the
107
C SLAP Row format. In this format the non-zeros are stored
108
C counting across rows (except for the diagonal entry, which
109
C must appear first in each "row") and are stored in the
110
C double precision array A. In other words, for each row in
111
C the matrix put the diagonal entry in A. Then put in the
112
C other non-zero elements going across the row (except the
113
C diagonal) in order. The JA array holds the column index for
114
C each non-zero. The IA array holds the offsets into the JA,
115
C A arrays for the beginning of each row. That is,
116
C JA(IA(IROW)),A(IA(IROW)) are the first elements of the IROW-
117
C th row in JA and A, and JA(IA(IROW+1)-1), A(IA(IROW+1)-1)
118
C are the last elements of the IROW-th row. Note that we
119
C always have IA(N+1) = NELT+1, where N is the number of rows
120
C in the matrix and NELT is the number of non-zeros in the
123
C Here is an example of the SLAP Row storage format for a 5x5
124
C Matrix (in the A and JA arrays '|' denotes the end of a row):
126
C 5x5 Matrix SLAP Row format for 5x5 matrix on left.
127
C 1 2 3 4 5 6 7 8 9 10 11
128
C |11 12 0 0 15| A: 11 12 15 | 22 21 | 33 35 | 44 | 55 51 53
129
C |21 22 0 0 0| JA: 1 2 5 | 2 1 | 3 5 | 4 | 5 1 3
130
C | 0 0 33 0 35| IA: 1 4 6 8 9 12
134
C With the SLAP format the "inner loops" of this routine
135
C should vectorize on machines with hardware support for
136
C vector gather/scatter operations. Your compiler may require
137
C a compiler directive to convince it that there are no
138
C implicit vector dependencies. Compiler directives for the
139
C Alliant FX/Fortran and CRI CFT/CFT77 compilers are supplied
140
C with the standard SLAP distribution.
143
C***REFERENCES (NONE)
144
C***ROUTINES CALLED (NONE)
145
C***REVISION HISTORY (YYMMDD)
146
C 871119 DATE WRITTEN
147
C 881213 Previous REVISION DATE
148
C 890915 Made changes requested at July 1989 CML Meeting. (MKS)
149
C 890922 Numerous changes to prologue to make closer to SLATEC
151
C 890929 Numerous changes to reduce SP/DP differences. (FNF)
152
C 910411 Prologue converted to Version 4.0 format. (BAB)
153
C 920511 Added complete declaration section. (WRB)
154
C 921113 Corrected C***CATEGORY line. (FNF)
155
C 930701 Updated CATEGORY section. (FNF, WRB)
156
C***END PROLOGUE DSLUI4
157
C .. Scalar Arguments ..
159
C .. Array Arguments ..
160
DOUBLE PRECISION B(N), DINV(N), L(*), U(*), X(N)
161
INTEGER IL(*), IU(*), JL(*), JU(*)
162
C .. Local Scalars ..
163
INTEGER I, ICOL, IROW, J, JBGN, JEND
164
C***FIRST EXECUTABLE STATEMENT DSLUI4
169
C Solve U'*Y = X, storing result in X, U stored by columns.
172
JEND = JU(IROW+1) - 1
173
IF( JBGN.LE.JEND ) THEN
174
CLLL. OPTION ASSERT (NOHAZARD)
179
X(IROW) = X(IROW) - U(J)*X(IU(J))
184
C Solve D*Z = Y, storing result in X.
189
C Solve L'*X = Z, L stored by rows.
190
DO 110 ICOL = N, 2, -1
192
JEND = IL(ICOL+1) - 1
193
IF( JBGN.LE.JEND ) THEN
194
CLLL. OPTION ASSERT (NOHAZARD)
197
DO 100 J = JBGN, JEND
198
X(JL(J)) = X(JL(J)) - L(J)*X(ICOL)
203
C------------- LAST LINE OF DSLUI4 FOLLOWS ----------------------------