1 SUBROUTINE pslahqr( WANTT, WANTZ, N, ILO, IHI, A, DESCA, WR, WI,
2 $ ILOZ, IHIZ, Z, DESCZ, WORK, LWORK, IWORK,
11 INTEGER IHI, IHIZ, ILO, ILOZ, ILWORK, INFO, LWORK, N
14 INTEGER DESCA( * ), DESCZ( * ), IWORK( * )
15 REAL A( * ), WI( * ), WORK( * ), WR( * ), Z( * )
232 INTEGER BLOCK_CYCLIC_2D, CSRC_, CTXT_, DLEN_, DTYPE_,
233 $ LLD_, MB_, M_, NB_, N_, RSRC_
234 parameter( block_cyclic_2d = 1, dlen_ = 9, dtype_ = 1,
235 $ ctxt_ = 2, m_ = 3, n_ = 4, mb_ = 5, nb_ = 6,
236 $ rsrc_ = 7, csrc_ = 8, lld_ = 9 )
238 PARAMETER ( ZERO = 0.0, one = 1.0, half = 0.5 )
240 parameter( const = 1.50 )
242 parameter( iblk = 32 )
245 INTEGER CONTXT, DOWN, HBL, I, I1, I2, IAFIRST, IBULGE,
246 $ ICBUF, ICOL, ICOL1, ICOL2, IDIA, IERR, II,
247 $ irbuf, irow, irow1, irow2, ispec, istart,
248 $ istartcol, istartrow, istop, isub, isup,
249 $ itermax, itmp1, itmp2, itn, its, j, jafirst,
250 $ jblk, jj, k, ki, l, lcmrc, lda, ldz, left,
251 $ lihih, lihiz, liloh, liloz, locali1, locali2,
252 $ localk, localm, m, modkm1, mycol, myrow,
253 $ nbulge, nh, node, npcol, nprow, nr, num, nz,
254 $ right, rotn, up, vecsidx
255 REAL AVE, DISC, H00, H10, H11, H12, H21, H22, H33,
256 $ H43H34, H44, OVFL, S, SMLNUM, SUM, T1, T1COPY,
257 $ t2, t3, ulp, unfl, v1save, v2, v2save, v3,
261 INTEGER ICURCOL( IBLK ), ICURROW( IBLK ), K1( IBLK ),
262 $ K2( IBLK ), KCOL( IBLK ), KP2COL( IBLK ),
263 $ kp2row( iblk ), krow( iblk ), localk2( iblk )
264 REAL S1( 2*IBLK, 2*IBLK ), SMALLA( 6, 6, IBLK ),
270 EXTERNAL ilcm, numroc, pslamch
273 EXTERNAL blacs_gridinfo, scopy, sgebr2d, sgebs2d,
274 $ sgerv2d, sgesd2d, sgsum2d, slahqr,
slaref,
280 INTRINSIC abs,
max,
min, mod, sign, sqrt
286 itermax = 30*( ihi-ilo+1 )
294 contxt = desca( ctxt_ )
296 iafirst = desca( rsrc_ )
297 jafirst = desca( csrc_ )
299 CALL blacs_gridinfo( contxt, nprow, npcol, myrow, mycol )
300 node = myrow*npcol + mycol
302 left = mod( mycol+npcol-1, npcol )
303 right = mod( mycol+1, npcol )
304 up = mod( myrow+nprow-1, nprow )
305 down = mod( myrow+1, nprow )
306 lcmrc = ilcm( nprow, npcol )
310 localk = numroc( n, hbl, mycol, jafirst, npcol )
315 IF( lwork.LT.3*n+
max( 2*
max( lda, ldz )+2*localk, jj ) )
THEN
318 IF( descz( ctxt_ ).NE.desca( ctxt_ ) )
THEN
319 info = -( 1300+ctxt_ )
321 IF( desca( mb_ ).NE.desca( nb_ ) )
THEN
324 IF( descz( mb_ ).NE.descz( nb_ ) )
THEN
327 IF( desca( mb_ ).NE.descz( mb_ ) )
THEN
330 IF( ( desca( rsrc_ ).NE.0 ) .OR. ( desca( csrc_ ).NE.0 ) )
THEN
331 info = -( 700+rsrc_ )
333 IF( ( descz( rsrc_ ).NE.0 ) .OR. ( descz( csrc_ ).NE.0 ) )
THEN
334 info = -( 1300+rsrc_ )
336 IF( ( ilo.GT.n ) .OR. ( ilo.LT.1 ) )
THEN
339 IF( ( ihi.GT.n ) .OR. ( ihi.LT.1 ) )
THEN
345 CALL igamn2d( contxt,
'ALL',
' ', 1, 1, info, 1, itmp1, itmp2, -1,
348 CALL pxerbla( contxt,
'PSLAHQR', -info )
364 rotn =
max( rotn, hbl-2 )
365 rotn =
min( rotn, 1 )
367 IF( ilo.EQ.ihi )
THEN
368 CALL infog2l( ilo, ilo, desca, nprow, npcol, myrow, mycol,
369 $ irow, icol, ii, jj )
370 IF( ( myrow.EQ.ii ) .AND. ( mycol.EQ.jj ) )
THEN
371 wr( ilo ) = a( ( icol-1 )*lda+irow )
382 CALL infog1l( iloz, hbl, nprow, myrow, 0, liloz, lihiz )
383 lihiz = numroc( ihiz, hbl, myrow, 0, nprow )
388 unfl = pslamch( contxt,
'SAFE MINIMUM' )
390 CALL pslabad( contxt, unfl, ovfl )
391 ulp = pslamch( contxt,
'PRECISION' )
392 smlnum = unfl*( nh / ulp )
428 CALL pslasmsub( a, desca, i, l, k, smlnum, work( irbuf+1 ),
436 CALL infog2l( l, l-1, desca, nprow, npcol, myrow, mycol,
437 $ irow, icol, itmp1, itmp2 )
438 IF( ( myrow.EQ.itmp1 ) .AND. ( mycol.EQ.itmp2 ) )
THEN
439 a( ( icol-1 )*lda+irow ) = zero
441 work( isub+l-1 ) = zero
456 IF( .NOT.wantt )
THEN
464 jblk =
min( iblk, ( ( i-l+1 ) / 2 )-1 )
465 IF( jblk.GT.lcmrc )
THEN
469 jblk = jblk - mod( jblk, lcmrc )
471 jblk =
min( jblk, 2*lcmrc )
472 jblk =
max( jblk, 1 )
474 CALL pslacp3( 2*jblk, i-2*jblk+1, a, desca, s1, 2*iblk, -1, -1,
476 IF( its.EQ.20 .OR. its.EQ.40 )
THEN
480 DO 20 ii = 2*jblk, 2, -1
481 s1( ii, ii ) = const*( abs( s1( ii, ii ) )+
482 $ abs( s1( ii, ii-1 ) ) )
483 s1( ii, ii-1 ) = zero
484 s1( ii-1, ii ) = zero
486 s1( 1, 1 ) = const*abs( s1( 1, 1 ) )
488 CALL slahqr( .false., .false., 2*jblk, 1, 2*jblk, s1,
489 $ 2*iblk, work( irbuf+1 ), work( icbuf+1 ), 1,
490 $ 2*jblk, z, ldz, ierr )
494 h44 = s1( 2*jblk, 2*jblk )
495 h33 = s1( 2*jblk-1, 2*jblk-1 )
496 h43h34 = s1( 2*jblk-1, 2*jblk )*s1( 2*jblk, 2*jblk-1 )
497 IF( ( jblk.GT.1 ) .AND. ( its.GT.30 ) )
THEN
498 s = s1( 2*jblk-1, 2*jblk-2 )
499 disc = ( h33-h44 )*half
500 disc = disc*disc + h43h34
501 IF( disc.GT.zero )
THEN
506 ave = half*( h33+h44 )
507 IF( abs( h33 )-abs( h44 ).GT.zero )
THEN
508 h33 = h33*h44 - h43h34
509 h44 = h33 / ( sign( disc, ave )+ave )
511 h44 = sign( disc, ave ) + ave
544 istop =
min( m+rotn-mod( m, rotn ), i-2 )
545 istop =
min( istop, m+hbl-3-mod( m-1, hbl ) )
546 istop =
min( istop, i2-2 )
547 istop =
max( istop, m )
548 nbulge = ( i-1-istop ) / hbl
552 nbulge =
min( nbulge, jblk )
553 IF( nbulge.GT.lcmrc )
THEN
557 nbulge = nbulge - mod( nbulge, lcmrc )
559 nbulge =
max( nbulge, 1 )
561 IF( ( its.NE.20 ) .AND. ( its.NE.40 ) .AND. ( nbulge.GT.1 ) )
567 CALL slasorte( s1( 2*( jblk-nbulge )+1,
568 $ 2*( jblk-nbulge )+1 ), 2*iblk, 2*nbulge,
569 $ work( irbuf+1 ), ierr )
578 CALL infog1l( m, hbl, npcol, mycol, 0, itmp1, localk )
579 localk = numroc( n, hbl, mycol, 0, npcol )
580 CALL infog1l( 1, hbl, npcol, mycol, 0, icol1, locali2 )
581 locali2 = numroc( i2, hbl, mycol, 0, npcol )
585 CALL infog1l( i1, hbl, nprow, myrow, 0, locali1, icol1 )
586 icol1 = numroc( n, hbl, myrow, 0, nprow )
587 CALL infog1l( 1, hbl, nprow, myrow, 0, localm, icol1 )
588 icol1 = numroc(
min( m+3, i ), hbl, myrow, 0, nprow )
592 istartrow = mod( ( m+1 ) / hbl, nprow ) + iafirst
593 istartcol = mod( ( m+1 ) / hbl, npcol ) + jafirst
595 CALL infog1l( m, hbl, nprow, myrow, 0, ii, itmp2 )
596 itmp2 = numroc( n, hbl, myrow, 0, nprow )
597 CALL infog1l( m, hbl, npcol, mycol, 0, jj, itmp2 )
598 itmp2 = numroc( n, hbl, mycol, 0, npcol )
599 CALL infog1l( 1, hbl, nprow, myrow, 0, istop, kp2row( 1 ) )
600 kp2row( 1 ) = numroc( m+2, hbl, myrow, 0, nprow )
601 CALL infog1l( 1, hbl, npcol, mycol, 0, istop, kp2col( 1 ) )
602 kp2col( 1 ) = numroc( m+2, hbl, mycol, 0, npcol )
622 istop =
min( m+rotn-mod( m, rotn ), i-2 )
623 istop =
min( istop, m+hbl-3-mod( m-1, hbl ) )
624 istop =
min( istop, i2-2 )
625 istop =
max( istop, m )
627 icurrow( ki ) = istartrow
628 icurcol( ki ) = istartcol
629 localk2( ki ) = itmp1
633 $ kp2row( ki ) = kp2row( 1 )
635 $ kp2col( ki ) = kp2col( 1 )
645 CALL pslawil( itmp1, itmp2, m, a, desca, h44, h33, h43h34,
650 IF( k2( ibulge ).LE.i-1 )
THEN
652 IF( ( k1( ibulge ).GE.m+5 ) .AND. ( ibulge.LT.nbulge ) )
654 IF( ( mod( k2( ibulge )+2, hbl ).EQ.mod( k2( ibulge+1 )+
655 $ 2, hbl ) ) .AND. ( k1( 1 ).LE.i-1 ) )
THEN
656 h44 = s1( 2*jblk-2*ibulge, 2*jblk-2*ibulge )
657 h33 = s1( 2*jblk-2*ibulge-1, 2*jblk-2*ibulge-1 )
658 h43h34 = s1( 2*jblk-2*ibulge-1, 2*jblk-2*ibulge )*
659 $ s1( 2*jblk-2*ibulge, 2*jblk-2*ibulge-1 )
662 CALL pslawil( itmp1, itmp2, m, a, desca, h44, h33,
680 istart =
max( k1( ki ), m )
681 istop =
min( k2( ki ), i-1 )
683 modkm1 = mod( k-1, hbl )
684 IF( ( modkm1.GE.hbl-2 ) .AND. ( k.LE.i-1 ) )
THEN
687 smalla(itmp1, itmp2, ki) = zero
690 IF( ( modkm1.EQ.hbl-2 ) .AND. ( k.LT.i-1 ) )
THEN
694 CALL infog2l( k+2, k+2, desca, nprow, npcol, myrow,
695 $ mycol, irow1, icol1, itmp1, itmp2 )
697 $ smalla( 1, 1, ki ), 6, itmp1, itmp2,
700 IF( modkm1.EQ.hbl-1 )
THEN
704 CALL infog2l( k+1, k+1, desca, nprow, npcol, myrow,
705 $ mycol, irow1, icol1, itmp1, itmp2 )
707 $ smalla( 1, 1, ki ), 6, itmp1, itmp2,
736 IF( ( myrow.EQ.icurrow( ki ) ) .AND.
737 $ ( mycol.EQ.icurcol( ki ) ) .AND.
738 $ ( modkm1.EQ.hbl-2 ) .AND.
739 $ ( istart.LT.
min( i-1, istop+1 ) ) )
THEN
743 CALL scopy( nr, smalla( 2, 1, ki ), 1, vcopy, 1 )
749 CALL slarfg( nr, vcopy( 1 ), vcopy( 2 ), 1, t1copy )
751 smalla( 2, 1, ki ) = vcopy( 1 )
752 smalla( 3, 1, ki ) = zero
754 $ smalla( 4, 1, ki ) = zero
755 ELSE IF( m.GT.l )
THEN
756 smalla( 2, 1, ki ) = -smalla( 2, 1, ki )
760 work( vecsidx+( k-1 )*3+1 ) = vcopy( 2 )
761 work( vecsidx+( k-1 )*3+2 ) = vcopy( 3 )
762 work( vecsidx+( k-1 )*3+3 ) = t1copy
765 IF( ( mod( istop-1, hbl ).EQ.hbl-1 ) .AND.
766 $ ( myrow.EQ.icurrow( ki ) ) .AND.
767 $ ( mycol.EQ.icurcol( ki ) ) .AND.
768 $ ( istart.LE.
min( i, istop ) ) )
THEN
772 CALL scopy( nr, smalla( 3, 2, ki ), 1, vcopy, 1 )
778 CALL slarfg( nr, vcopy( 1 ), vcopy( 2 ), 1, t1copy )
780 smalla( 3, 2, ki ) = vcopy( 1 )
781 smalla( 4, 2, ki ) = zero
783 $ smalla( 5, 2, ki ) = zero
795 ELSE IF( m.GT.l )
THEN
796 smalla( 3, 2, ki ) = -smalla( 3, 2, ki )
800 work( vecsidx+( k-1 )*3+1 ) = vcopy( 2 )
801 work( vecsidx+( k-1 )*3+2 ) = vcopy( 3 )
802 work( vecsidx+( k-1 )*3+3 ) = t1copy
805 IF( ( modkm1.EQ.0 ) .AND. ( istart.LE.i-1 ) .AND.
806 $ ( myrow.EQ.icurrow( ki ) ) .AND.
807 $ ( right.EQ.icurcol( ki ) ) )
THEN
812 icol1 = localk2( ki )
813 IF( istart.GT.m )
THEN
814 vcopy( 1 ) = smalla( 4, 3, ki )
815 vcopy( 2 ) = smalla( 5, 3, ki )
816 vcopy( 3 ) = smalla( 6, 3, ki )
817 nr =
min( 3, i-istart+1 )
818 CALL slarfg( nr, vcopy( 1 ), vcopy( 2 ), 1,
820 a( ( icol1-2 )*lda+irow1 ) = vcopy( 1 )
821 a( ( icol1-2 )*lda+irow1+1 ) = zero
822 IF( istart.LT.i-1 )
THEN
823 a( ( icol1-2 )*lda+irow1+2 ) = zero
827 a( ( icol1-2 )*lda+irow1 ) = -a( ( icol1-2 )*
833 IF( ( myrow.EQ.icurrow( ki ) ) .AND.
834 $ ( mycol.EQ.icurcol( ki ) ) .AND.
835 $ ( ( ( modkm1.EQ.hbl-2 ) .AND. ( istart.EQ.i-
836 $ 1 ) ) .OR. ( ( modkm1.LT.hbl-2 ) .AND. ( istart.LE.i-
842 icol1 = localk2( ki )
843 DO 70 k = istart, istop
849 IF( mod( k-1, hbl ).EQ.0 )
THEN
850 vcopy( 1 ) = smalla( 4, 3, ki )
851 vcopy( 2 ) = smalla( 5, 3, ki )
852 vcopy( 3 ) = smalla( 6, 3, ki )
854 vcopy( 1 ) = a( ( icol1-2 )*lda+irow1 )
855 vcopy( 2 ) = a( ( icol1-2 )*lda+irow1+1 )
857 vcopy( 3 ) = a( ( icol1-2 )*lda+irow1+2 )
865 CALL slarfg( nr, vcopy( 1 ), vcopy( 2 ), 1,
868 IF( mod( k-1, hbl ).GT.0 )
THEN
869 a( ( icol1-2 )*lda+irow1 ) = vcopy( 1 )
870 a( ( icol1-2 )*lda+irow1+1 ) = zero
872 a( ( icol1-2 )*lda+irow1+2 ) = zero
888 ELSE IF( m.GT.l )
THEN
889 IF( mod( k-1, hbl ).GT.0 )
THEN
890 a( ( icol1-2 )*lda+irow1 ) = -a( ( icol1-2 )*
896 work( vecsidx+( k-1 )*3+1 ) = vcopy( 2 )
897 work( vecsidx+( k-1 )*3+2 ) = vcopy( 3 )
898 work( vecsidx+( k-1 )*3+3 ) = t1copy
900 IF( k.LT.istop )
THEN
906 DO 50 j = icol1,
min( k2( ki )+1, i-1 ) +
908 sum = a( ( j-1 )*lda+irow1 ) +
909 $ v2*a( ( j-1 )*lda+irow1+1 ) +
910 $ v3*a( ( j-1 )*lda+irow1+2 )
911 a( ( j-1 )*lda+irow1 ) = a( ( j-1 )*lda+
913 a( ( j-1 )*lda+irow1+1 ) = a( ( j-1 )*lda+
915 a( ( j-1 )*lda+irow1+2 ) = a( ( j-1 )*lda+
918 itmp1 = localk2( ki )
919 DO 60 j = irow1 + 1, irow1 + 3
920 sum = a( ( icol1-1 )*lda+j ) +
921 $ v2*a( icol1*lda+j ) +
922 $ v3*a( ( icol1+1 )*lda+j )
923 a( ( icol1-1 )*lda+j ) = a( ( icol1-1 )*lda+
925 a( icol1*lda+j ) = a( icol1*lda+j ) - sum*t2
926 a( ( icol1+1 )*lda+j ) = a( ( icol1+1 )*lda+
935 IF( modkm1.EQ.hbl-2 )
THEN
936 IF( ( down.EQ.icurrow( ki ) ) .AND.
937 $ ( right.EQ.icurcol( ki ) ) .AND. ( num.GT.1 ) )
939 CALL sgerv2d( contxt, 3, 1,
940 $ work( vecsidx+( istart-1 )*3+1 ), 3,
943 IF( ( myrow.EQ.icurrow( ki ) ) .AND.
944 $ ( mycol.EQ.icurcol( ki ) ) .AND. ( num.GT.1 ) )
946 CALL sgesd2d( contxt, 3, 1,
947 $ work( vecsidx+( istart-1 )*3+1 ), 3,
950 IF( ( down.EQ.icurrow( ki ) ) .AND.
951 $ ( npcol.GT.1 ) .AND. ( istart.LE.istop ) )
THEN
952 jj = mod( icurcol( ki )+npcol-1, npcol )
953 IF( mycol.NE.jj )
THEN
954 CALL sgebr2d( contxt,
'ROW',
' ',
955 $ 3*( istop-istart+1 ), 1,
956 $ work( vecsidx+( istart-1 )*3+1 ),
957 $ 3*( istop-istart+1 ), myrow, jj )
959 CALL sgebs2d( contxt,
'ROW',
' ',
960 $ 3*( istop-istart+1 ), 1,
961 $ work( vecsidx+( istart-1 )*3+1 ),
962 $ 3*( istop-istart+1 ) )
969 IF( ( myrow.EQ.icurrow( ki ) ) .AND. ( npcol.GT.1 ) .AND.
970 $ ( istart.LE.istop ) )
THEN
971 IF( mycol.NE.icurcol( ki ) )
THEN
972 CALL sgebr2d( contxt,
'ROW',
' ',
973 $ 3*( istop-istart+1 ), 1,
974 $ work( vecsidx+( istart-1 )*3+1 ),
975 $ 3*( istop-istart+1 ), myrow,
978 CALL sgebs2d( contxt,
'ROW',
' ',
979 $ 3*( istop-istart+1 ), 1,
980 $ work( vecsidx+( istart-1 )*3+1 ),
981 $ 3*( istop-istart+1 ) )
990 istart =
max( k1( ki ), m )
991 istop =
min( k2( ki ), i-1 )
993 IF( mod( istart-1, hbl ).EQ.hbl-2 )
THEN
994 IF( ( right.EQ.icurcol( ki ) ) .AND.
995 $ ( nprow.GT.1 ) .AND. ( istart.LE.istop ) )
THEN
996 jj = mod( icurrow( ki )+nprow-1, nprow )
997 IF( myrow.NE.jj )
THEN
998 CALL sgebr2d( contxt,
'COL',
' ',
999 $ 3*( istop-istart+1 ), 1,
1000 $ work( vecsidx+( istart-1 )*3+1 ),
1001 $ 3*( istop-istart+1 ), jj, mycol )
1003 CALL sgebs2d( contxt,
'COL',
' ',
1004 $ 3*( istop-istart+1 ), 1,
1005 $ work( vecsidx+( istart-1 )*3+1 ),
1006 $ 3*( istop-istart+1 ) )
1011 IF( ( mycol.EQ.icurcol( ki ) ) .AND. ( nprow.GT.1 ) .AND.
1012 $ ( istart.LE.istop ) )
THEN
1013 IF( myrow.NE.icurrow( ki ) )
THEN
1014 CALL sgebr2d( contxt,
'COL',
' ',
1015 $ 3*( istop-istart+1 ), 1,
1016 $ work( vecsidx+( istart-1 )*3+1 ),
1017 $ 3*( istop-istart+1 ), icurrow( ki ),
1020 CALL sgebs2d( contxt,
'COL',
' ',
1021 $ 3*( istop-istart+1 ), 1,
1022 $ work( vecsidx+( istart-1 )*3+1 ),
1023 $ 3*( istop-istart+1 ) )
1030 DO 150 ki = 1, ibulge
1031 istart =
max( k1( ki ), m )
1032 istop =
min( k2( ki ), i-1 )
1034 modkm1 = mod( istart-1, hbl )
1035 IF( ( myrow.EQ.icurrow( ki ) ) .AND.
1036 $ ( mycol.EQ.icurcol( ki ) ) .AND.
1037 $ ( modkm1.EQ.hbl-2 ) .AND. ( istart.LT.i-1 ) )
THEN
1042 nr =
min( 3, i-k+1 )
1043 v2 = work( vecsidx+( k-1 )*3+1 )
1044 v3 = work( vecsidx+( k-1 )*3+2 )
1045 t1 = work( vecsidx+( k-1 )*3+3 )
1053 itmp1 =
min( 6, i2+2-k )
1054 itmp2 =
max( i1-k+2, 1 )
1056 sum = smalla( 2, j, ki ) +
1057 $ v2*smalla( 3, j, ki ) +
1058 $ v3*smalla( 4, j, ki )
1059 smalla( 2, j, ki ) = smalla( 2, j, ki ) - sum*t1
1060 smalla( 3, j, ki ) = smalla( 3, j, ki ) - sum*t2
1061 smalla( 4, j, ki ) = smalla( 4, j, ki ) - sum*t3
1064 sum = smalla( j, 2, ki ) +
1065 $ v2*smalla( j, 3, ki ) +
1066 $ v3*smalla( j, 4, ki )
1067 smalla( j, 2, ki ) = smalla( j, 2, ki ) - sum*t1
1068 smalla( j, 3, ki ) = smalla( j, 3, ki ) - sum*t2
1069 smalla( j, 4, ki ) = smalla( j, 4, ki ) - sum*t3
1074 IF( ( mod( istart-1, hbl ).EQ.hbl-1 ) .AND.
1075 $ ( istart.LE.istop ) .AND.
1076 $ ( myrow.EQ.icurrow( ki ) ) .AND.
1077 $ ( mycol.EQ.icurcol( ki ) ) )
THEN
1082 nr =
min( 3, i-k+1 )
1083 v2 = work( vecsidx+( k-1 )*3+1 )
1084 v3 = work( vecsidx+( k-1 )*3+2 )
1085 t1 = work( vecsidx+( k-1 )*3+3 )
1093 itmp1 =
min( 6, i2-k+3 )
1094 itmp2 =
max( i1-k+3, 1 )
1096 sum = smalla( 3, j, ki ) +
1097 $ v2*smalla( 4, j, ki ) +
1098 $ v3*smalla( 5, j, ki )
1099 smalla( 3, j, ki ) = smalla( 3, j, ki ) - sum*t1
1100 smalla( 4, j, ki ) = smalla( 4, j, ki ) - sum*t2
1101 smalla( 5, j, ki ) = smalla( 5, j, ki ) - sum*t3
1104 sum = smalla( j, 3, ki ) +
1105 $ v2*smalla( j, 4, ki ) +
1106 $ v3*smalla( j, 5, ki )
1107 smalla( j, 3, ki ) = smalla( j, 3, ki ) - sum*t1
1108 smalla( j, 4, ki ) = smalla( j, 4, ki ) - sum*t2
1109 smalla( j, 5, ki ) = smalla( j, 5, ki ) - sum*t3
1114 modkm1 = mod( istart-1, hbl )
1115 IF( ( myrow.EQ.icurrow( ki ) ) .AND.
1116 $ ( mycol.EQ.icurcol( ki ) ) .AND.
1117 $ ( ( ( modkm1.EQ.hbl-2 ) .AND. ( istart.EQ.i-
1118 $ 1 ) ) .OR. ( ( modkm1.LT.hbl-2 ) .AND. ( istart.LE.i-
1124 icol1 = localk2( ki )
1125 DO 140 k = istart, istop
1129 nr =
min( 3, i-k+1 )
1130 v2 = work( vecsidx+( k-1 )*3+1 )
1131 v3 = work( vecsidx+( k-1 )*3+2 )
1132 t1 = work( vecsidx+( k-1 )*3+3 )
1133 IF( k.LT.istop )
THEN
1139 CALL slaref(
'Col', a, lda, .false., z, ldz,
1140 $ .false., icol1, icol1, istart,
1141 $ istop,
min( istart+1, i )-k+irow1,
1142 $ irow1, liloz, lihiz,
1143 $ work( vecsidx+1 ), v2, v3, t1, t2,
1148 IF( ( nr.EQ.3 ) .AND. ( mod( k-1,
1149 $ hbl ).LT.hbl-2 ) )
THEN
1152 CALL slaref(
'Row', a, lda, .false., z, ldz,
1153 $ .false., irow1, irow1, istart,
1154 $ istop, icol1,
min(
min( k2( ki )
1155 $ +1, i-1 ), i2 )-k+icol1, liloz,
1156 $ lihiz, work( vecsidx+1 ), v2,
1166 modkm1 = mod( k-1, hbl )
1167 IF( ( modkm1.GE.hbl-2 ) .AND. ( k.LE.i-1 ) )
THEN
1168 IF( ( modkm1.EQ.hbl-2 ) .AND. ( k.LT.i-1 ) )
THEN
1172 CALL infog2l( k+2, k+2, desca, nprow, npcol, myrow,
1173 $ mycol, irow1, icol1, itmp1, itmp2 )
1174 CALL pslacp3(
min( 6, n-k+2 ), k-1, a, desca,
1175 $ smalla( 1, 1, ki ), 6, itmp1, itmp2,
1179 IF( modkm1.EQ.hbl-1 )
THEN
1183 CALL infog2l( k+1, k+1, desca, nprow, npcol, myrow,
1184 $ mycol, irow1, icol1, itmp1, itmp2 )
1185 CALL pslacp3(
min( 6, n-k+3 ), k-2, a, desca,
1186 $ smalla( 1, 1, ki ), 6, itmp1, itmp2,
1195 DO 160 ki = 1, ibulge
1196 IF( ( myrow.NE.icurrow( ki ) ) .AND.
1197 $ ( down.NE.icurrow( ki ) ) )
GO TO 160
1198 istart =
max( k1( ki ), m )
1199 istop =
min( k2( ki ), i-1 )
1201 IF( ( istop.GT.istart ) .AND.
1202 $ ( mod( istart-1, hbl ).LT.hbl-2 ) .AND.
1203 $ ( icurrow( ki ).EQ.myrow ) )
THEN
1204 irow1 =
min( k2( ki )+1, i-1 ) + 1
1205 CALL infog1l( irow1, hbl, npcol, mycol, 0, itmp1,
1207 itmp2 = numroc( i2, hbl, mycol, 0, npcol )
1209 CALL slaref(
'Row', a, lda, wantz, z, ldz, .true., ii,
1210 $ ii, istart, istop, itmp1, itmp2, liloz,
1211 $ lihiz, work( vecsidx+1 ), v2, v3, t1, t2,
1216 DO 180 ki = 1, ibulge
1217 IF( krow( ki ).GT.kp2row( ki ) )
1219 IF( ( myrow.NE.icurrow( ki ) ) .AND.
1220 $ ( down.NE.icurrow( ki ) ) )
GO TO 180
1221 istart =
max( k1( ki ), m )
1222 istop =
min( k2( ki ), i-1 )
1223 IF( ( istart.EQ.istop ) .OR.
1224 $ ( mod( istart-1, hbl ).GE.hbl-2 ) .OR.
1225 $ ( icurrow( ki ).NE.myrow ) )
THEN
1226 DO 170 k = istart, istop
1227 v2 = work( vecsidx+( k-1 )*3+1 )
1228 v3 = work( vecsidx+( k-1 )*3+2 )
1229 t1 = work( vecsidx+( k-1 )*3+3 )
1230 nr =
min( 3, i-k+1 )
1231 IF( ( nr.EQ.3 ) .AND. ( krow( ki ).LE.
1232 $ kp2row( ki ) ) )
THEN
1233 IF( ( k.LT.istop ) .AND.
1234 $ ( mod( k-1, hbl ).LT.hbl-2 ) )
THEN
1235 itmp1 =
min( k2( ki )+1, i-1 ) + 1
1237 IF( mod( k-1, hbl ).LT.hbl-2 )
THEN
1238 itmp1 =
min( k2( ki )+1, i-1 ) + 1
1240 IF( mod( k-1, hbl ).EQ.hbl-2 )
THEN
1241 itmp1 =
min( k+4, i2 ) + 1
1243 IF( mod( k-1, hbl ).EQ.hbl-1 )
THEN
1244 itmp1 =
min( k+3, i2 ) + 1
1251 irow2 = kp2row( ki )
1252 CALL infog1l( itmp1, hbl, npcol, mycol, 0,
1254 icol2 = numroc( i2, hbl, mycol, 0, npcol )
1255 IF( ( mod( k-1, hbl ).LT.hbl-2 ) .OR.
1256 $ ( nprow.EQ.1 ) )
THEN
1259 CALL slaref(
'Row', a, lda, wantz, z, ldz,
1260 $ .false., irow1, irow1, istart,
1261 $ istop, icol1, icol2, liloz,
1262 $ lihiz, work( vecsidx+1 ), v2,
1265 IF( ( mod( k-1, hbl ).EQ.hbl-2 ) .AND.
1266 $ ( nprow.GT.1 ) )
THEN
1267 IF( irow1.EQ.irow2 )
THEN
1268 CALL sgesd2d( contxt, 1, icol2-icol1+1,
1269 $ a( ( icol1-1 )*lda+irow2 ),
1273 IF( ( mod( k-1, hbl ).EQ.hbl-1 ) .AND.
1274 $ ( nprow.GT.1 ) )
THEN
1275 IF( irow1.EQ.irow2 )
THEN
1276 CALL sgesd2d( contxt, 1, icol2-icol1+1,
1277 $ a( ( icol1-1 )*lda+irow1 ),
1278 $ lda, down, mycol )
1286 DO 220 ki = 1, ibulge
1287 IF( krow( ki ).GT.kp2row( ki ) )
1289 IF( ( myrow.NE.icurrow( ki ) ) .AND.
1290 $ ( down.NE.icurrow( ki ) ) )
GO TO 220
1291 istart =
max( k1( ki ), m )
1292 istop =
min( k2( ki ), i-1 )
1293 IF( ( istart.EQ.istop ) .OR.
1294 $ ( mod( istart-1, hbl ).GE.hbl-2 ) .OR.
1295 $ ( icurrow( ki ).NE.myrow ) )
THEN
1296 DO 210 k = istart, istop
1297 v2 = work( vecsidx+( k-1 )*3+1 )
1298 v3 = work( vecsidx+( k-1 )*3+2 )
1299 t1 = work( vecsidx+( k-1 )*3+3 )
1300 nr =
min( 3, i-k+1 )
1301 IF( ( nr.EQ.3 ) .AND. ( krow( ki ).LE.
1302 $ kp2row( ki ) ) )
THEN
1303 IF( ( k.LT.istop ) .AND.
1304 $ ( mod( k-1, hbl ).LT.hbl-2 ) )
THEN
1305 itmp1 =
min( k2( ki )+1, i-1 ) + 1
1307 IF( mod( k-1, hbl ).LT.hbl-2 )
THEN
1308 itmp1 =
min( k2( ki )+1, i-1 ) + 1
1310 IF( mod( k-1, hbl ).EQ.hbl-2 )
THEN
1311 itmp1 =
min( k+4, i2 ) + 1
1313 IF( mod( k-1, hbl ).EQ.hbl-1 )
THEN
1314 itmp1 =
min( k+3, i2 ) + 1
1318 irow1 = krow( ki ) + k - istart
1319 irow2 = kp2row( ki ) + k - istart
1320 CALL infog1l( itmp1, hbl, npcol, mycol, 0,
1322 icol2 = numroc( i2, hbl, mycol, 0, npcol )
1323 IF( ( mod( k-1, hbl ).EQ.hbl-2 ) .AND.
1324 $ ( nprow.GT.1 ) )
THEN
1325 IF( irow1.NE.irow2 )
THEN
1326 CALL sgerv2d( contxt, 1, icol2-icol1+1,
1327 $ work( irbuf+1 ), 1, down,
1331 DO 190 j = icol1, icol2
1332 sum = a( ( j-1 )*lda+irow1 ) +
1333 $ v2*a( ( j-1 )*lda+irow1+1 ) +
1334 $ v3*work( irbuf+j-icol1+1 )
1335 a( ( j-1 )*lda+irow1 ) = a( ( j-1 )*
1336 $ lda+irow1 ) - sum*t1
1337 a( ( j-1 )*lda+irow1+1 ) = a( ( j-1 )*
1338 $ lda+irow1+1 ) - sum*t2
1339 work( irbuf+j-icol1+1 ) = work( irbuf+
1340 $ j-icol1+1 ) - sum*t3
1342 CALL sgesd2d( contxt, 1, icol2-icol1+1,
1343 $ work( irbuf+1 ), 1, down,
1347 IF( ( mod( k-1, hbl ).EQ.hbl-1 ) .AND.
1348 $ ( nprow.GT.1 ) )
THEN
1349 IF( irow1.NE.irow2 )
THEN
1350 CALL sgerv2d( contxt, 1, icol2-icol1+1,
1351 $ work( irbuf+1 ), 1, up,
1355 DO 200 j = icol1, icol2
1356 sum = work( irbuf+j-icol1+1 ) +
1357 $ v2*a( ( j-1 )*lda+irow1 ) +
1358 $ v3*a( ( j-1 )*lda+irow1+1 )
1359 work( irbuf+j-icol1+1 ) = work( irbuf+
1360 $ j-icol1+1 ) - sum*t1
1361 a( ( j-1 )*lda+irow1 ) = a( ( j-1 )*
1362 $ lda+irow1 ) - sum*t2
1363 a( ( j-1 )*lda+irow1+1 ) = a( ( j-1 )*
1364 $ lda+irow1+1 ) - sum*t3
1366 CALL sgesd2d( contxt, 1, icol2-icol1+1,
1367 $ work( irbuf+1 ), 1, up,
1376 DO 240 ki = 1, ibulge
1377 IF( krow( ki ).GT.kp2row( ki ) )
1379 IF( ( myrow.NE.icurrow( ki ) ) .AND.
1380 $ ( down.NE.icurrow( ki ) ) )
GO TO 240
1381 istart =
max( k1( ki ), m )
1382 istop =
min( k2( ki ), i-1 )
1383 IF( ( istart.EQ.istop ) .OR.
1384 $ ( mod( istart-1, hbl ).GE.hbl-2 ) .OR.
1385 $ ( icurrow( ki ).NE.myrow ) )
THEN
1386 DO 230 k = istart, istop
1387 v2 = work( vecsidx+( k-1 )*3+1 )
1388 v3 = work( vecsidx+( k-1 )*3+2 )
1389 t1 = work( vecsidx+( k-1 )*3+3 )
1390 nr =
min( 3, i-k+1 )
1391 IF( ( nr.EQ.3 ) .AND. ( krow( ki ).LE.
1392 $ kp2row( ki ) ) )
THEN
1393 IF( ( k.LT.istop ) .AND.
1394 $ ( mod( k-1, hbl ).LT.hbl-2 ) )
THEN
1395 itmp1 =
min( k2( ki )+1, i-1 ) + 1
1397 IF( mod( k-1, hbl ).LT.hbl-2 )
THEN
1398 itmp1 =
min( k2( ki )+1, i-1 ) + 1
1400 IF( mod( k-1, hbl ).EQ.hbl-2 )
THEN
1401 itmp1 =
min( k+4, i2 ) + 1
1403 IF( mod( k-1, hbl ).EQ.hbl-1 )
THEN
1404 itmp1 =
min( k+3, i2 ) + 1
1408 irow1 = krow( ki ) + k - istart
1409 irow2 = kp2row( ki ) + k - istart
1410 CALL infog1l( itmp1, hbl, npcol, mycol, 0,
1412 icol2 = numroc( i2, hbl, mycol, 0, npcol )
1413 IF( ( mod( k-1, hbl ).EQ.hbl-2 ) .AND.
1414 $ ( nprow.GT.1 ) )
THEN
1415 IF( irow1.EQ.irow2 )
THEN
1416 CALL sgerv2d( contxt, 1, icol2-icol1+1,
1417 $ a( ( icol1-1 )*lda+irow2 ),
1421 IF( ( mod( k-1, hbl ).EQ.hbl-1 ) .AND.
1422 $ ( nprow.GT.1 ) )
THEN
1423 IF( irow1.EQ.irow2 )
THEN
1424 CALL sgerv2d( contxt, 1, icol2-icol1+1,
1425 $ a( ( icol1-1 )*lda+irow1 ),
1426 $ lda, down, mycol )
1437 DO 260 ki = 1, ibulge
1438 IF( ( mycol.NE.icurcol( ki ) ) .AND.
1439 $ ( right.NE.icurcol( ki ) ) )
GO TO 260
1440 istart =
max( k1( ki ), m )
1441 istop =
min( k2( ki ), i-1 )
1443 IF( ( ( mod( istart-1, hbl ).LT.hbl-2 ) .OR. ( npcol.EQ.
1444 $ 1 ) ) .AND. ( icurcol( ki ).EQ.mycol ) .AND.
1445 $ ( i-istop+1.GE.3 ) )
THEN
1447 IF( ( k.LT.istop ) .AND. ( mod( k-1,
1448 $ hbl ).LT.hbl-2 ) )
THEN
1449 itmp1 =
min( istart+1, i ) - 1
1451 IF( mod( k-1, hbl ).LT.hbl-2 )
THEN
1452 itmp1 =
min( k+3, i )
1454 IF( mod( k-1, hbl ).EQ.hbl-2 )
THEN
1455 itmp1 =
max( i1, k-1 ) - 1
1457 IF( mod( k-1, hbl ).EQ.hbl-1 )
THEN
1458 itmp1 =
max( i1, k-2 ) - 1
1463 CALL infog1l( i1, hbl, nprow, myrow, 0, irow1, irow2 )
1464 irow2 = numroc( itmp1, hbl, myrow, 0, nprow )
1465 IF( irow1.LE.irow2 )
THEN
1470 CALL slaref(
'Col', a, lda, wantz, z, ldz, .true.,
1471 $ icol1, icol1, istart, istop, irow1,
1472 $ irow2, liloz, lihiz, work( vecsidx+1 ),
1473 $ v2, v3, t1, t2, t3 )
1475 IF( mod( k-1, hbl ).LT.hbl-2 )
THEN
1479 IF( mod( k-1, hbl ).LT.hbl-3 )
THEN
1481 IF( mod( ( itmp1 / hbl ), nprow ).EQ.myrow )
1483 IF( itmp2.GT.0 )
THEN
1484 irow2 = itmp2 +
min( k+3, i ) - itmp1
1492 CALL infog1l( itmp1+1, hbl, nprow, myrow, 0,
1494 irow2 = numroc(
min( k+3, i ), hbl, myrow, 0,
1497 v2 = work( vecsidx+( k-1 )*3+1 )
1498 v3 = work( vecsidx+( k-1 )*3+2 )
1499 t1 = work( vecsidx+( k-1 )*3+3 )
1502 icol1 = kcol( ki ) + istop - istart
1503 CALL slaref(
'Col', a, lda, .false., z, ldz,
1504 $ .false., icol1, icol1, istart, istop,
1505 $ irow1, irow2, liloz, lihiz,
1506 $ work( vecsidx+1 ), v2, v3, t1, t2,
1512 DO 320 ki = 1, ibulge
1513 IF( kcol( ki ).GT.kp2col( ki ) )
1515 IF( ( mycol.NE.icurcol( ki ) ) .AND.
1516 $ ( right.NE.icurcol( ki ) ) )
GO TO 320
1517 istart =
max( k1( ki ), m )
1518 istop =
min( k2( ki ), i-1 )
1519 IF( mod( istart-1, hbl ).GE.hbl-2 )
THEN
1531 DO 310 k = istart, istop
1533 v2 = work( vecsidx+( k-1 )*3+1 )
1534 v3 = work( vecsidx+( k-1 )*3+2 )
1535 t1 = work( vecsidx+( k-1 )*3+3 )
1536 nr =
min( 3, i-k+1 )
1537 IF( ( nr.EQ.3 ) .AND. ( kcol( ki ).LE.kp2col( ki ) ) )
1540 IF( ( k.LT.istop ) .AND.
1541 $ ( mod( k-1, hbl ).LT.hbl-2 ) )
THEN
1542 itmp1 =
min( istart+1, i ) - 1
1544 IF( mod( k-1, hbl ).LT.hbl-2 )
THEN
1545 itmp1 =
min( k+3, i )
1547 IF( mod( k-1, hbl ).EQ.hbl-2 )
THEN
1548 itmp1 =
max( i1, k-1 ) - 1
1550 IF( mod( k-1, hbl ).EQ.hbl-1 )
THEN
1551 itmp1 =
max( i1, k-2 ) - 1
1554 icol1 = kcol( ki ) + k - istart
1555 icol2 = kp2col( ki ) + k - istart
1556 CALL infog1l( i1, hbl, nprow, myrow, 0, irow1,
1558 irow2 = numroc( itmp1, hbl, myrow, 0, nprow )
1559 IF( ( mod( k-1, hbl ).EQ.hbl-2 ) .AND.
1560 $ ( npcol.GT.1 ) )
THEN
1561 IF( icol1.EQ.icol2 )
THEN
1562 CALL sgesd2d( contxt, irow2-irow1+1, 1,
1563 $ a( ( icol1-1 )*lda+irow1 ),
1564 $ lda, myrow, left )
1565 CALL sgerv2d( contxt, irow2-irow1+1, 1,
1566 $ a( ( icol1-1 )*lda+irow1 ),
1567 $ lda, myrow, left )
1569 CALL sgerv2d( contxt, irow2-irow1+1, 1,
1570 $ work( icbuf+1 ), irow2-irow1+1,
1574 DO 270 j = irow1, irow2
1575 sum = a( ( icol1-1 )*lda+j ) +
1576 $ v2*a( icol1*lda+j ) +
1577 $ v3*work( icbuf+j-irow1+1 )
1578 a( ( icol1-1 )*lda+j ) = a( ( icol1-1 )*
1580 a( icol1*lda+j ) = a( icol1*lda+j ) -
1582 work( icbuf+j-irow1+1 ) = work( icbuf+j-
1583 $ irow1+1 ) - sum*t3
1585 CALL sgesd2d( contxt, irow2-irow1+1, 1,
1586 $ work( icbuf+1 ), irow2-irow1+1,
1590 IF( ( mod( k-1, hbl ).EQ.hbl-1 ) .AND.
1591 $ ( npcol.GT.1 ) )
THEN
1592 IF( icol1.EQ.icol2 )
THEN
1593 CALL sgesd2d( contxt, irow2-irow1+1, 1,
1594 $ a( ( icol1-1 )*lda+irow1 ),
1595 $ lda, myrow, right )
1596 CALL sgerv2d( contxt, irow2-irow1+1, 1,
1597 $ a( ( icol1-1 )*lda+irow1 ),
1598 $ lda, myrow, right )
1600 CALL sgerv2d( contxt, irow2-irow1+1, 1,
1601 $ work( icbuf+1 ), irow2-irow1+1,
1605 DO 280 j = irow1, irow2
1606 sum = work( icbuf+j-irow1+1 ) +
1607 $ v2*a( ( icol1-1 )*lda+j ) +
1608 $ v3*a( icol1*lda+j )
1609 work( icbuf+j-irow1+1 ) = work( icbuf+j-
1610 $ irow1+1 ) - sum*t1
1611 a( ( icol1-1 )*lda+j ) = a( ( icol1-1 )*
1613 a( icol1*lda+j ) = a( icol1*lda+j ) -
1616 CALL sgesd2d( contxt, irow2-irow1+1, 1,
1617 $ work( icbuf+1 ), irow2-irow1+1,
1623 IF( ( wantz ) .AND. ( mod( k-1,
1624 $ hbl ).GE.hbl-2 ) .AND. ( npcol.GT.1 ) )
THEN
1630 IF( mod( k-1, hbl ).EQ.hbl-2 )
THEN
1631 IF( icol1.EQ.icol2 )
THEN
1632 CALL sgesd2d( contxt, irow2-irow1+1, 1,
1633 $ z( ( icol1-1 )*ldz+irow1 ),
1634 $ ldz, myrow, left )
1635 CALL sgerv2d( contxt, irow2-irow1+1, 1,
1636 $ z( ( icol1-1 )*ldz+irow1 ),
1637 $ ldz, myrow, left )
1639 CALL sgerv2d( contxt, irow2-irow1+1, 1,
1641 $ irow2-irow1+1, myrow,
1645 icol1 = ( icol1-1 )*ldz
1646 DO 290 j = irow1, irow2
1647 sum = z( icol1+j ) +
1648 $ v2*z( icol1+j+ldz ) +
1649 $ v3*work( icbuf+j-irow1+1 )
1650 z( j+icol1 ) = z( j+icol1 ) - sum*t1
1651 z( j+icol1+ldz ) = z( j+icol1+ldz ) -
1653 work( icbuf+j-irow1+1 ) = work( icbuf+
1654 $ j-irow1+1 ) - sum*t3
1656 CALL sgesd2d( contxt, irow2-irow1+1, 1,
1658 $ irow2-irow1+1, myrow,
1662 IF( mod( k-1, hbl ).EQ.hbl-1 )
THEN
1663 IF( icol1.EQ.icol2 )
THEN
1664 CALL sgesd2d( contxt, irow2-irow1+1, 1,
1665 $ z( ( icol1-1 )*ldz+irow1 ),
1666 $ ldz, myrow, right )
1667 CALL sgerv2d( contxt, irow2-irow1+1, 1,
1668 $ z( ( icol1-1 )*ldz+irow1 ),
1669 $ ldz, myrow, right )
1671 CALL sgerv2d( contxt, irow2-irow1+1, 1,
1673 $ irow2-irow1+1, myrow, left )
1676 icol1 = ( icol1-1 )*ldz
1677 DO 300 j = irow1, irow2
1678 sum = work( icbuf+j-irow1+1 ) +
1680 $ v3*z( j+icol1+ldz )
1681 work( icbuf+j-irow1+1 ) = work( icbuf+
1682 $ j-irow1+1 ) - sum*t1
1683 z( j+icol1 ) = z( j+icol1 ) - sum*t2
1684 z( j+icol1+ldz ) = z( j+icol1+ldz ) -
1687 CALL sgesd2d( contxt, irow2-irow1+1, 1,
1689 $ irow2-irow1+1, myrow, left )
1693 IF( icurcol( ki ).EQ.mycol )
THEN
1694 IF( ( ispec.EQ.0 ) .OR. ( npcol.EQ.1 ) )
THEN
1695 localk2( ki ) = localk2( ki ) + 1
1698 IF( ( mod( k-1, hbl ).EQ.hbl-1 ) .AND.
1699 $ ( icurcol( ki ).EQ.right ) )
THEN
1701 localk2( ki ) = localk2( ki ) + 2
1703 localk2( ki ) = localk2( ki ) + 1
1706 IF( ( mod( k-1, hbl ).EQ.hbl-2 ) .AND.
1707 $ ( i-k.EQ.2 ) .AND. ( icurcol( ki ).EQ.
1709 localk2( ki ) = localk2( ki ) + 2
1722 DO 410 ki = 1, ibulge
1723 istart =
max( k1( ki ), m )
1724 istop =
min( k2( ki ), i-1 )
1725 IF( mod( istart-1, hbl ).GE.hbl-2 )
THEN
1737 DO 400 k = istart, istop
1739 v2 = work( vecsidx+( k-1 )*3+1 )
1740 v3 = work( vecsidx+( k-1 )*3+2 )
1741 t1 = work( vecsidx+( k-1 )*3+3 )
1742 nr =
min( 3, i-k+1 )
1744 IF ( icurrow( ki ).EQ.myrow )
THEN
1747 IF ( icurcol( ki ).EQ.mycol )
THEN
1754 CALL infog1l( k, hbl, npcol, mycol, 0, liloh,
1756 lihih = numroc( i2, hbl, mycol, 0, npcol )
1757 CALL infog1l( 1, hbl, nprow, myrow, 0, itmp2,
1759 itmp1 = numroc( k+1, hbl, myrow, 0, nprow )
1760 IF( icurrow( ki ).EQ.myrow )
THEN
1761 IF( ( ispec.EQ.0 ) .OR. ( nprow.EQ.1 ) .OR.
1762 $ ( mod( k-1, hbl ).EQ.hbl-2 ) )
THEN
1764 DO 340 j = ( liloh-1 )*lda,
1765 $ ( lihih-1 )*lda, lda
1766 sum = a( itmp1+j ) + v2*a( itmp1+1+j )
1767 a( itmp1+j ) = a( itmp1+j ) - sum*t1
1768 a( itmp1+1+j ) = a( itmp1+1+j ) - sum*t2
1771 IF( mod( k-1, hbl ).EQ.hbl-1 )
THEN
1772 CALL sgerv2d( contxt, 1, lihih-liloh+1,
1773 $ work( irbuf+1 ), 1, up,
1775 DO 350 j = liloh, lihih
1776 sum = work( irbuf+j-liloh+1 ) +
1777 $ v2*a( ( j-1 )*lda+itmp1 )
1778 work( irbuf+j-liloh+1 ) = work( irbuf+
1779 $ j-liloh+1 ) - sum*t1
1780 a( ( j-1 )*lda+itmp1 ) = a( ( j-1 )*
1781 $ lda+itmp1 ) - sum*t2
1783 CALL sgesd2d( contxt, 1, lihih-liloh+1,
1784 $ work( irbuf+1 ), 1, up,
1789 IF( ( mod( k-1, hbl ).EQ.hbl-1 ) .AND.
1790 $ ( icurrow( ki ).EQ.down ) )
THEN
1791 CALL sgesd2d( contxt, 1, lihih-liloh+1,
1792 $ a( ( liloh-1 )*lda+itmp1 ),
1793 $ lda, down, mycol )
1794 CALL sgerv2d( contxt, 1, lihih-liloh+1,
1795 $ a( ( liloh-1 )*lda+itmp1 ),
1796 $ lda, down, mycol )
1803 CALL infog1l( i1, hbl, nprow, myrow, 0, liloh,
1805 lihih = numroc( i, hbl, myrow, 0, nprow )
1807 IF( icurcol( ki ).EQ.mycol )
THEN
1809 IF( ( ispec.EQ.0 ) .OR. ( npcol.EQ.1 ) .OR.
1810 $ ( mod( k-1, hbl ).EQ.hbl-2 ) )
THEN
1811 CALL infog1l( k, hbl, npcol, mycol, 0, itmp1,
1813 itmp2 = numroc( k+1, hbl, mycol, 0, npcol )
1814 DO 360 j = liloh, lihih
1815 sum = a( ( itmp1-1 )*lda+j ) +
1816 $ v2*a( itmp1*lda+j )
1817 a( ( itmp1-1 )*lda+j ) = a( ( itmp1-1 )*
1819 a( itmp1*lda+j ) = a( itmp1*lda+j ) -
1823 itmp1 = localk2( ki )
1824 IF( mod( k-1, hbl ).EQ.hbl-1 )
THEN
1825 CALL sgerv2d( contxt, lihih-liloh+1, 1,
1827 $ lihih-liloh+1, myrow, left )
1828 DO 370 j = liloh, lihih
1829 sum = work( icbuf+j ) +
1830 $ v2*a( ( itmp1-1 )*lda+j )
1831 work( icbuf+j ) = work( icbuf+j ) -
1833 a( ( itmp1-1 )*lda+j )
1834 $ = a( ( itmp1-1 )*lda+j ) - sum*t2
1836 CALL sgesd2d( contxt, lihih-liloh+1, 1,
1838 $ lihih-liloh+1, myrow, left )
1842 IF( ( mod( k-1, hbl ).EQ.hbl-1 ) .AND.
1843 $ ( icurcol( ki ).EQ.right ) )
THEN
1845 CALL sgesd2d( contxt, lihih-liloh+1, 1,
1846 $ a( ( itmp1-1 )*lda+liloh ),
1847 $ lda, myrow, right )
1848 CALL infog1l( k, hbl, npcol, mycol, 0, itmp1,
1850 itmp2 = numroc( k+1, hbl, mycol, 0, npcol )
1851 CALL sgerv2d( contxt, lihih-liloh+1, 1,
1852 $ a( ( itmp1-1 )*lda+liloh ),
1853 $ lda, myrow, right )
1861 IF( icurcol( ki ).EQ.mycol )
THEN
1863 IF( ( ispec.EQ.0 ) .OR. ( npcol.EQ.1 ) .OR.
1864 $ ( mod( k-1, hbl ).EQ.hbl-2 ) )
THEN
1865 itmp1 = kcol( ki ) + k - istart
1866 itmp1 = ( itmp1-1 )*ldz
1867 DO 380 j = liloz, lihiz
1868 sum = z( j+itmp1 ) +
1869 $ v2*z( j+itmp1+ldz )
1870 z( j+itmp1 ) = z( j+itmp1 ) - sum*t1
1871 z( j+itmp1+ldz ) = z( j+itmp1+ldz ) -
1874 localk2( ki ) = localk2( ki ) + 1
1876 itmp1 = localk2( ki )
1878 IF( mod( k-1, hbl ).EQ.hbl-1 )
THEN
1879 CALL sgerv2d( contxt, lihiz-liloz+1, 1,
1880 $ work( icbuf+1 ), ldz,
1882 itmp1 = ( itmp1-1 )*ldz
1883 DO 390 j = liloz, lihiz
1884 sum = work( icbuf+j ) +
1886 work( icbuf+j ) = work( icbuf+j ) -
1888 z( j+itmp1 ) = z( j+itmp1 ) - sum*t2
1890 CALL sgesd2d( contxt, lihiz-liloz+1, 1,
1891 $ work( icbuf+1 ), ldz,
1893 localk2( ki ) = localk2( ki ) + 1
1900 IF( ( mod( k-1, hbl ).EQ.hbl-1 ) .AND.
1901 $ ( icurcol( ki ).EQ.right ) )
THEN
1903 itmp1 = ( itmp1-1 )*ldz
1904 CALL sgesd2d( contxt, lihiz-liloz+1, 1,
1905 $ z( liloz+itmp1 ), ldz,
1907 CALL sgerv2d( contxt, lihiz-liloz+1, 1,
1908 $ z( liloz+itmp1 ), ldz,
1910 localk2( ki ) = localk2( ki ) + 1
1919 IF( nprow.EQ.1 )
THEN
1920 krow( ki ) = krow( ki ) + k2( ki ) - k1( ki ) + 1
1921 kp2row( ki ) = kp2row( ki ) + k2( ki ) - k1( ki ) + 1
1923 IF( ( mod( k1( ki )-1, hbl ).LT.hbl-2 ) .AND.
1924 $ ( icurrow( ki ).EQ.myrow ) .AND. ( nprow.GT.1 ) )
1926 krow( ki ) = krow( ki ) + k2( ki ) - k1( ki ) + 1
1928 IF( ( mod( k2( ki ), hbl ).LT.hbl-2 ) .AND.
1929 $ ( icurrow( ki ).EQ.myrow ) .AND. ( nprow.GT.1 ) )
1931 kp2row( ki ) = kp2row( ki ) + k2( ki ) - k1( ki ) + 1
1933 IF( ( mod( k1( ki )-1, hbl ).GE.hbl-2 ) .AND.
1934 $ ( ( myrow.EQ.icurrow( ki ) ) .OR. ( down.EQ.
1935 $ icurrow( ki ) ) ) .AND. ( nprow.GT.1 ) )
THEN
1936 CALL infog1l( k2( ki )+1, hbl, nprow, myrow, 0,
1937 $ krow( ki ), itmp2 )
1938 itmp2 = numroc( n, hbl, myrow, 0, nprow )
1940 IF( ( mod( k2( ki ), hbl ).GE.hbl-2 ) .AND.
1941 $ ( ( myrow.EQ.icurrow( ki ) ) .OR. ( up.EQ.
1942 $ icurrow( ki ) ) ) .AND. ( nprow.GT.1 ) )
THEN
1943 CALL infog1l( 1, hbl, nprow, myrow, 0, itmp2,
1945 kp2row( ki ) = numroc( k2( ki )+3, hbl, myrow, 0,
1948 IF( npcol.EQ.1 )
THEN
1949 kcol( ki ) = kcol( ki ) + k2( ki ) - k1( ki ) + 1
1950 kp2col( ki ) = kp2col( ki ) + k2( ki ) - k1( ki ) + 1
1952 IF( ( mod( k1( ki )-1, hbl ).LT.hbl-2 ) .AND.
1953 $ ( icurcol( ki ).EQ.mycol ) .AND. ( npcol.GT.1 ) )
1955 kcol( ki ) = kcol( ki ) + k2( ki ) - k1( ki ) + 1
1957 IF( ( mod( k2( ki ), hbl ).LT.hbl-2 ) .AND.
1958 $ ( icurcol( ki ).EQ.mycol ) .AND. ( npcol.GT.1 ) )
1960 kp2col( ki ) = kp2col( ki ) + k2( ki ) - k1( ki ) + 1
1962 IF( ( mod( k1( ki )-1, hbl ).GE.hbl-2 ) .AND.
1963 $ ( ( mycol.EQ.icurcol( ki ) ) .OR. ( right.EQ.
1964 $ icurcol( ki ) ) ) .AND. ( npcol.GT.1 ) )
THEN
1965 CALL infog1l( k2( ki )+1, hbl, npcol, mycol, 0,
1966 $ kcol( ki ), itmp2 )
1967 itmp2 = numroc( n, hbl, mycol, 0, npcol )
1969 IF( ( mod( k2( ki ), hbl ).GE.hbl-2 ) .AND.
1970 $ ( ( mycol.EQ.icurcol( ki ) ) .OR. ( left.EQ.
1971 $ icurcol( ki ) ) ) .AND. ( npcol.GT.1 ) )
THEN
1972 CALL infog1l( 1, hbl, npcol, mycol, 0, itmp2,
1974 kp2col( ki ) = numroc( k2( ki )+3, hbl, mycol, 0,
1977 k1( ki ) = k2( ki ) + 1
1978 istop =
min( k1( ki )+rotn-mod( k1( ki ), rotn ), i-2 )
1979 istop =
min( istop, k1( ki )+hbl-3-
1980 $ mod( k1( ki )-1, hbl ) )
1981 istop =
min( istop, i2-2 )
1982 istop =
max( istop, k1( ki ) )
1985 IF( k1( ki ).EQ.istop )
THEN
1986 IF( ( mod( istop-1, hbl ).EQ.hbl-2 ) .AND.
1987 $ ( i-istop.GT.1 ) )
THEN
1991 icurrow( ki ) = mod( icurrow( ki )+1, nprow )
1992 icurcol( ki ) = mod( icurcol( ki )+1, npcol )
1996 IF( k2( ibulge ).LE.i-1 )
2013 CALL infog2l( i, i, desca, nprow, npcol, myrow, mycol, irow,
2014 $ icol, itmp1, itmp2 )
2015 IF( ( myrow.EQ.itmp1 ) .AND. ( mycol.EQ.itmp2 ) )
THEN
2016 wr( i ) = a( ( icol-1 )*lda+irow )
2021 ELSE IF( l.EQ.i-1 )
THEN
2025 CALL pselget(
'All',
' ', h11, a, l, l, desca )
2026 CALL pselget(
'All',
' ', h21, a, i, l, desca )
2027 CALL pselget(
'All',
' ', h12, a, l, i, desca )
2028 CALL pselget(
'All',
' ', h22, a, i, i, desca )
2029 CALL slanv2( h11, h12, h21, h22, wr( l ), wi( l ), wr( i ),
2031 IF( node .NE. 0 )
THEN
2042 IF( jblk.LE.2*iblk )
THEN
2043 CALL pslacp3( i-l+1, l, a, desca, s1, 2*iblk, 0, 0, 0 )
2044 CALL slahqr( .false., .false., jblk, 1, jblk, s1, 2*iblk,
2045 $ wr( l ), wi( l ), 1, jblk, z, ldz, ierr )
2046 IF( node.NE.0 )
THEN
2062 IF( m.EQ.l-10 )
THEN
2071 CALL sgsum2d( contxt,
'All',
' ', n, 1, wr, n, -1, -1 )
2072 CALL sgsum2d( contxt,
'All',
' ', n, 1, wi, n, -1, -1 )