1 SUBROUTINE pdlase2( UPLO, M, N, ALPHA, BETA, A, IA, JA, DESCA )
11 DOUBLE PRECISION alpha, beta
15 DOUBLE PRECISION A( * )
133 INTEGER BLOCK_CYCLIC_2D, CSRC_, CTXT_, DLEN_, DTYPE_,
134 $ LLD_, MB_, M_, NB_, N_, RSRC_
135 parameter( block_cyclic_2d = 1, dlen_ = 9, dtype_ = 1,
136 $ ctxt_ = 2, m_ = 3, n_ = 4, mb_ = 5, nb_ = 6,
137 $ rsrc_ = 7, csrc_ = 8, lld_ = 9 )
140 INTEGER HEIGHT, IACOL, IAROW, IBASE, ICOFFA, II, IIA,
141 $ IIBEG, IIEND, IINXT, ILEFT, IRIGHT, IROFFA,
142 $ ITOP, JJ, JJA, JJBEG, JJEND, JJNXT, LDA, MBA,
143 $ MP, MPA, MYCOL, MYDIST, MYROW, NBA, NPCOL,
144 $ NPROW, NQ, NQA, WIDE
147 EXTERNAL blacs_gridinfo, dlaset,
infog2l
151 INTEGER ICEIL, NUMROC
152 EXTERNAL iceil, lsame, numroc
159 IF( m.EQ.0 .OR. n.EQ.0 )
164 CALL blacs_gridinfo( desca( ctxt_ ), nprow, npcol, myrow, mycol )
166 CALL infog2l( ia, ja, desca, nprow, npcol, myrow, mycol, iia, jja,
171 iroffa = mod( ia-1, mba )
172 icoffa = mod( ja-1, nba )
174 IF( n.LE.( nba-icoffa ) )
THEN
212 IF( mycol.EQ.iacol )
THEN
214 mpa = numroc( m+iroffa, mba, myrow, iarow, nprow )
219 mydist = mod( myrow-iarow+nprow, nprow )
220 itop = mydist * mba - iroffa
222 IF( lsame( uplo,
'U' ) )
THEN
224 itop =
max( 0, itop )
226 iiend = iia + mpa - 1
227 iinxt =
min( iceil( iibeg, mba ) * mba, iiend )
230 IF( ( n-itop ).GT.0 )
THEN
231 CALL dlaset( uplo, iinxt-iibeg+1, n-itop, alpha, beta,
232 $ a( iibeg+(jja+itop-1)*lda ), lda )
233 mydist = mydist + nprow
234 itop = mydist * mba - iroffa
236 iinxt =
min( iinxt+mba, iiend )
240 ELSE IF( lsame( uplo,
'L' ) )
THEN
245 ibase =
min( itop+mba, n )
246 itop =
min(
max( 0, itop ), n )
249 IF( jj.LE.( jja+n-1 ) )
THEN
250 height = ibase - itop
251 CALL dlaset(
'All', mp, itop-jj+jja, alpha, alpha,
252 $ a( ii+(jj-1)*lda ), lda )
253 CALL dlaset( uplo, mp, height, alpha, beta,
254 $ a( ii+(jja+itop-1)*lda ), lda )
255 mp =
max( 0, mp - height )
258 mydist = mydist + nprow
259 itop = mydist * mba - iroffa
260 ibase =
min( itop + mba, n )
261 itop =
min( itop, n )
270 ibase =
min( itop+mba, n )
271 itop =
min(
max( 0, itop ), n )
274 IF( jj.LE.( jja+n-1 ) )
THEN
275 height = ibase - itop
276 CALL dlaset(
'All', mpa, itop-jj+jja, alpha, alpha,
277 $ a( iia+(jj-1)*lda ), lda )
278 CALL dlaset(
'All', mpa-mp, height, alpha, alpha,
279 $ a( iia+(jja+itop-1)*lda ), lda )
280 CALL dlaset(
'All', mp, height, alpha, beta,
281 $ a( ii+(jja+itop-1)*lda ), lda )
282 mp =
max( 0, mp - height )
285 mydist = mydist + nprow
286 itop = mydist * mba - iroffa
287 ibase =
min( itop + mba, n )
288 itop =
min( itop, n )
296 ELSE IF( m.LE.( mba-iroffa ) )
THEN
321 IF( myrow.EQ.iarow )
THEN
323 nqa = numroc( n+icoffa, nba, mycol, iacol, npcol )
328 mydist = mod( mycol-iacol+npcol, npcol )
329 ileft = mydist * nba - icoffa
331 IF( lsame( uplo,
'L' ) )
THEN
333 ileft =
max( 0, ileft )
335 jjend = jja + nqa - 1
336 jjnxt =
min( iceil( jjbeg, nba ) * nba, jjend )
339 IF( ( m-ileft ).GT.0 )
THEN
340 CALL dlaset( uplo, m-ileft, jjnxt-jjbeg+1, alpha,
341 $ beta, a( iia+ileft+(jjbeg-1)*lda ), lda )
342 mydist = mydist + npcol
343 ileft = mydist * nba - icoffa
345 jjnxt =
min( jjnxt+nba, jjend )
349 ELSE IF( lsame( uplo,
'U' ) )
THEN
354 iright =
min( ileft+nba, m )
355 ileft =
min(
max( 0, ileft ), m )
358 IF( ii.LE.( iia+m-1 ) )
THEN
359 wide = iright - ileft
360 CALL dlaset(
'All', ileft-ii+iia, nq, alpha, alpha,
361 $ a( ii+(jj-1)*lda ), lda )
362 CALL dlaset( uplo, wide, nq, alpha, beta,
363 $ a( iia+ileft+(jj-1)*lda ), lda )
364 nq =
max( 0, nq - wide )
367 mydist = mydist + npcol
368 ileft = mydist * nba - icoffa
369 iright =
min( ileft + nba, m )
370 ileft =
min( ileft, m )
379 iright =
min( ileft+nba, m )
380 ileft =
min(
max( 0, ileft ), m )
383 IF( ii.LE.( iia+m-1 ) )
THEN
384 wide = iright - ileft
385 CALL dlaset(
'All', ileft-ii+iia, nqa, alpha, alpha,
386 $ a( ii+(jja-1)*lda ), lda )
387 CALL dlaset(
'All', wide, nqa-nq, alpha, alpha,
388 $ a( iia+ileft+(jja-1)*lda ), lda )
389 CALL dlaset(
'All', wide, nq, alpha, beta,
390 $ a( iia+ileft+(jj-1)*lda ), lda )
391 nq =
max( 0, nq - wide )
394 mydist = mydist + npcol
395 ileft = mydist * nba - icoffa
396 iright =
min( ileft + nba, m )
397 ileft =
min( ileft, m )