EpetraExt  Development
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
main.f
Go to the documentation of this file.
1 c
2 c
3 c Purpose: Fortran driver of genbtf, generate block triangular
4 c form. A structurally nonsingular matrix is permuted
5 c
6 c (A(rowperm(i), (colperm(j)), 1 <= i,j, <=n)
7 c
8 c to block upper triangular with sqcmpn blocks.
9 c If matsng != 0, then the matrix is structurally singular
10 c (for example has a zero row), and has a complex
11 c block triangular form.
12 c
13 
14 
15 c
16 c rcmstr ccmstr
17 c
18 c If matsng != 0, then the matrix is structurally singular
19 c (for example has a zero row), and has a complex
20 c block triangular form.
21 c
22 c
23 c test input
24  parameter(n=3, nnz= 3)
25 c and C-style indexing.
26 c
27 c
28 c
29 c
30 c
31 c Start with an n by n matrix in sparse row format
32 c ja, ia: column indices and row pointers
33 c
34 c integer input scalars
35 c integer msglvl = 0, output = 6
36  integer msglvl, output
37 c
38 c integer input arrays
39  integer ia(n+1) , ja(nnz), iat(n+1), jat(nnz)
40 c
41 c local work space
42  integer w(10*n), i, j
43 c
44 c integer output scalars
45 c
46  integer matsng
47 c horizontal block: rows, columns, connected components
48  integer nhrows, nhcols, hrzcmp
49 c square block: rows=columns, connected components
50  integer nsrows, sqcmpn
51 c vertical block: rows, columns, connected components
52  integer nvrows, nvcols, vrtcmp
53 c
54 c integer output arrays
55 c rowperm: row permutation,
56 c cotn: column permutation, old to new
57  integer colperm(n), rowperm(n), rcmstr(n+1), ccmstr(n+1)
58  matsng = 0
59  msglvl = 0
60  output = 6
61 c
62 c More test input
63  ia(1) = 0
64  ia(2) = 1
65  ia(3) = 2
66  ia(4) = 3
67 c
68  ja(1) = 1
69  ja(2) = 2
70  ja(3) = 0
71 c
72 c
73 c Convert from C indexing to Fortran
74 c if( nnz != ia(n+1) )then
75 c stop I can not remember Fortran syntax.
76 c endif
77  do 100 i=1,n+1
78  ia(i) = ia(i) + 1
79  100 continue
80  do 101 i=1,nnz
81  ja(i) = ja(i) + 1
82  101 continue
83  call mattrans(n,n,ja,ia,jat,iat)
84 c
85 c
86  print*,'Input (row, column)'
87  do 200 i=1,n
88  do 201 j= ia(i),ia(i+1)-1
89  print*,' ',i,ja(j)
90  201 continue
91  200 continue
92 c
93 c
94  call genbtf( n, n,
95  $ iat , jat, ia, ja, w ,
96  $ rowperm , colperm , nhrows,
97  $ nhcols, hrzcmp, nsrows, sqcmpn, nvrows,
98  $ nvcols, vrtcmp, rcmstr, ccmstr, msglvl, output )
99 c
100 c
101  if( nhrows .gt. 0) then
102  print*, "horizontal block:", nhrows, nhcols, hrzcmp
103  endif
104  print*, sqcmpn, " blocks"
105  if( nvrows .gt. 0) then
106  print*, "vertical block:", nvrows, nvcols, vrtcmp
107  endif
108  matsng = nhrows + nvrows + hrzcmp + vrtcmp
109  if( matsng .eq. 0) then
110  do 401 i=1, sqcmpn
111  print*,' ', rcmstr(hrzcmp+i), ccmstr(hrzcmp+i)
112  401 continue
113  else
114  print*, 'Structurally singular matrix'
115  endif
116 c
117  print*,'Permuted (row, column)'
118  do 300 i=1,n
119  k = rowperm(i)
120  do 301 j= ia(k),ia(k+1)-1
121  print*,' ', i,ja(colperm(j))
122  301 continue
123  300 continue
124 c
125 c rowperm --, colperm --
126 c rcmstr --, ccmstr --
127 c
128 c
129 c
130 c
131  end
subroutine mattrans(m, n, ja, ia, jao, iao)
Definition: mattrans.f:1
subroutine genbtf(nrows, ncols, colstr, rowidx, rowstr, colidx, w, rnto, cnto, nhrows, nhcols, hrzcmp, nsrows, sqcmpn, nvrows, nvcols, vrtcmp, rcmstr, ccmstr, msglvl, output)
Definition: genbtf.f:1