1 SUBROUTINE pdlaconsb( A, DESCA, I, L, M, H44, H33, H43H34, BUF,
10 INTEGER I, L, LWORK, M
11 DOUBLE PRECISION H33, H43H34, H44
15 DOUBLE PRECISION A( * ), BUF( * )
157 INTEGER BLOCK_CYCLIC_2D, CSRC_, CTXT_, DLEN_, DTYPE_,
158 $ lld_, mb_, m_, nb_, n_, rsrc_
159 parameter( block_cyclic_2d = 1, dlen_ = 9, dtype_ = 1,
160 $ ctxt_ = 2, m_ = 3, n_ = 4, mb_ = 5, nb_ = 6,
161 $ rsrc_ = 7, csrc_ = 8, lld_ = 9 )
164 INTEGER CONTXT, DOWN, HBL, IBUF1, IBUF2, IBUF3, IBUF4,
165 $ ibuf5, icol1, ii, ircv1, ircv2, ircv3, ircv4,
166 $ ircv5, irow1, isrc, istr1, istr2, istr3, istr4,
167 $ istr5, jj, jsrc, lda, left, modkm1, mycol,
168 $ myrow, npcol, nprow, num, right, up
169 DOUBLE PRECISION H00, H10, H11, H12, H21, H22, H33S, H44S, S,
170 $ tst1, ulp, v1, v2, v3
174 DOUBLE PRECISION PDLAMCH
175 EXTERNAL ilcm, pdlamch
178 EXTERNAL blacs_gridinfo, dgerv2d, dgesd2d, igamx2d,
187 contxt = desca( ctxt_ )
189 ulp = pdlamch( contxt,
'PRECISION' )
190 CALL blacs_gridinfo( contxt, nprow, npcol, myrow, mycol )
191 left = mod( mycol+npcol-1, npcol )
192 right = mod( mycol+1, npcol )
193 up = mod( myrow+nprow-1, nprow )
194 down = mod( myrow+1, nprow )
204 istr2 = ( ( i-l-1 ) / hbl )
205 IF( istr2*hbl.LT.( i-l-1 ) )
207 ii = istr2 / ilcm( nprow, npcol )
208 IF( ii*ilcm( nprow, npcol ).LT.istr2 )
THEN
213 IF( lwork.LT.7*istr2 )
THEN
214 CALL pxerbla( contxt,
'PDLACONSB', 10 )
218 istr4 = istr3 + istr2
219 istr5 = istr3 + istr3
220 CALL infog2l( i-2, i-2, desca, nprow, npcol, myrow, mycol, irow1,
222 modkm1 = mod( i-3+hbl, hbl )
238 DO 10 m = i - 2, l, -1
239 IF( ( modkm1.EQ.0 ) .AND. ( down.EQ.ii ) .AND.
240 $ ( right.EQ.jj ) .AND. ( m.GT.l ) )
THEN
244 IF( ( down.NE.myrow ) .OR. ( right.NE.mycol ) )
THEN
245 CALL infog2l( m-1, m-1, desca, nprow, npcol, myrow,
246 $ mycol, irow1, icol1, isrc, jsrc )
248 buf( istr1+ibuf1 ) = a( ( icol1-1 )*lda+irow1 )
251 IF( ( modkm1.EQ.0 ) .AND. ( myrow.EQ.ii ) .AND.
252 $ ( right.EQ.jj ) .AND. ( m.GT.l ) )
THEN
256 IF( npcol.GT.1 )
THEN
257 CALL infog2l( m, m-1, desca, nprow, npcol, myrow, mycol,
258 $ irow1, icol1, isrc, jsrc )
260 buf( istr5+ibuf5 ) = a( ( icol1-1 )*lda+irow1 )
263 IF( ( modkm1.EQ.hbl-1 ) .AND. ( up.EQ.ii ) .AND.
264 $ ( mycol.EQ.jj ) )
THEN
268 IF( nprow.GT.1 )
THEN
269 CALL infog2l( m+1, m, desca, nprow, npcol, myrow, mycol,
270 $ irow1, icol1, isrc, jsrc )
272 buf( istr2+ibuf2 ) = a( ( icol1-1 )*lda+irow1 )
275 IF( ( modkm1.EQ.hbl-1 ) .AND. ( myrow.EQ.ii ) .AND.
276 $ ( left.EQ.jj ) )
THEN
280 IF( npcol.GT.1 )
THEN
281 CALL infog2l( m, m+1, desca, nprow, npcol, myrow, mycol,
282 $ irow1, icol1, isrc, jsrc )
284 buf( istr3+ibuf3 ) = a( ( icol1-1 )*lda+irow1 )
287 IF( ( modkm1.EQ.hbl-1 ) .AND. ( up.EQ.ii ) .AND.
288 $ ( left.EQ.jj ) )
THEN
293 IF( ( up.NE.myrow ) .OR. ( left.NE.mycol ) )
THEN
294 CALL infog2l( m+1, m+1, desca, nprow, npcol, myrow,
295 $ mycol, irow1, icol1, isrc, jsrc )
297 buf( istr4+ibuf4-1 ) = a( ( icol1-1 )*lda+irow1 )
298 buf( istr4+ibuf4 ) = a( ( icol1-1 )*lda+irow1+1 )
301 IF( ( modkm1.EQ.hbl-2 ) .AND. ( up.EQ.ii ) .AND.
302 $ ( mycol.EQ.jj ) )
THEN
306 IF( nprow.GT.1 )
THEN
307 CALL infog2l( m+2, m+1, desca, nprow, npcol, myrow,
308 $ mycol, irow1, icol1, isrc, jsrc )
310 buf( istr2+ibuf2 ) = a( ( icol1-1 )*lda+irow1 )
316 IF( ( myrow.EQ.ii ) .AND. ( mycol.EQ.jj ) )
THEN
317 IF( ( modkm1.EQ.0 ) .AND. ( m.GT.l ) .AND.
318 $ ( ( nprow.GT.1 ) .OR. ( npcol.GT.1 ) ) )
THEN
324 IF( ( modkm1.EQ.0 ) .AND. ( npcol.GT.1 ) .AND. ( m.GT.l ) )
331 IF( ( modkm1.EQ.hbl-1 ) .AND. ( nprow.GT.1 ) )
THEN
337 IF( ( modkm1.EQ.hbl-1 ) .AND. ( npcol.GT.1 ) )
THEN
343 IF( ( modkm1.EQ.hbl-1 ) .AND.
344 $ ( ( nprow.GT.1 ) .OR. ( npcol.GT.1 ) ) )
THEN
350 IF( ( modkm1.EQ.hbl-2 ) .AND. ( nprow.GT.1 ) )
THEN
360 IF( modkm1.EQ.0 )
THEN
376 IF( ibuf1.GT.0 )
THEN
377 CALL dgesd2d( contxt, ibuf1, 1, buf( istr1+1 ), ibuf1, down,
380 IF( ibuf2.GT.0 )
THEN
381 CALL dgesd2d( contxt, ibuf2, 1, buf( istr2+1 ), ibuf2, up,
384 IF( ibuf3.GT.0 )
THEN
385 CALL dgesd2d( contxt, ibuf3, 1, buf( istr3+1 ), ibuf3, myrow,
388 IF( ibuf4.GT.0 )
THEN
389 CALL dgesd2d( contxt, ibuf4, 1, buf( istr4+1 ), ibuf4, up,
392 IF( ibuf5.GT.0 )
THEN
393 CALL dgesd2d( contxt, ibuf5, 1, buf( istr5+1 ), ibuf5, myrow,
399 IF( ircv1.GT.0 )
THEN
400 CALL dgerv2d( contxt, ircv1, 1, buf( istr1+1 ), ircv1, up,
403 IF( ircv2.GT.0 )
THEN
404 CALL dgerv2d( contxt, ircv2, 1, buf( istr2+1 ), ircv2, down,
407 IF( ircv3.GT.0 )
THEN
408 CALL dgerv2d( contxt, ircv3, 1, buf( istr3+1 ), ircv3, myrow,
411 IF( ircv4.GT.0 )
THEN
412 CALL dgerv2d( contxt, ircv4, 1, buf( istr4+1 ), ircv4, down,
415 IF( ircv5.GT.0 )
THEN
416 CALL dgerv2d( contxt, ircv5, 1, buf( istr5+1 ), ircv5, myrow,
427 CALL infog2l( i-2, i-2, desca, nprow, npcol, myrow, mycol, irow1,
429 modkm1 = mod( i-3+hbl, hbl )
430 IF( ( myrow.EQ.ii ) .AND. ( mycol.EQ.jj ) .AND.
431 $ ( modkm1.NE.hbl-1 ) )
THEN
432 CALL infog2l( i-2, i-1, desca, nprow, npcol, myrow, mycol,
433 $ irow1, icol1, isrc, jsrc )
438 DO 20 m = i - 2, l, -1
444 IF( ( myrow.EQ.ii ) .AND. ( mycol.EQ.jj ) )
THEN
445 IF( modkm1.EQ.0 )
THEN
446 h22 = a( ( icol1-1 )*lda+irow1+1 )
447 h11 = a( ( icol1-2 )*lda+irow1 )
448 v3 = a( ( icol1-1 )*lda+irow1+2 )
449 h21 = a( ( icol1-2 )*lda+irow1+1 )
450 h12 = a( ( icol1-1 )*lda+irow1 )
454 h00 = buf( istr1+ibuf1 )
456 h00 = a( ( icol1-3 )*lda+irow1-1 )
458 IF( npcol.GT.1 )
THEN
460 h10 = buf( istr5+ibuf5 )
462 h10 = a( ( icol1-3 )*lda+irow1 )
466 IF( modkm1.EQ.hbl-1 )
THEN
467 CALL infog2l( m, m, desca, nprow, npcol, myrow, mycol,
468 $ irow1, icol1, isrc, jsrc )
469 h11 = a( ( icol1-1 )*lda+irow1 )
472 h22 = buf( istr4+ibuf4-1 )
473 v3 = buf( istr4+ibuf4 )
475 h22 = a( icol1*lda+irow1+1 )
476 v3 = a( ( icol1+1 )*lda+irow1+1 )
478 IF( nprow.GT.1 )
THEN
480 h21 = buf( istr2+ibuf2 )
482 h21 = a( ( icol1-1 )*lda+irow1+1 )
484 IF( npcol.GT.1 )
THEN
486 h12 = buf( istr3+ibuf3 )
488 h12 = a( icol1*lda+irow1 )
491 h00 = a( ( icol1-2 )*lda+irow1-1 )
492 h10 = a( ( icol1-2 )*lda+irow1 )
499 IF( modkm1.EQ.hbl-2 )
THEN
500 h22 = a( ( icol1-1 )*lda+irow1+1 )
501 h11 = a( ( icol1-2 )*lda+irow1 )
502 IF( nprow.GT.1 )
THEN
504 v3 = buf( istr2+ibuf2 )
506 v3 = a( ( icol1-1 )*lda+irow1+2 )
508 h21 = a( ( icol1-2 )*lda+irow1+1 )
509 h12 = a( ( icol1-1 )*lda+irow1 )
511 h00 = a( ( icol1-3 )*lda+irow1-1 )
512 h10 = a( ( icol1-3 )*lda+irow1 )
515 IF( ( modkm1.LT.hbl-2 ) .AND. ( modkm1.GT.0 ) )
THEN
516 h22 = a( ( icol1-1 )*lda+irow1+1 )
517 h11 = a( ( icol1-2 )*lda+irow1 )
518 v3 = a( ( icol1-1 )*lda+irow1+2 )
519 h21 = a( ( icol1-2 )*lda+irow1+1 )
520 h12 = a( ( icol1-1 )*lda+irow1 )
522 h00 = a( ( icol1-3 )*lda+irow1-1 )
523 h10 = a( ( icol1-3 )*lda+irow1 )
528 v1 = ( h33s*h44s-h43h34 ) / h21 + h12
529 v2 = h22 - h11 - h33s - h44s
530 s = abs( v1 ) + abs( v2 ) + abs( v3 )
536 tst1 = abs( v1 )*( abs( h00 )+abs( h11 )+abs( h22 ) )
537 IF( abs( h10 )*( abs( v2 )+abs( v3 ) ).LE.ulp*tst1 )
554 IF( modkm1.EQ.0 )
THEN
568 CALL igamx2d( contxt,
'ALL',
' ', 1, 1, m, 1, l, l, -1, -1, -1 )