1
subroutine dspmax(nr,nc,a,nela,inda,b,nelb,indb,c,nelc,indc,ierr)
3
c computes the sparse matrix formed with maximum elementwise of two
7
c Contain non zero elements of first,second and sum matrices.
8
c nr : integer: row dimension of a b c matrices
9
c nc : integer: column dimension of a b c matrices
10
c nela :integer: number of non zero elements of a
11
c nelb :integer: number of non zero elements of b
13
c on entry maximum number of non zero elements of c
14
c on return number of non zero elements of c
15
c inda : a matrix control data:
16
c inda(i) 1<=i<=nr contains the number of ith row non zero elements
18
c inda(m+i) 1<=i<=nela column index of each non zero element
19
c indb : b matrix control data:
20
c indb(i) 1<=i<=nr contains the number of ith row non zero elements
22
c indb(m+i) 1<=i<=nelb column index of each non zero element
24
c indc : on return contains c matrix control data:
25
c indc(i) 1<=i<=nr contains the number of ith row non zero elements
27
c indc(m+i) 1<=i<=nelb column index of each non zero element
28
c ierr : if non zero initial value of nelc is to small
31
double precision a(*),b(*),c(*)
32
integer nr,nc,nela,inda(*),nelb,indb(*),nelc,indc(*),ierr
34
integer jc,ka,kb,jb,kf,i,ka1,ja,j1,j2,nold
42
c jc counts elements of c.
44
c ka,kb are numbers in first i rows of a,b.
47
c kf is number of control data in a,b or c.
49
c jb counts elements of b.
51
c i counts rows of a,b,c.
54
c nira is number in row i of a.
56
if (nira.eq.0) go to 12
59
c ja counts elements of a.
62
c at end of b-row transfer rest of a-row.
64
if(a(ja).gt.0.0d0) then
65
if (jc.gt.nelmx) go to 16
74
c if a-index less than b-index transfer a-element to c.
75
if(a(ja).gt.0.0d0) then
76
if (jc.gt.nelmx) go to 16
82
if (jc.gt.nelmx) go to 16
83
c(jc) = max(a(ja),b(jb))
88
c if a-index greater than b-index transfer b-element to c.
89
if(b(jb).gt.0.0d0) then
90
if (jc.gt.nelmx) go to 16
99
c end of row of a. transfer rest of row of b.
100
12 if (jb.gt.kb) go to 13
101
if(b(jb).gt.0.0d0) then
102
if (jc.gt.nelmx) go to 16
110
13 if (i.gt.1) go to 14
112
c nirc is number in row i of c.
122
c no more place for c