1 SUBROUTINE pdlasmsub( A, DESCA, I, L, K, SMLNUM, BUF, LWORK )
10 DOUBLE PRECISION SMLNUM
14 DOUBLE PRECISION A( * ), BUF( * )
140 INTEGER BLOCK_CYCLIC_2D, CSRC_, CTXT_, DLEN_, DTYPE_,
141 $ LLD_, MB_, M_, NB_, N_, RSRC_
142 parameter( block_cyclic_2d = 1, dlen_ = 9, dtype_ = 1,
143 $ ctxt_ = 2, m_ = 3, n_ = 4, mb_ = 5, nb_ = 6,
144 $ rsrc_ = 7, csrc_ = 8, lld_ = 9 )
145 DOUBLE PRECISION ZERO
146 parameter( zero = 0.0d+0 )
149 INTEGER CONTXT, DOWN, HBL, IAFIRST, IBUF1, IBUF2,
150 $ ICOL1, ICOL2, II, III, IRCV1, IRCV2, IROW1,
151 $ IROW2, ISRC, ISTR1, ISTR2, ITMP1, ITMP2,
152 $ JAFIRST, JJ, JJJ, JSRC, LDA, LEFT, MODKM1,
153 $ MYCOL, MYROW, NPCOL, NPROW, NUM, RIGHT, UP
154 DOUBLE PRECISION H10, H11, H22, TST1, ULP
158 DOUBLE PRECISION PDLAMCH
159 EXTERNAL ilcm, numroc, pdlamch
162 EXTERNAL blacs_gridinfo, dgerv2d, dgesd2d, igamx2d,
166 INTRINSIC abs,
max, mod
171 contxt = desca( ctxt_ )
173 iafirst = desca( rsrc_ )
174 jafirst = desca( csrc_ )
175 ulp = pdlamch( contxt,
'PRECISION' )
176 CALL blacs_gridinfo( contxt, nprow, npcol, myrow, mycol )
177 left = mod( mycol+npcol-1, npcol )
178 right = mod( mycol+1, npcol )
179 up = mod( myrow+nprow-1, nprow )
180 down = mod( myrow+1, nprow )
187 istr2 = ( ( i-l ) / hbl )
188 IF( istr2*hbl.LT.( i-l ) )
190 ii = istr2 / ilcm( nprow, npcol )
191 IF( ii*ilcm( nprow, npcol ).LT.istr2 )
THEN
196 IF( lwork.LT.2*istr2 )
THEN
202 CALL infog2l( i, i, desca, nprow, npcol, myrow, mycol, irow1,
204 modkm1 = mod( i-1+hbl, hbl )
214 DO 10 k = i, l + 1, -1
215 IF( ( modkm1.EQ.0 ) .AND. ( down.EQ.ii ) .AND.
216 $ ( right.EQ.jj ) )
THEN
220 IF( ( down.NE.myrow ) .OR. ( right.NE.mycol ) )
THEN
221 CALL infog2l( k-1, k-1, desca, nprow, npcol, myrow,
222 $ mycol, irow1, icol1, isrc, jsrc )
224 buf( istr1+ibuf1 ) = a( ( icol1-1 )*lda+irow1 )
227 IF( ( modkm1.EQ.0 ) .AND. ( myrow.EQ.ii ) .AND.
228 $ ( right.EQ.jj ) )
THEN
232 IF( npcol.GT.1 )
THEN
233 CALL infog2l( k, k-1, desca, nprow, npcol, myrow, mycol,
234 $ irow1, icol1, isrc, jsrc )
236 buf( istr2+ibuf2 ) = a( ( icol1-1 )*lda+irow1 )
242 IF( ( myrow.EQ.ii ) .AND. ( mycol.EQ.jj ) )
THEN
243 IF( ( modkm1.EQ.0 ) .AND. ( ( nprow.GT.1 ) .OR. ( npcol.GT.
250 IF( ( modkm1.EQ.0 ) .AND. ( npcol.GT.1 ) )
THEN
260 IF( modkm1.EQ.0 )
THEN
275 IF( ibuf1.GT.0 )
THEN
276 CALL dgesd2d( contxt, ibuf1, 1, buf( istr1+1 ), ibuf1, down,
279 IF( ibuf2.GT.0 )
THEN
280 CALL dgesd2d( contxt, ibuf2, 1, buf( istr2+1 ), ibuf2, myrow,
286 IF( ircv1.GT.0 )
THEN
287 CALL dgerv2d( contxt, ircv1, 1, buf( istr1+1 ), ircv1, up,
290 IF( ircv2.GT.0 )
THEN
291 CALL dgerv2d( contxt, ircv2, 1, buf( istr2+1 ), ircv2, myrow,
299 CALL infog2l( i, i, desca, nprow, npcol, myrow, mycol, irow1,
301 modkm1 = mod( i-1+hbl, hbl )
307 DO 40 k = i, l + 1, -1
308 IF( ( myrow.EQ.ii ) .AND. ( mycol.EQ.jj ) )
THEN
309 IF( modkm1.EQ.0 )
THEN
315 h11 = buf( istr1+ibuf1 )
317 h11 = a( ( icol1-2 )*lda+irow1-1 )
319 IF( npcol.GT.1 )
THEN
321 h10 = buf( istr2+ibuf2 )
323 h10 = a( ( icol1-2 )*lda+irow1 )
329 h11 = a( ( icol1-2 )*lda+irow1-1 )
330 h10 = a( ( icol1-2 )*lda+irow1 )
332 h22 = a( ( icol1-1 )*lda+irow1 )
333 tst1 = abs( h11 ) + abs( h22 )
334 IF( tst1.EQ.zero )
THEN
338 CALL infog1l( l, hbl, nprow, myrow, iafirst, itmp1, iii )
339 irow2 = numroc( i, hbl, myrow, iafirst, nprow )
340 CALL infog1l( l, hbl, npcol, mycol, jafirst, itmp2, iii )
341 icol2 = numroc( i, hbl, mycol, jafirst, npcol )
342 DO 30 iii = itmp1, irow2
343 DO 20 jjj = itmp2, icol2
344 tst1 = tst1 + abs( a( ( jjj-1 )*lda+iii ) )
348 IF( abs( h10 ).LE.
max( ulp*tst1, smlnum ) )
356 IF( ( modkm1.EQ.hbl-1 ) .AND. ( k.GT.2 ) )
THEN
357 ii = mod( ii+nprow-1, nprow )
358 jj = mod( jj+npcol-1, npcol )
359 CALL infog2l( k-1, k-1, desca, nprow, npcol, myrow, mycol,
360 $ irow1, icol1, itmp1, itmp2 )
364 CALL igamx2d( contxt,
'ALL',
' ', 1, 1, k, 1, itmp1, itmp2, -1,