2 * (n
, r
,c
,ic
, ia
,ja
,a
, z
, b
,
3 * lmax
,il
,jl
,ijl
,l
, d
, umax
,iu
,ju
,iju
,u
,
4 * row
, tmp
, irl
,jrl
, flag
)
6 c*** numerical ldu-factorization of sparse nonsymmetric matrix and
7 c solution of system of linear equations (compressed pointer
11 c input variables.. n, r, c, ic, ia, ja, a, b,
12 c il, jl, ijl, lmax, iu, ju, iju, umax
13 c output variables.. z, l, d, u, flag
15 c parameters used internally..
16 c nia - irl, - vectors used to find the rows of l. at the kth step
17 c nia - jrl of the factorization, jrl(k) points to the head
18 c - of a linked list in jrl of column indices j
19 c - such j .lt. k and l(k,j) is nonzero. zero
20 c - indicates the end of the list. irl(j) (j.lt.k)
21 c - points to the smallest i such that i .ge. k and
22 c - l(i,j) is nonzero.
24 c fia - row - holds intermediate values in calculation of u and l.
26 c fia - tmp - holds new right-hand side b* for solution of the
30 c internal variables..
31 c jmin, jmax - indices of the first and last positions in a row to
33 c sum - used in calculating tmp.
36 integer r
(*), c
(*), ic
(*), ia
(*), ja
(*), il
(*), jl
(*), ijl
(*)
37 integer iu
(*), ju
(*), iju
(*), irl
(*), jrl
(*), flag
38 c real a(*), l(*), d(*), u(*), z(*), b(*), row(*)
39 c real tmp(*), lki, sum, dk
40 double precision a
(*), l
(*), d
(*), u
(*), z
(*), b
(*), row
(*)
41 double precision tmp
(*), lki
, sum
, dk
43 c ****** initialize pointers and test storage ***********************
44 if(il
(n
+1)-1 .gt
. lmax
) go to 104
45 if(iu
(n
+1)-1 .gt
. umax
) go to 107
51 c ****** for each row ***********************************************
53 c ****** reverse jrl and zero row where kth row of l will fill in ***
56 if (jrl
(k
) .eq
. 0) go to 3
64 c ****** set row to zero where u will fill in ***********************
66 jmax
= jmin
+ iu
(k
+1) - iu
(k
) - 1
67 if (jmin
.gt
. jmax
) go to 5
70 c ****** place kth row of a in row **********************************
77 c ****** initialize sum, and link through jrl ***********************
80 if (i
.eq
. 0) go to 10
81 c ****** assign the kth row of l and adjust row, sum ****************
83 c ****** if l is not required, then comment out the following line **
85 sum
= sum
+ lki
* tmp
(i
)
88 if (jmin
.gt
. jmax
) go to 9
91 8 row
(ju
(mu
+j
)) = row
(ju
(mu
+j
)) + lki
* u
(j
)
95 c ****** assign kth row of u and diagonal d, set tmp(k) *************
96 10 if (row
(k
) .eq
. 0.0d0
) go to 108
100 if (k
.eq
. n
) go to 19
103 if (jmin
.gt
. jmax
) go to 12
106 11 u
(j
) = row
(ju
(mu
+j
)) * dk
109 c ****** update irl and jrl, keeping jrl in decreasing order ********
111 if (i
.eq
. 0) go to 18
112 14 irl
(i
) = irl
(i
) + 1
114 if (irl
(i
) .ge
. il
(i
+1)) go to 17
115 ijlb
= irl
(i
) - il
(i
) + ijl
(i
)
117 15 if (i
.gt
. jrl
(j
)) go to 16
123 if (i
.ne
. 0) go to 14
124 18 if (irl
(k
) .ge
. il
(k
+1)) go to 19
130 c ****** solve ux = tmp by back substitution **********************
136 if (jmin
.gt
. jmax
) go to 21
139 20 sum
= sum
- u
(j
) * tmp
(ju
(mu
+j
))
146 c ** error.. insufficient storage for l
149 c ** error.. insufficient storage for u
152 c ** error.. zero pivot