1 SUBROUTINE pzlasmsub( A, DESCA, I, L, K, SMLNUM, BUF, LWORK )
10 DOUBLE PRECISION SMLNUM
14 COMPLEX*16 A( * ), BUF( * )
142 INTEGER BLOCK_CYCLIC_2D, CSRC_, CTXT_, DLEN_, DTYPE_,
143 $ LLD_, MB_, M_, NB_, N_, RSRC_
144 parameter( block_cyclic_2d = 1, dlen_ = 9, dtype_ = 1,
145 $ ctxt_ = 2, m_ = 3, n_ = 4, mb_ = 5, nb_ = 6,
146 $ rsrc_ = 7, csrc_ = 8, lld_ = 9 )
147 DOUBLE PRECISION ZERO
148 parameter( zero = 0.0d+0 )
151 INTEGER CONTXT, DOWN, HBL, IBUF1, IBUF2, ICOL1, ICOL2,
152 $ II, III, IRCV1, IRCV2, IROW1, IROW2, ISRC,
153 $ ISTR1, ISTR2, ITMP1, ITMP2, JJ, JJJ, JSRC, LDA,
154 $ LEFT, MODKM1, MYCOL, MYROW, NPCOL, NPROW, NUM,
156 DOUBLE PRECISION TST1, ULP
157 COMPLEX*16 CDUM, H10, H11, H22
161 DOUBLE PRECISION PDLAMCH
162 EXTERNAL ilcm, numroc, pdlamch
169 INTRINSIC abs, dble, dimag,
max, mod
172 DOUBLE PRECISION CABS1
175 cabs1( cdum ) = abs( dble( cdum ) ) + abs( dimag( cdum ) )
180 contxt = desca( ctxt_ )
182 ulp = pdlamch( contxt,
'PRECISION' )
183 CALL blacs_gridinfo( contxt, nprow, npcol, myrow, mycol )
184 left = mod( mycol+npcol-1, npcol )
185 right = mod( mycol+1, npcol )
186 up = mod( myrow+nprow-1, nprow )
187 down = mod( myrow+1, nprow )
194 istr2 = ( ( i-l ) / hbl )
195 IF( istr2*hbl.LT.( i-l ) )
197 ii = istr2 / ilcm( nprow, npcol )
198 IF( ii*ilcm( nprow, npcol ).LT.istr2 )
THEN
203 IF( lwork.LT.2*istr2 )
THEN
209 CALL infog2l( i, i, desca, nprow, npcol, myrow, mycol, irow1,
211 modkm1 = mod( i-1+hbl, hbl )
221 DO 10 k = i, l + 1, -1
222 IF( ( modkm1.EQ.0 ) .AND. ( down.EQ.ii ) .AND.
223 $ ( right.EQ.jj ) )
THEN
227 IF( ( down.NE.myrow ) .OR. ( right.NE.mycol ) )
THEN
228 CALL infog2l( k-1, k-1, desca, nprow, npcol, myrow,
229 $ mycol, irow1, icol1, isrc, jsrc )
231 buf( istr1+ibuf1 ) = a( ( icol1-1 )*lda+irow1 )
234 IF( ( modkm1.EQ.0 ) .AND. ( myrow.EQ.ii ) .AND.
235 $ ( right.EQ.jj ) )
THEN
239 IF( npcol.GT.1 )
THEN
240 CALL infog2l( k, k-1, desca, nprow, npcol, myrow, mycol,
241 $ irow1, icol1, isrc, jsrc )
243 buf( istr2+ibuf2 ) = a( ( icol1-1 )*lda+irow1 )
249 IF( ( myrow.EQ.ii ) .AND. ( mycol.EQ.jj ) )
THEN
250 IF( ( modkm1.EQ.0 ) .AND. ( ( nprow.GT.1 ) .OR. ( npcol.GT.
257 IF( ( modkm1.EQ.0 ) .AND. ( npcol.GT.1 ) )
THEN
267 IF( modkm1.EQ.0 )
THEN
282 IF( ibuf1.GT.0 )
THEN
283 CALL zgesd2d( contxt, ibuf1, 1, buf( istr1+1 ), ibuf1, down,
286 IF( ibuf2.GT.0 )
THEN
287 CALL zgesd2d( contxt, ibuf2, 1, buf( istr2+1 ), ibuf2, myrow,
293 IF( ircv1.GT.0 )
THEN
294 CALL zgerv2d( contxt, ircv1, 1, buf( istr1+1 ), ircv1, up,
297 IF( ircv2.GT.0 )
THEN
298 CALL zgerv2d( contxt, ircv2, 1, buf( istr2+1 ), ircv2, myrow,
306 CALL infog2l( i, i, desca, nprow, npcol, myrow, mycol, irow1,
308 modkm1 = mod( i-1+hbl, hbl )
314 DO 40 k = i, l + 1, -1
315 IF( ( myrow.EQ.ii ) .AND. ( mycol.EQ.jj ) )
THEN
316 IF( modkm1.EQ.0 )
THEN
322 h11 = buf( istr1+ibuf1 )
324 h11 = a( ( icol1-2 )*lda+irow1-1 )
326 IF( npcol.GT.1 )
THEN
328 h10 = buf( istr2+ibuf2 )
330 h10 = a( ( icol1-2 )*lda+irow1 )
336 h11 = a( ( icol1-2 )*lda+irow1-1 )
337 h10 = a( ( icol1-2 )*lda+irow1 )
339 h22 = a( ( icol1-1 )*lda+irow1 )
340 tst1 = cabs1( h11 ) + cabs1( h22 )
341 IF( tst1.EQ.zero )
THEN
345 CALL infog1l( l, hbl, nprow, myrow, 0, itmp1, iii )
346 irow2 = numroc( i, hbl, myrow, 0, nprow )
347 CALL infog1l( l, hbl, npcol, mycol, 0, itmp2, iii )
348 icol2 = numroc( i, hbl, mycol, 0, npcol )
349 DO 30 iii = itmp1, irow2
350 DO 20 jjj = itmp2, icol2
351 tst1 = tst1 + cabs1( a( ( jjj-1 )*lda+iii ) )
355 IF( cabs1( h10 ).LE.
max( ulp*tst1, smlnum ) )
363 IF( ( modkm1.EQ.hbl-1 ) .AND. ( k.GT.2 ) )
THEN
364 ii = mod( ii+nprow-1, nprow )
365 jj = mod( jj+npcol-1, npcol )
366 CALL infog2l( k-1, k-1, desca, nprow, npcol, myrow, mycol,
367 $ irow1, icol1, itmp1, itmp2 )
371 CALL igamx2d( contxt,
'ALL',
' ', 1, 1, k, 1, itmp1, itmp2, -1,