2 * (n
, ip
, ia
,ja
,a
, q
, r
, dflag
)
3 c***********************************************************************
4 c sro -- symmetric reordering of sparse symmetric matrix
5 c***********************************************************************
9 c the nonzero entries of the matrix m are assumed to be stored
10 c symmetrically in (ia,ja,a) format (i.e., not both m(i,j) and m(j,i)
11 c are stored if i ne j).
13 c sro does not rearrange the order of the rows, but does move
14 c nonzeroes from one row to another to ensure that if m(i,j) will be
15 c in the upper triangle of m with respect to the new ordering, then
16 c m(i,j) is stored in row i (and thus m(j,i) is not stored), whereas
17 c if m(i,j) will be in the strict lower triangle of m, then m(j,i) is
18 c stored in row j (and thus m(i,j) is not stored).
21 c additional parameters
23 c q - integer one-dimensional work array. dimension = n
25 c r - integer one-dimensional work array. dimension = number of
26 c nonzero entries in the upper triangle of m
28 c dflag - logical variable. if dflag = .true., then store nonzero
29 c diagonal elements at the beginning of the row
31 c-----------------------------------------------------------------------
33 integer ip
(*), ia
(*), ja
(*), q
(*), r
(*)
35 double precision a
(*), ak
39 c--phase 1 -- find row in which to store each nonzero
40 c----initialize count of nonzeroes to be stored in each row
44 c----for each nonzero element a(j)
48 if (jmin
.gt
.jmax
) go to 3
51 c--------find row (=r(j)) and column (=ja(j)) in which to store a(j) ...
53 if (ip
(k
).lt
.ip
(i
)) ja
(j
) = i
54 if (ip
(k
).ge
.ip
(i
)) k
= i
57 c--------... and increment count of nonzeroes (=q(r(j)) in that row
62 c--phase 2 -- find new ia and permutation to apply to (ja,a)
63 c----determine pointers to delimit rows in permuted (ja,a)
65 ia
(i
+1) = ia
(i
) + q
(i
)
68 c----determine where each (ja(j),a(j)) is stored in permuted (ja,a)
69 c----for each nonzero element (in reverse order)
76 if (.not
.dflag
.or
. ja
(j
).ne
.i
.or
. i
.eq
.ilast
) go to 5
78 c------if dflag, then put diagonal nonzero at beginning of row
83 c------put (off-diagonal) nonzero in last unused location in row
90 c--phase 3 -- permute (ja,a) to upper triangular form (wrt new ordering)
92 7 if (r
(j
).eq
.j
) go to 8