1 SUBROUTINE pdmatadd( M, N, ALPHA, A, IA, JA, DESCA, BETA, C, IC,
10 INTEGER IA, IC, JA, JC, M, N
11 DOUBLE PRECISION ALPHA, BETA
14 INTEGER DESCA( * ), DESCC( * )
15 DOUBLE PRECISION A( * ), C( * )
137 INTEGER BLOCK_CYCLIC_2D, CSRC_, CTXT_, DLEN_, DTYPE_,
138 $ lld_, mb_, m_, nb_, n_, rsrc_
139 parameter( block_cyclic_2d = 1, dlen_ = 9, dtype_ = 1,
140 $ ctxt_ = 2, m_ = 3, n_ = 4, mb_ = 5, nb_ = 6,
141 $ rsrc_ = 7, csrc_ = 8, lld_ = 9 )
142 DOUBLE PRECISION ZERO, ONE
143 parameter( zero = 0.0d+0, one = 1.0d+0 )
146 INTEGER I, IACOL, IAROW, ICCOL, ICOFF, ICROW, IIA,
147 $ iic, ioffa, ioffc, iroff, j, jja, jjc, lda,
148 $ ldc, mp, mycol, myrow, npcol, nprow, nq
151 EXTERNAL blacs_gridinfo,
infog2l
161 CALL blacs_gridinfo( desca(ctxt_), nprow, npcol, myrow, mycol )
165 IF( (m.EQ.0).OR.(n.EQ.0).OR.
166 $ ((alpha.EQ.zero).AND.(beta.EQ.one)) )
169 CALL infog2l( ia, ja, desca, nprow, npcol, myrow, mycol,
170 $ iia, jja, iarow, iacol )
171 CALL infog2l( ic, jc, descc, nprow, npcol, myrow, mycol,
172 $ iic, jjc, icrow, iccol )
174 iroff = mod( ia-1, desca(mb_) )
175 icoff = mod( ja-1, desca(nb_) )
176 mp = numroc( m+iroff, desca(mb_), myrow, iarow, nprow )
177 nq = numroc( n+icoff, desca(nb_), mycol, iacol, npcol )
186 IF( beta.EQ.zero )
THEN
187 IF( alpha.EQ.zero )
THEN
188 ioffc = iic + (jjc-1)*ldc
189 DO 10 i = ioffc, ioffc+mp-1
193 ioffa = iia + (jja-1)*lda
194 ioffc = iic + (jjc-1)*ldc
195 DO 20 i = ioffc, ioffc+mp-1
196 c( i ) = alpha * a( ioffa )
201 IF( alpha.EQ.one )
THEN
202 IF( beta.EQ.one )
THEN
203 ioffa = iia + (jja-1)*lda
204 ioffc = iic + (jjc-1)*ldc
205 DO 30 i = ioffc, ioffc+mp-1
206 c( i ) = c( i ) + a( ioffa )
210 ioffa = iia + (jja-1)*lda
211 ioffc = iic + (jjc-1)*ldc
212 DO 40 i = ioffc, ioffc+mp-1
213 c( i ) = beta * c( i ) + a( ioffa )
217 ELSE IF( beta.EQ.one )
THEN
218 ioffa = iia + (jja-1)*lda
219 ioffc = iic + (jjc-1)*ldc
220 DO 50 i = ioffc, ioffc+mp-1
221 c( i ) = c( i ) + alpha * a( ioffa )
225 ioffa = iia + (jja-1)*lda
226 ioffc = iic + (jjc-1)*ldc
227 DO 60 i = ioffc, ioffc+mp-1
228 c( i ) = beta * c( i ) + alpha * a( ioffa )
234 IF( beta.EQ.zero )
THEN
235 IF( alpha.EQ.zero )
THEN
236 ioffc = iic+(jjc-1)*ldc
238 DO 70 i = ioffc, ioffc+mp-1
244 ioffa = iia+(jja-1)*lda
245 ioffc = iic+(jjc-1)*ldc
247 DO 90 i = ioffc, ioffc+mp-1
248 c( i ) = alpha * a( ioffa )
251 ioffa = ioffa + lda - mp
256 IF( alpha.EQ.one )
THEN
257 IF( beta.EQ.one )
THEN
258 ioffa = iia+(jja-1)*lda
259 ioffc = iic+(jjc-1)*ldc
261 DO 110 i = ioffc, ioffc+mp-1
262 c( i ) = c( i ) + a( ioffa )
265 ioffa = ioffa + lda - mp
269 ioffa = iia+(jja-1)*lda
270 ioffc = iic+(jjc-1)*ldc
272 DO 130 i = ioffc, ioffc+mp-1
273 c( i ) = beta * c( i ) + a( ioffa )
276 ioffa = ioffa + lda - mp
280 ELSE IF( beta.EQ.one )
THEN
281 ioffa = iia+(jja-1)*lda
282 ioffc = iic+(jjc-1)*ldc
284 DO 150 i = ioffc, ioffc+mp-1
285 c( i ) = c( i ) + alpha * a( ioffa )
288 ioffa = ioffa + lda - mp
292 ioffa = iia+(jja-1)*lda
293 ioffc = iic+(jjc-1)*ldc
295 DO 170 i = ioffc, ioffc+mp-1
296 c( i ) = beta * c( i ) + alpha * a( ioffa )
299 ioffa = ioffa + lda - mp