EpetraExt Development
Loading...
Searching...
No Matches
mattrans.f
Go to the documentation of this file.
1 subroutine mattrans (m, n, ja, ia, jao, iao)
2 integer ia(m+1), iao(n+1), ja(*), jao(*)
3c-------------------------------------------------------------------
4c transpose a matrix stored in a, ja, ia format.
5c ---------------
6c input arguments:
7c m = row dimension of A.
8c n = column dimension of A.
9c ja = integer array of size nnz containing the column positions
10c of the corresponding elements in a.
11c ia = integer of size n+1. ia(k) contains the position in a, ja of
12c the beginning of the k-th row.
13c output arguments:
14c jao = integer array of size nnz containing the column indices.
15c iao = integer array of size m+1 containing the "ia" index array of
16c the transposed matrix.
17c--------------------------------------------------------------------
18c
19c count the number of elements in every column of a and row of ao
20c
21 do 1 i=1, n+1
22 1 iao(i) = 0
23 do 3 i=1, m
24 k1 = ia(i)
25 k2 = ia(i+1) -1
26 do 2 k=k1, k2
27 j = ja(k)+1
28 iao(j) = iao(j)+1
29 2 continue
30 3 continue
31c find addresses of new first elements..
32 iao(1) = 1
33 do 4 i=1, n
34 4 iao(i+1) = iao(i) + iao(i+1)
35c now do the actual copying.
36 do 6 i=1, m
37 k1 = ia(i)
38 k2 = ia(i+1)-1
39 do 62 k=k1,k2
40 j = ja(k)
41 next = iao(j)
42 jao(next) = i
43 iao(j) = next+1
44 62 continue
45 6 continue
46c reshift iao
47 do 7 i = n, 1, -1
48 7 iao(i+1) = iao(i)
49 iao(1) = 1
50c--------------- end of mattrans ---------------------------------
51 end
subroutine mattrans(m, n, ja, ia, jao, iao)
Definition mattrans.f:2