1 SUBROUTINE pzlascl( TYPE, CFROM, CTO, M, N, A, IA, JA, DESCA,
11 INTEGER IA, INFO, JA, M, N
12 DOUBLE PRECISION CFROM, CTO
136 INTEGER BLOCK_CYCLIC_2D, CSRC_, CTXT_, DLEN_, DTYPE_,
137 $ lld_, mb_, m_, nb_, n_, rsrc_
138 parameter( block_cyclic_2d = 1, dlen_ = 9, dtype_ = 1,
139 $ ctxt_ = 2, m_ = 3, n_ = 4, mb_ = 5, nb_ = 6,
140 $ rsrc_ = 7, csrc_ = 8, lld_ = 9 )
141 DOUBLE PRECISION ONE, ZERO
142 parameter( zero = 0.0d0, one = 1.0d0 )
146 INTEGER IACOL, IAROW, ICOFFA, ICTXT, ICURCOL, ICURROW,
147 $ iia, ii, inxtrow, ioffa, iroffa, itype, j, jb,
148 $ jja, jj, jn, kk, lda, ll, mycol, myrow, mp,
150 DOUBLE PRECISION BIGNUM, CFROM1, CFROMC, CTO1, CTOC, MUL, SMLNUM
156 LOGICAL LSAME, DISNAN
157 INTEGER ICEIL, NUMROC
158 DOUBLE PRECISION PDLAMCH
159 EXTERNAL disnan, iceil, lsame, numroc, pdlamch
162 INTRINSIC abs,
min, mod
168 ictxt = desca( ctxt_ )
169 CALL blacs_gridinfo( ictxt, nprow, npcol, myrow, mycol )
173 IF( nprow.EQ.-1 )
THEN
177 CALL chk1mat( m, 4, n, 6, ia, ja, desca, 9, info )
179 IF( lsame(
TYPE,
'G' ) ) then
181 ELSE IF( lsame(
TYPE,
'L' ) ) then
183 ELSE IF( lsame(
TYPE,
'U' ) ) then
185 ELSE IF( lsame(
TYPE,
'H' ) ) then
190 IF( itype.EQ.-1 )
THEN
192 ELSE IF( cfrom.EQ.zero .OR. disnan(cfrom) )
THEN
194 ELSE IF( disnan(cto) )
THEN
201 CALL pxerbla( ictxt,
'PZLASCL', -info )
207 IF( n.EQ.0 .OR. m.EQ.0 )
212 smlnum = pdlamch( ictxt,
'S' )
213 bignum = one / smlnum
221 iroffa = mod( ia-1, desca( mb_ ) )
222 icoffa = mod( ja-1, desca( nb_ ) )
223 jn =
min( iceil( ja, desca( nb_ ) ) * desca( nb_ ), ja+n-1 )
224 CALL infog2l( ia, ja, desca, nprow, npcol, myrow, mycol, iia, jja,
226 mp = numroc( m+iroffa, desca( mb_ ), myrow, iarow, nprow )
229 nq = numroc( n+icoffa, desca( nb_ ), mycol, iacol, npcol )
234 cfrom1 = cfromc*smlnum
235 IF( cfrom1.EQ.cfromc )
THEN
243 IF( cto1.EQ.ctoc )
THEN
249 ELSE IF( abs( cfrom1 ).GT.abs( ctoc ) .AND. ctoc.NE.zero )
THEN
253 ELSE IF( abs( cto1 ).GT.abs( cfromc ) )
THEN
263 ioffa = ( jja - 1 ) * lda
267 IF( itype.EQ.0 )
THEN
271 DO 30 jj = jja, jja+nq-1
272 DO 20 ii = iia, iia+mp-1
273 a( ioffa+ii ) = a( ioffa+ii ) * mul
278 ELSE IF( itype.EQ.1 )
THEN
286 IF( mycol.EQ.icurcol )
THEN
287 IF( myrow.EQ.icurrow )
THEN
288 DO 50 ll = jj, jj + jb -1
289 DO 40 kk = ii+ll-jj, iia+mp-1
290 a( ioffa+kk ) = a( ioffa+kk ) * mul
295 DO 70 ll = jj, jj + jb -1
296 DO 60 kk = ii, iia+mp-1
297 a( ioffa+kk ) = a( ioffa+kk ) * mul
305 IF( myrow.EQ.icurrow )
307 icurrow = mod( icurrow+1, nprow )
308 icurcol = mod( icurcol+1, npcol )
312 DO 120 j = jn+1, ja+n-1, desca( nb_ )
313 jb =
min( ja+n-j, desca( nb_ ) )
315 IF( mycol.EQ.icurcol )
THEN
316 IF( myrow.EQ.icurrow )
THEN
317 DO 90 ll = jj, jj + jb -1
318 DO 80 kk = ii+ll-jj, iia+mp-1
319 a( ioffa+kk ) = a( ioffa+kk ) * mul
324 DO 110 ll = jj, jj + jb -1
325 DO 100 kk = ii, iia+mp-1
326 a( ioffa+kk ) = a( ioffa+kk ) * mul
334 IF( myrow.EQ.icurrow )
336 icurrow = mod( icurrow+1, nprow )
337 icurcol = mod( icurcol+1, npcol )
341 ELSE IF( itype.EQ.2 )
THEN
349 IF( mycol.EQ.icurcol )
THEN
350 IF( myrow.EQ.icurrow )
THEN
351 DO 140 ll = jj, jj + jb -1
352 DO 130 kk = iia,
min(ii+ll-jj,iia+mp-1)
353 a( ioffa+kk ) = a( ioffa+kk ) * mul
358 DO 160 ll = jj, jj + jb -1
359 DO 150 kk = iia,
min(ii-1,iia+mp-1)
360 a( ioffa+kk ) = a( ioffa+kk ) * mul
368 IF( myrow.EQ.icurrow )
370 icurrow = mod( icurrow+1, nprow )
371 icurcol = mod( icurcol+1, npcol )
375 DO 210 j = jn+1, ja+n-1, desca( nb_ )
376 jb =
min( ja+n-j, desca( nb_ ) )
378 IF( mycol.EQ.icurcol )
THEN
379 IF( myrow.EQ.icurrow )
THEN
380 DO 180 ll = jj, jj + jb -1
381 DO 170 kk = iia,
min(ii+ll-jj,iia+mp-1)
382 a( ioffa+kk ) = a( ioffa+kk )*mul
387 DO 200 ll = jj, jj + jb -1
388 DO 190 kk = iia,
min(ii-1,iia+mp-1)
389 a( ioffa+kk ) = a( ioffa+kk ) * mul
397 IF( myrow.EQ.icurrow )
399 icurrow = mod( icurrow+1, nprow )
400 icurcol = mod( icurcol+1, npcol )
404 ELSE IF( itype.EQ.3 )
THEN
414 IF( nprow.EQ.1 )
THEN
418 IF( mycol.EQ.icurcol )
THEN
419 DO 230 ll = jj, jj+jb-1
420 DO 220 kk = iia,
min( ii+ll-jj+1, iia+mp-1 )
421 a( ioffa+kk ) = a( ioffa+kk )*mul
428 icurcol = mod( icurcol+1, npcol )
432 DO 260 j = jn+1, ja+n-1, desca( nb_ )
433 jb =
min( ja+n-j, desca( nb_ ) )
435 IF( mycol.EQ.icurcol )
THEN
436 DO 250 ll = jj, jj+jb-1
437 DO 240 kk = iia,
min( ii+ll-jj+1, iia+mp-1 )
438 a( ioffa+kk ) = a( ioffa+kk )*mul
446 icurcol = mod( icurcol+1, npcol )
454 inxtrow = mod( icurrow+1, nprow )
455 IF( mycol.EQ.icurcol )
THEN
456 IF( myrow.EQ.icurrow )
THEN
457 DO 280 ll = jj, jj + jb -1
458 DO 270 kk = iia,
min(ii+ll-jj+1,iia+mp-1)
459 a( ioffa+kk ) = a( ioffa+kk ) * mul
464 DO 300 ll = jj, jj + jb -1
465 DO 290 kk = iia,
min(ii-1,iia+mp-1)
466 a( ioffa+kk ) = a( ioffa+kk ) * mul
470 IF( myrow.EQ.inxtrow .AND. ii.LE.iia+mp-1 )
471 $ a( ii+(jj+jb-2)*lda ) = a( ii+(jj+jb-2)*lda ) * mul
476 IF( myrow.EQ.icurrow )
479 icurrow = mod( icurrow+1, nprow )
480 icurcol = mod( icurcol+1, npcol )
484 DO 350 j = jn+1, ja+n-1, desca( nb_ )
485 jb =
min( ja+n-j, desca( nb_ ) )
487 IF( mycol.EQ.icurcol )
THEN
488 IF( myrow.EQ.icurrow )
THEN
489 DO 320 ll = jj, jj + jb -1
490 DO 310 kk = iia,
min( ii+ll-jj+1, iia+mp-1 )
491 a( ioffa+kk ) = a( ioffa+kk ) * mul
496 DO 340 ll = jj, jj + jb -1
497 DO 330 kk = iia,
min( ii-1, iia+mp-1 )
498 a( ioffa+kk ) = a( ioffa+kk ) * mul
502 IF( myrow.EQ.inxtrow .AND. ii.LE.iia+mp-1 )
503 $ a( ii+(jj+jb-2)*lda ) = a( ii+(jj+jb-2)*lda ) *
509 IF( myrow.EQ.icurrow )
512 icurrow = mod( icurrow+1, nprow )
513 icurcol = mod( icurcol+1, npcol )