2
* (n, ip, ia,ja,a, q, r, dflag)
4
c***********************************************************************
5
c sro -- symmetric reordering of sparse symmetric matrix
6
c***********************************************************************
10
c the nonzero entries of the matrix m are assumed to be stored
11
c symmetrically in (ia,ja,a) format (i.e., not both m(i,j) and m(j,i)
12
c are stored if i ne j).
14
c sro does not rearrange the order of the rows, but does move
15
c nonzeroes from one row to another to ensure that if m(i,j) will be
16
c in the upper triangle of m with respect to the new ordering, then
17
c m(i,j) is stored in row i (and thus m(j,i) is not stored), whereas
18
c if m(i,j) will be in the strict lower triangle of m, then m(j,i) is
19
c stored in row j (and thus m(i,j) is not stored).
22
c additional parameters
24
c q - integer one-dimensional work array. dimension = n
26
c r - integer one-dimensional work array. dimension = number of
27
c nonzero entries in the upper triangle of m
29
c dflag - logical variable. if dflag = .true., then store nonzero
30
c diagonal elements at the beginning of the row
32
c-----------------------------------------------------------------------
34
integer ip(1), ia(1), ja(1), q(1), r(1)
35
double precision a(1), 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