1 SUBROUTINE pzlaconsb( A, DESCA, I, L, M, H44, H33, H43H34, BUF,
10 INTEGER I, L, LWORK, M
11 COMPLEX*16 H33, H43H34, H44
15 COMPLEX*16 A( * ), BUF( * )
160 INTEGER BLOCK_CYCLIC_2D, CSRC_, CTXT_, DLEN_, DTYPE_,
161 $ lld_, mb_, m_, nb_, n_, rsrc_
162 parameter( block_cyclic_2d = 1, dlen_ = 9, dtype_ = 1,
163 $ ctxt_ = 2, m_ = 3, n_ = 4, mb_ = 5, nb_ = 6,
164 $ rsrc_ = 7, csrc_ = 8, lld_ = 9 )
167 INTEGER CONTXT, DOWN, HBL, IBUF1, IBUF2, IBUF3, IBUF4,
168 $ ibuf5, icol1, ii, ircv1, ircv2, ircv3, ircv4,
169 $ ircv5, irow1, isrc, istr1, istr2, istr3, istr4,
170 $ istr5, jj, jsrc, lda, left, modkm1, mycol,
171 $ myrow, npcol, nprow, num, right, up
172 DOUBLE PRECISION S, TST1, ULP
173 COMPLEX*16 CDUM, H00, H10, H11, H12, H21, H22, H33S, H44S,
178 DOUBLE PRECISION PDLAMCH
179 EXTERNAL ilcm, pdlamch
186 INTRINSIC abs, dble, dimag, mod
189 DOUBLE PRECISION CABS1
192 cabs1( cdum ) = abs( dble( cdum ) ) + abs( dimag( cdum ) )
197 contxt = desca( ctxt_ )
199 ulp = pdlamch( contxt,
'PRECISION' )
200 CALL blacs_gridinfo( contxt, nprow, npcol, myrow, mycol )
201 left = mod( mycol+npcol-1, npcol )
202 right = mod( mycol+1, npcol )
203 up = mod( myrow+nprow-1, nprow )
204 down = mod( myrow+1, nprow )
214 istr2 = ( ( i-l-1 ) / hbl )
215 IF( istr2*hbl.LT.( i-l-1 ) )
217 ii = istr2 / ilcm( nprow, npcol )
218 IF( ii*ilcm( nprow, npcol ).LT.istr2 )
THEN
223 IF( lwork.LT.7*istr2 )
THEN
224 CALL pxerbla( contxt,
'PZLACONSB', 10 )
228 istr4 = istr3 + istr2
229 istr5 = istr3 + istr3
230 CALL infog2l( i-2, i-2, desca, nprow, npcol, myrow, mycol, irow1,
232 modkm1 = mod( i-3+hbl, hbl )
248 DO 10 m = i - 2, l, -1
249 IF( ( modkm1.EQ.0 ) .AND. ( down.EQ.ii ) .AND.
250 $ ( right.EQ.jj ) .AND. ( m.GT.l ) )
THEN
254 IF( ( down.NE.myrow ) .OR. ( right.NE.mycol ) )
THEN
255 CALL infog2l( m-1, m-1, desca, nprow, npcol, myrow,
256 $ mycol, irow1, icol1, isrc, jsrc )
258 buf( istr1+ibuf1 ) = a( ( icol1-1 )*lda+irow1 )
261 IF( ( modkm1.EQ.0 ) .AND. ( myrow.EQ.ii ) .AND.
262 $ ( right.EQ.jj ) .AND. ( m.GT.l ) )
THEN
266 IF( npcol.GT.1 )
THEN
267 CALL infog2l( m, m-1, desca, nprow, npcol, myrow, mycol,
268 $ irow1, icol1, isrc, jsrc )
270 buf( istr5+ibuf5 ) = a( ( icol1-1 )*lda+irow1 )
273 IF( ( modkm1.EQ.hbl-1 ) .AND. ( up.EQ.ii ) .AND.
274 $ ( mycol.EQ.jj ) )
THEN
278 IF( nprow.GT.1 )
THEN
279 CALL infog2l( m+1, m, desca, nprow, npcol, myrow, mycol,
280 $ irow1, icol1, isrc, jsrc )
282 buf( istr2+ibuf2 ) = a( ( icol1-1 )*lda+irow1 )
285 IF( ( modkm1.EQ.hbl-1 ) .AND. ( myrow.EQ.ii ) .AND.
286 $ ( left.EQ.jj ) )
THEN
290 IF( npcol.GT.1 )
THEN
291 CALL infog2l( m, m+1, desca, nprow, npcol, myrow, mycol,
292 $ irow1, icol1, isrc, jsrc )
294 buf( istr3+ibuf3 ) = a( ( icol1-1 )*lda+irow1 )
297 IF( ( modkm1.EQ.hbl-1 ) .AND. ( up.EQ.ii ) .AND.
298 $ ( left.EQ.jj ) )
THEN
303 IF( ( up.NE.myrow ) .OR. ( left.NE.mycol ) )
THEN
304 CALL infog2l( m+1, m+1, desca, nprow, npcol, myrow,
305 $ mycol, irow1, icol1, isrc, jsrc )
307 buf( istr4+ibuf4-1 ) = a( ( icol1-1 )*lda+irow1 )
308 buf( istr4+ibuf4 ) = a( ( icol1-1 )*lda+irow1+1 )
311 IF( ( modkm1.EQ.hbl-2 ) .AND. ( up.EQ.ii ) .AND.
312 $ ( mycol.EQ.jj ) )
THEN
316 IF( nprow.GT.1 )
THEN
317 CALL infog2l( m+2, m+1, desca, nprow, npcol, myrow,
318 $ mycol, irow1, icol1, isrc, jsrc )
320 buf( istr2+ibuf2 ) = a( ( icol1-1 )*lda+irow1 )
326 IF( ( myrow.EQ.ii ) .AND. ( mycol.EQ.jj ) )
THEN
327 IF( ( modkm1.EQ.0 ) .AND. ( m.GT.l ) .AND.
328 $ ( ( nprow.GT.1 ) .OR. ( npcol.GT.1 ) ) )
THEN
334 IF( ( modkm1.EQ.0 ) .AND. ( npcol.GT.1 ) .AND. ( m.GT.l ) )
341 IF( ( modkm1.EQ.hbl-1 ) .AND. ( nprow.GT.1 ) )
THEN
347 IF( ( modkm1.EQ.hbl-1 ) .AND. ( npcol.GT.1 ) )
THEN
353 IF( ( modkm1.EQ.hbl-1 ) .AND.
354 $ ( ( nprow.GT.1 ) .OR. ( npcol.GT.1 ) ) )
THEN
360 IF( ( modkm1.EQ.hbl-2 ) .AND. ( nprow.GT.1 ) )
THEN
370 IF( modkm1.EQ.0 )
THEN
386 IF( ibuf1.GT.0 )
THEN
387 CALL zgesd2d( contxt, ibuf1, 1, buf( istr1+1 ), ibuf1, down,
390 IF( ibuf2.GT.0 )
THEN
391 CALL zgesd2d( contxt, ibuf2, 1, buf( istr2+1 ), ibuf2, up,
394 IF( ibuf3.GT.0 )
THEN
395 CALL zgesd2d( contxt, ibuf3, 1, buf( istr3+1 ), ibuf3, myrow,
398 IF( ibuf4.GT.0 )
THEN
399 CALL zgesd2d( contxt, ibuf4, 1, buf( istr4+1 ), ibuf4, up,
402 IF( ibuf5.GT.0 )
THEN
403 CALL zgesd2d( contxt, ibuf5, 1, buf( istr5+1 ), ibuf5, myrow,
409 IF( ircv1.GT.0 )
THEN
410 CALL zgerv2d( contxt, ircv1, 1, buf( istr1+1 ), ircv1, up,
413 IF( ircv2.GT.0 )
THEN
414 CALL zgerv2d( contxt, ircv2, 1, buf( istr2+1 ), ircv2, down,
417 IF( ircv3.GT.0 )
THEN
418 CALL zgerv2d( contxt, ircv3, 1, buf( istr3+1 ), ircv3, myrow,
421 IF( ircv4.GT.0 )
THEN
422 CALL zgerv2d( contxt, ircv4, 1, buf( istr4+1 ), ircv4, down,
425 IF( ircv5.GT.0 )
THEN
426 CALL zgerv2d( contxt, ircv5, 1, buf( istr5+1 ), ircv5, myrow,
437 CALL infog2l( i-2, i-2, desca, nprow, npcol, myrow, mycol, irow1,
439 modkm1 = mod( i-3+hbl, hbl )
440 IF( ( myrow.EQ.ii ) .AND. ( mycol.EQ.jj ) .AND.
441 $ ( modkm1.NE.hbl-1 ) )
THEN
442 CALL infog2l( i-2, i-1, desca, nprow, npcol, myrow, mycol,
443 $ irow1, icol1, isrc, jsrc )
448 DO 20 m = i - 2, l, -1
454 IF( ( myrow.EQ.ii ) .AND. ( mycol.EQ.jj ) )
THEN
455 IF( modkm1.EQ.0 )
THEN
456 h22 = a( ( icol1-1 )*lda+irow1+1 )
457 h11 = a( ( icol1-2 )*lda+irow1 )
458 v3 = a( ( icol1-1 )*lda+irow1+2 )
459 h21 = a( ( icol1-2 )*lda+irow1+1 )
460 h12 = a( ( icol1-1 )*lda+irow1 )
464 h00 = buf( istr1+ibuf1 )
466 h00 = a( ( icol1-3 )*lda+irow1-1 )
468 IF( npcol.GT.1 )
THEN
470 h10 = buf( istr5+ibuf5 )
472 h10 = a( ( icol1-3 )*lda+irow1 )
476 IF( modkm1.EQ.hbl-1 )
THEN
477 CALL infog2l( m, m, desca, nprow, npcol, myrow, mycol,
478 $ irow1, icol1, isrc, jsrc )
479 h11 = a( ( icol1-1 )*lda+irow1 )
482 h22 = buf( istr4+ibuf4-1 )
483 v3 = buf( istr4+ibuf4 )
485 h22 = a( icol1*lda+irow1+1 )
486 v3 = a( ( icol1+1 )*lda+irow1+1 )
488 IF( nprow.GT.1 )
THEN
490 h21 = buf( istr2+ibuf2 )
492 h21 = a( ( icol1-1 )*lda+irow1+1 )
494 IF( npcol.GT.1 )
THEN
496 h12 = buf( istr3+ibuf3 )
498 h12 = a( icol1*lda+irow1 )
501 h00 = a( ( icol1-2 )*lda+irow1-1 )
502 h10 = a( ( icol1-2 )*lda+irow1 )
509 IF( modkm1.EQ.hbl-2 )
THEN
510 h22 = a( ( icol1-1 )*lda+irow1+1 )
511 h11 = a( ( icol1-2 )*lda+irow1 )
512 IF( nprow.GT.1 )
THEN
514 v3 = buf( istr2+ibuf2 )
516 v3 = a( ( icol1-1 )*lda+irow1+2 )
518 h21 = a( ( icol1-2 )*lda+irow1+1 )
519 h12 = a( ( icol1-1 )*lda+irow1 )
521 h00 = a( ( icol1-3 )*lda+irow1-1 )
522 h10 = a( ( icol1-3 )*lda+irow1 )
525 IF( ( modkm1.LT.hbl-2 ) .AND. ( modkm1.GT.0 ) )
THEN
526 h22 = a( ( icol1-1 )*lda+irow1+1 )
527 h11 = a( ( icol1-2 )*lda+irow1 )
528 v3 = a( ( icol1-1 )*lda+irow1+2 )
529 h21 = a( ( icol1-2 )*lda+irow1+1 )
530 h12 = a( ( icol1-1 )*lda+irow1 )
532 h00 = a( ( icol1-3 )*lda+irow1-1 )
533 h10 = a( ( icol1-3 )*lda+irow1 )
538 v1 = ( h33s*h44s-h43h34 ) / h21 + h12
539 v2 = h22 - h11 - h33s - h44s
540 s = cabs1( v1 ) + cabs1( v2 ) + cabs1( v3 )
546 tst1 = cabs1( v1 )*( cabs1( h00 )+cabs1( h11 )+
548 IF( cabs1( h10 )*( cabs1( v2 )+cabs1( v3 ) ).LE.ulp*tst1 )
565 IF( modkm1.EQ.0 )
THEN
579 CALL igamx2d( contxt,
'ALL',
' ', 1, 1, m, 1, l, l, -1, -1, -1 )