EpetraExt  Development
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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(*)
3 c-------------------------------------------------------------------
4 c transpose a matrix stored in a, ja, ia format.
5 c ---------------
6 c input arguments:
7 c m = row dimension of a.
8 c n = column dimension of a.
9 c ja = integer array of size nnz containing the column positions
10 c of the corresponding elements in a.
11 c ia = integer of size n+1. ia(k) contains the position in a, ja of
12 c the beginning of the k-th row.
13 c output arguments:
14 c jao = integer array of size nnz containing the column indices.
15 c iao = integer array of size m+1 containing the "ia" index array of
16 c the transposed matrix.
17 c--------------------------------------------------------------------
18 c
19 c count the number of elements in every column of a and row of ao
20 c
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
31 c 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)
35 c 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
46 c reshift iao
47  do 7 i = n, 1, -1
48  7 iao(i+1) = iao(i)
49  iao(1) = 1
50 c--------------- end of mattrans ---------------------------------
51  end
subroutine mattrans(m, n, ja, ia, jao, iao)
Definition: mattrans.f:1
static size_t size(T const &object)
Returns size in byte necessary to pack datatype.