1 RECURSIVE SUBROUTINE pslaqr1( WANTT, WANTZ, N, ILO, IHI, A,
2 $ DESCA, WR, WI, ILOZ, IHIZ, Z,
3 $ DESCZ, WORK, LWORK, IWORK,
18 INTEGER ihi, ihiz, ilo, iloz, ilwork, info, lwork, n
21 INTEGER desca( * ), descz( * ), iwork( * )
22 REAL a( * ), wi( * ), work( * ), wr( * ), z( * )
253 INTEGER block_cyclic_2d, csrc_, ctxt_, dlen_, dtype_,
254 $ lld_, mb_, m_, nb_, n_, rsrc_
255 PARAMETER ( block_cyclic_2d = 1, dlen_ = 9, dtype_ = 1,
256 $ ctxt_ = 2, m_ = 3, n_ = 4, mb_ = 5, nb_ = 6,
257 $ rsrc_ = 7, csrc_ = 8, lld_ = 9 )
259 PARAMETER ( zero = 0.0, one = 1.0, half = 0.5 )
261 parameter( const = 1.50 )
263 parameter( iblk = 32, lds = 12*iblk+1 )
266 INTEGER contxt, down, hbl, i, i1, i2, iafirst, ibulge,
267 $ icbuf, icol, icol1, icol2, ierr, ii,
268 $ irbuf, irow, irow1, irow2, ispec, istart,
269 $ istartcol, istartrow, istop, isub,
270 $ itermax, itmp1, itmp2, itn, its, j, jafirst,
271 $ jblk, jj, k, ki, l, lcmrc, lda, ldz, left,
272 $ lihih, lihiz, liloh, liloz, locali1, locali2,
273 $ localk, localm, m, modkm1, mycol, myrow,
274 $ nbulge, nh, node, npcol, nprow, nr, num, nz,
275 $ right, rotn, up, vecsidx, totit, totns, totsw,
276 $ dblk, nibble, nd, ns, ltop, lwkopt, s1, s2, s3
277 REAL ave, disc, h00, h10, h11, h12, h21, h22, h33,
278 $ h43h34, h44, ovfl, s, smlnum, sum, t1, t1copy,
279 $ t2, t3, ulp, unfl, v1save, v2, v2save, v3,
280 $ v3save, sn, cs, swap
284 INTEGER icurcol( iblk ), icurrow( iblk ), k1( iblk ),
285 $ k2( iblk ), kcol( iblk ), kp2col( iblk ),
286 $ kp2row( iblk ), krow( iblk ), localk2( iblk )
287 REAL smalla( 6, 6, iblk ), vcopy( 3 )
295 EXTERNAL blacs_gridinfo, scopy, sgebr2d, sgebs2d,
296 $ sgerv2d, sgesd2d, sgsum2d, slahqr,
slaref,
302 INTRINSIC abs, float,
max,
min, mod, sign, sqrt
308 itermax = 30*( ihi-ilo+1 )
315 contxt = desca( ctxt_ )
317 iafirst = desca( rsrc_ )
318 jafirst = desca( csrc_ )
320 CALL blacs_gridinfo( contxt, nprow, npcol, myrow, mycol )
321 node = myrow*npcol + mycol
323 left = mod( mycol+npcol-1, npcol )
324 right = mod( mycol+1, npcol )
325 up = mod( myrow+nprow-1, nprow )
326 down = mod( myrow+1, nprow )
327 lcmrc =
ilcm( nprow, npcol )
334 localk =
numroc( n, hbl, mycol, jafirst, npcol )
339 lwkopt = int( 6*n+
max( 3*
max( lda, ldz )+2*localk, jj )
341 IF( lwork.EQ.-1 .OR. ilwork.EQ.-1 )
THEN
342 work( 1 ) = float( lwkopt )
345 ELSEIF( lwork.LT.lwkopt )
THEN
348 IF( descz( ctxt_ ).NE.desca( ctxt_ ) )
THEN
349 info = -( 1300+ctxt_ )
351 IF( desca( mb_ ).NE.desca( nb_ ) )
THEN
354 IF( descz( mb_ ).NE.descz( nb_ ) )
THEN
357 IF( desca( mb_ ).NE.descz( mb_ ) )
THEN
360 IF( ( ilo.GT.n ) .OR. ( ilo.LT.1 ) )
THEN
363 IF( ( ihi.GT.n ) .OR. ( ihi.LT.1 ) )
THEN
369 CALL igamn2d( contxt,
'ALL',
' ', 1, 1, info, 1, itmp1, itmp2, -1,
372 CALL pxerbla( contxt,
'PSLAQR1', -info )
373 work( 1 ) = float( lwkopt )
382 vecsidx = s3+4*lds*lds
390 rotn =
max( rotn, hbl-2 )
391 rotn =
min( rotn, 1 )
393 IF( ilo.EQ.ihi )
THEN
394 CALL infog2l( ilo, ilo, desca, nprow, npcol, myrow, mycol,
395 $ irow, icol, ii, jj )
396 IF( ( myrow.EQ.ii ) .AND. ( mycol.EQ.jj ) )
THEN
397 wr( ilo ) = a( ( icol-1 )*lda+irow )
402 work( 1 ) = float( lwkopt )
412 IF( nh .LE. lds )
THEN
413 CALL pslaqr4( wantt, wantz, n, ilo, ihi, a, desca, wr, wi,
414 $ iloz, ihiz, z, descz, work( s1+1 ), nh,
415 $ work( s2+1 ), nh, work( s3+1 ), 4*lds*lds,
417 work( 1 ) = float( lwkopt )
421 CALL infog1l( iloz, hbl, nprow, myrow, descz(rsrc_), liloz, lihiz)
422 lihiz =
numroc( ihiz, hbl, myrow, descz(rsrc_), nprow )
427 unfl =
pslamch( contxt,
'SAFE MINIMUM' )
429 CALL pslabad( contxt, unfl, ovfl )
430 ulp =
pslamch( contxt,
'PRECISION' )
431 smlnum = unfl*( nh / ulp )
468 CALL pslasmsub( a, desca, i, l, k, smlnum, work( irbuf+1 ),
476 CALL infog2l( l, l-1, desca, nprow, npcol, myrow, mycol,
477 $ irow, icol, itmp1, itmp2 )
478 IF( ( myrow.EQ.itmp1 ) .AND. ( mycol.EQ.itmp2 ) )
THEN
479 a( ( icol-1 )*lda+irow ) = zero
481 work( isub+l-1 ) = zero
487 IF ( l .GT. i - lds )
494 IF( .NOT.wantt )
THEN
504 jblk =
min( iblk, ( nh / 2 )-1 )
505 IF( jblk.GT.lcmrc )
THEN
509 jblk = jblk - mod( jblk, lcmrc )
511 jblk =
min( jblk, 2*lcmrc )
512 jblk =
max( jblk, 1 )
514 IF( its.EQ.20 .OR. its.EQ.40 )
THEN
518 CALL pslacp3( 2*jblk, i-2*jblk+1, a, desca, work( s1+1 ),
520 DO 20 ii = 2*jblk, 2, -1
521 work( s1+ii+(ii-1)*lds ) = const*(
522 $ abs( work( s1+ii+(ii-1)*lds ) )+
523 $ abs( work( s1+ii+(ii-2)*lds ) ) )
524 work( s1+ii+(ii-2)*lds ) = zero
525 work( s1+ii-1+(ii-1)*lds ) = zero
527 work( s1+1 ) = const*abs( work( s1+1 ) )
533 dblk = ilaenv( 13,
'DLAQR0',
'SV', n, l, i, 4*lds*lds )
534 dblk =
max( 2*jblk, dblk ) + 1
535 dblk =
min( nh, lds, dblk )
536 CALL pslaqr2( wantt, wantz, n, l, i, dblk, a, desca,
537 $ iloz, ihiz, z, descz, ns, nd, wr, wi,
538 $ work( s1+1 ), lds, work( s2+1 ), dblk,
539 $ work( irbuf+1 ), work( icbuf+1 ),
540 $ work( s3+1 ), 4*lds*lds )
544 nibble = ilaenv( 14,
'DLAQR0',
'SV', n, l, i, 4*lds*lds )
545 nibble =
max( 0, nibble )
548 IF( 100*nd .GT. nibble*nh .OR. dblk .LT. 2*jblk )
GOTO 10
556 CALL slaset(
'L', dblk-1, dblk-1, zero, zero,
557 $ work( s1+2 ), lds )
558 work( irbuf+1 ) = work( s1+1 )
559 work( icbuf+1 ) = zero
565 DO 21 ii = dblk, 3, -2
566 IF( work( icbuf+ii ).NE.-work( icbuf+ii-1 ) )
THEN
567 swap = work( irbuf+ii )
568 work( irbuf+ii ) = work( irbuf+ii-1 )
569 work( irbuf+ii-1 ) = work( irbuf+ii-2 )
570 work( irbuf+ii-2 ) = swap
571 swap = work( icbuf+ii )
572 work( icbuf+ii ) = work( icbuf+ii-1 )
573 work( icbuf+ii-1 ) = work( icbuf+ii-2 )
574 work( icbuf+ii-2 ) = swap
582 IF( work( icbuf+ii ) .EQ. zero )
THEN
583 work( s1+ii+(ii-1)*lds ) = work( irbuf+ii )
584 work( s1+ii+(ii-2)*lds ) = zero
587 work( s1+ii+(ii-1)*lds ) = work( irbuf+ii )
588 work( s1+ii+1+ii*lds ) = work( irbuf+ii )
589 work( s1+ii+1+(ii-1)*lds ) = work( icbuf+ii )
590 work( s1+ii+ii*lds ) = -work( icbuf+ii )
593 IF( ii .LE. dblk )
GOTO 22
595 CALL slahqr( .false., .false., dblk, 1, dblk,
596 $ work( s1+1 ), lds, work( irbuf+1 ),
597 $ work( icbuf+1 ), 1, dblk, z, ldz, ierr )
601 CALL pslacp3( dblk, i-dblk+1, a, desca, work( s1+1 ),
603 CALL slahqr( .false., .false., dblk, 1, dblk,
604 $ work( s1+1 ), lds, work( irbuf+1 ),
605 $ work( icbuf+1 ), 1, dblk, z, ldz, ierr )
611 h44 = work( s1+dblk+(dblk-1)*lds )
612 h33 = work( s1+dblk-1+(dblk-2)*lds )
613 h43h34 = work( s1+dblk-1+(dblk-1)*lds )*
614 $ work( s1+dblk+(dblk-2)*lds )
615 IF( ( jblk.GT.1 ) .AND. ( its.GT.30 ) )
THEN
616 s = work( s1+dblk-1+(dblk-3)*lds )
617 disc = ( h33-h44 )*half
618 disc = disc*disc + h43h34
619 IF( disc.GT.zero )
THEN
624 ave = half*( h33+h44 )
625 IF( abs( h33 )-abs( h44 ).GT.zero )
THEN
626 h33 = h33*h44 - h43h34
627 h44 = h33 / ( sign( disc, ave )+ave )
629 h44 = sign( disc, ave ) + ave
663 istop =
min( m+rotn-mod( m, rotn ), i-2 )
664 istop =
min( istop, m+hbl-3-mod( m-1, hbl ) )
665 istop =
min( istop, i2-2 )
666 istop =
max( istop, m )
667 nbulge = ( i-1-istop ) / hbl
671 nbulge =
min( nbulge, jblk )
672 IF( nbulge.GT.lcmrc )
THEN
676 nbulge = nbulge - mod( nbulge, lcmrc )
678 nbulge =
max( nbulge, 1 )
680 totns = totns + nbulge*2
682 IF( ( its.NE.20 ) .AND. ( its.NE.40 ) .AND. ( nbulge.GT.1 ) )
691 CALL slasorte( work(s1+dblk-2*nbulge+1+(dblk-2*nbulge)*lds),
692 $ lds, 2*nbulge, work( irbuf+1 ), ierr )
701 CALL infog1l( m, hbl, npcol, mycol, desca(csrc_),itmp1,localk )
702 localk =
numroc( n, hbl, mycol, desca(csrc_), npcol )
703 CALL infog1l( 1, hbl, npcol, mycol,desca(csrc_),icol1,locali2 )
704 locali2 =
numroc( i2, hbl, mycol, desca(csrc_), npcol )
708 CALL infog1l( i1, hbl, nprow,myrow,desca(rsrc_),locali1,icol1 )
709 icol1 =
numroc( n, hbl, myrow, desca(rsrc_), nprow )
710 CALL infog1l( 1, hbl, nprow, myrow, desca(rsrc_),localm,icol1 )
711 icol1 =
numroc(
min( m+3, i ), hbl, myrow, desca(rsrc_),nprow )
715 istartrow = mod( ( m+1 ) / hbl + iafirst, nprow )
716 istartcol = mod( ( m+1 ) / hbl + jafirst, npcol )
718 CALL infog1l( m, hbl, nprow, myrow, desca(rsrc_), ii, itmp2 )
719 itmp2 =
numroc( n, hbl, myrow, desca(rsrc_), nprow )
720 CALL infog1l( m, hbl, npcol, mycol, desca(csrc_), jj, itmp2 )
721 itmp2 =
numroc( n, hbl, mycol, desca(csrc_), npcol )
722 CALL infog1l(1,hbl,nprow,myrow,desca(rsrc_),istop,kp2row( 1 ) )
723 kp2row( 1 ) =
numroc( m+2, hbl, myrow, desca(rsrc_), nprow )
724 CALL infog1l(1,hbl,npcol,mycol,desca(csrc_),istop,kp2col( 1 ) )
725 kp2col( 1 ) =
numroc( m+2, hbl, mycol, desca(csrc_), npcol )
745 istop =
min( m+rotn-mod( m, rotn ), i-2 )
746 istop =
min( istop, m+hbl-3-mod( m-1, hbl ) )
747 istop =
min( istop, i2-2 )
748 istop =
max( istop, m )
750 icurrow( ki ) = istartrow
751 icurcol( ki ) = istartcol
752 localk2( ki ) = itmp1
756 $ kp2row( ki ) = kp2row( 1 )
758 $ kp2col( ki ) = kp2col( 1 )
768 CALL pslawil( itmp1, itmp2, m, a, desca, h44, h33, h43h34,
773 IF( k2( ibulge ).LE.i-1 )
THEN
775 IF( ( k1( ibulge ).GE.m+5 ) .AND. ( ibulge.LT.nbulge ) )
777 IF( ( mod( k2( ibulge )+2, hbl ).EQ.mod( k2( ibulge+1 )+
778 $ 2, hbl ) ) .AND. ( k1( 1 ).LE.i-1 ) )
THEN
779 h44 = work( s1+dblk-2*ibulge+(dblk-2*ibulge-1)*lds )
780 h33 = work( s1+dblk-2*ibulge-1+(dblk-2*ibulge-2)*lds )
781 h43h34 = work( s1+dblk-2*ibulge-1+
782 $ (dblk-2*ibulge-1)*lds )
783 $ *work(s1+dblk-2*ibulge+(dblk-2*ibulge-2)*lds)
786 CALL pslawil( itmp1, itmp2, m, a, desca, h44, h33,
804 istart =
max( k1( ki ), m )
805 istop =
min( k2( ki ), i-1 )
807 modkm1 = mod( k-1, hbl )
808 IF( ( modkm1.GE.hbl-2 ) .AND. ( k.LE.i-1 ) )
THEN
811 smalla(itmp1, itmp2, ki) = zero
814 IF( ( modkm1.EQ.hbl-2 ) .AND. ( k.LT.i-1 ) )
THEN
818 CALL infog2l( k+2, k+2, desca, nprow, npcol, myrow,
819 $ mycol, irow1, icol1, itmp1, itmp2 )
821 $ smalla( 1, 1, ki ), 6, itmp1, itmp2,
824 IF( modkm1.EQ.hbl-1 )
THEN
828 CALL infog2l( k+1, k+1, desca, nprow, npcol, myrow,
829 $ mycol, irow1, icol1, itmp1, itmp2 )
831 $ smalla( 1, 1, ki ), 6, itmp1, itmp2,
860 IF( ( myrow.EQ.icurrow( ki ) ) .AND.
861 $ ( mycol.EQ.icurcol( ki ) ) .AND.
862 $ ( modkm1.EQ.hbl-2 ) .AND.
863 $ ( istart.LT.
min( i-1, istop+1 ) ) )
THEN
867 CALL scopy( nr, smalla( 2, 1, ki ), 1, vcopy, 1 )
873 CALL slarfg( nr, vcopy( 1 ), vcopy( 2 ), 1, t1copy )
875 smalla( 2, 1, ki ) = vcopy( 1 )
876 smalla( 3, 1, ki ) = zero
878 $ smalla( 4, 1, ki ) = zero
879 ELSE IF( m.GT.l )
THEN
880 smalla( 2, 1, ki ) = -smalla( 2, 1, ki )
884 work( vecsidx+( k-1 )*3+1 ) = vcopy( 2 )
885 work( vecsidx+( k-1 )*3+2 ) = vcopy( 3 )
886 work( vecsidx+( k-1 )*3+3 ) = t1copy
889 IF( ( mod( istop-1, hbl ).EQ.hbl-1 ) .AND.
890 $ ( myrow.EQ.icurrow( ki ) ) .AND.
891 $ ( mycol.EQ.icurcol( ki ) ) .AND.
892 $ ( istart.LE.
min( i, istop ) ) )
THEN
896 CALL scopy( nr, smalla( 3, 2, ki ), 1, vcopy, 1 )
902 CALL slarfg( nr, vcopy( 1 ), vcopy( 2 ), 1, t1copy )
904 smalla( 3, 2, ki ) = vcopy( 1 )
905 smalla( 4, 2, ki ) = zero
907 $ smalla( 5, 2, ki ) = zero
919 ELSE IF( m.GT.l )
THEN
920 smalla( 3, 2, ki ) = -smalla( 3, 2, ki )
924 work( vecsidx+( k-1 )*3+1 ) = vcopy( 2 )
925 work( vecsidx+( k-1 )*3+2 ) = vcopy( 3 )
926 work( vecsidx+( k-1 )*3+3 ) = t1copy
929 IF( ( modkm1.EQ.0 ) .AND. ( istart.LE.i-1 ) .AND.
930 $ ( myrow.EQ.icurrow( ki ) ) .AND.
931 $ ( right.EQ.icurcol( ki ) ) )
THEN
936 icol1 = localk2( ki )
937 IF( istart.GT.m )
THEN
938 vcopy( 1 ) = smalla( 4, 3, ki )
939 vcopy( 2 ) = smalla( 5, 3, ki )
940 vcopy( 3 ) = smalla( 6, 3, ki )
941 nr =
min( 3, i-istart+1 )
942 CALL slarfg( nr, vcopy( 1 ), vcopy( 2 ), 1,
944 a( ( icol1-2 )*lda+irow1 ) = vcopy( 1 )
945 a( ( icol1-2 )*lda+irow1+1 ) = zero
946 IF( istart.LT.i-1 )
THEN
947 a( ( icol1-2 )*lda+irow1+2 ) = zero
951 a( ( icol1-2 )*lda+irow1 ) = -a( ( icol1-2 )*
957 IF( ( myrow.EQ.icurrow( ki ) ) .AND.
958 $ ( mycol.EQ.icurcol( ki ) ) .AND.
959 $ ( ( ( modkm1.EQ.hbl-2 ) .AND. ( istart.EQ.i-
960 $ 1 ) ) .OR. ( ( modkm1.LT.hbl-2 ) .AND. ( istart.LE.i-
966 icol1 = localk2( ki )
967 DO 70 k = istart, istop
973 IF( mod( k-1, hbl ).EQ.0 )
THEN
974 vcopy( 1 ) = smalla( 4, 3, ki )
975 vcopy( 2 ) = smalla( 5, 3, ki )
976 vcopy( 3 ) = smalla( 6, 3, ki )
978 vcopy( 1 ) = a( ( icol1-2 )*lda+irow1 )
979 vcopy( 2 ) = a( ( icol1-2 )*lda+irow1+1 )
981 vcopy( 3 ) = a( ( icol1-2 )*lda+irow1+2 )
989 CALL slarfg( nr, vcopy( 1 ), vcopy( 2 ), 1,
992 IF( mod( k-1, hbl ).GT.0 )
THEN
993 a( ( icol1-2 )*lda+irow1 ) = vcopy( 1 )
994 a( ( icol1-2 )*lda+irow1+1 ) = zero
996 a( ( icol1-2 )*lda+irow1+2 ) = zero
1012 ELSE IF( m.GT.l )
THEN
1013 IF( mod( k-1, hbl ).GT.0 )
THEN
1014 a( ( icol1-2 )*lda+irow1 ) = -a( ( icol1-2 )*
1020 work( vecsidx+( k-1 )*3+1 ) = vcopy( 2 )
1021 work( vecsidx+( k-1 )*3+2 ) = vcopy( 3 )
1022 work( vecsidx+( k-1 )*3+3 ) = t1copy
1024 IF( k.LT.istop )
THEN
1030 DO 50 j = icol1,
min( k2( ki )+1, i-1 ) +
1032 sum = a( ( j-1 )*lda+irow1 ) +
1033 $ v2*a( ( j-1 )*lda+irow1+1 ) +
1034 $ v3*a( ( j-1 )*lda+irow1+2 )
1035 a( ( j-1 )*lda+irow1 ) = a( ( j-1 )*lda+
1037 a( ( j-1 )*lda+irow1+1 ) = a( ( j-1 )*lda+
1038 $ irow1+1 ) - sum*t2
1039 a( ( j-1 )*lda+irow1+2 ) = a( ( j-1 )*lda+
1040 $ irow1+2 ) - sum*t3
1042 itmp1 = localk2( ki )
1043 DO 60 j = irow1 + 1, irow1 + 3
1044 sum = a( ( icol1-1 )*lda+j ) +
1045 $ v2*a( icol1*lda+j ) +
1046 $ v3*a( ( icol1+1 )*lda+j )
1047 a( ( icol1-1 )*lda+j ) = a( ( icol1-1 )*lda+
1049 a( icol1*lda+j ) = a( icol1*lda+j ) - sum*t2
1050 a( ( icol1+1 )*lda+j ) = a( ( icol1+1 )*lda+
1059 IF( modkm1.EQ.hbl-2 )
THEN
1060 IF( ( down.EQ.icurrow( ki ) ) .AND.
1061 $ ( right.EQ.icurcol( ki ) ) .AND. ( num.GT.1 ) )
1063 CALL sgerv2d( contxt, 3, 1,
1064 $ work( vecsidx+( istart-1 )*3+1 ), 3,
1067 IF( ( myrow.EQ.icurrow( ki ) ) .AND.
1068 $ ( mycol.EQ.icurcol( ki ) ) .AND. ( num.GT.1 ) )
1070 CALL sgesd2d( contxt, 3, 1,
1071 $ work( vecsidx+( istart-1 )*3+1 ), 3,
1074 IF( ( down.EQ.icurrow( ki ) ) .AND.
1075 $ ( npcol.GT.1 ) .AND. ( istart.LE.istop ) )
THEN
1076 jj = mod( icurcol( ki )+npcol-1, npcol )
1077 IF( mycol.NE.jj )
THEN
1078 CALL sgebr2d( contxt,
'ROW',
' ',
1079 $ 3*( istop-istart+1 ), 1,
1080 $ work( vecsidx+( istart-1 )*3+1 ),
1081 $ 3*( istop-istart+1 ), myrow, jj )
1083 CALL sgebs2d( contxt,
'ROW',
' ',
1084 $ 3*( istop-istart+1 ), 1,
1085 $ work( vecsidx+( istart-1 )*3+1 ),
1086 $ 3*( istop-istart+1 ) )
1093 IF( ( myrow.EQ.icurrow( ki ) ) .AND. ( npcol.GT.1 ) .AND.
1094 $ ( istart.LE.istop ) )
THEN
1095 IF( mycol.NE.icurcol( ki ) )
THEN
1096 CALL sgebr2d( contxt,
'ROW',
' ',
1097 $ 3*( istop-istart+1 ), 1,
1098 $ work( vecsidx+( istart-1 )*3+1 ),
1099 $ 3*( istop-istart+1 ), myrow,
1102 CALL sgebs2d( contxt,
'ROW',
' ',
1103 $ 3*( istop-istart+1 ), 1,
1104 $ work( vecsidx+( istart-1 )*3+1 ),
1105 $ 3*( istop-istart+1 ) )
1112 DO 90 ki = 1, ibulge
1114 istart =
max( k1( ki ), m )
1115 istop =
min( k2( ki ), i-1 )
1117 IF( mod( istart-1, hbl ).EQ.hbl-2 )
THEN
1118 IF( ( right.EQ.icurcol( ki ) ) .AND.
1119 $ ( nprow.GT.1 ) .AND. ( istart.LE.istop ) )
THEN
1120 jj = mod( icurrow( ki )+nprow-1, nprow )
1121 IF( myrow.NE.jj )
THEN
1122 CALL sgebr2d( contxt,
'COL',
' ',
1123 $ 3*( istop-istart+1 ), 1,
1124 $ work( vecsidx+( istart-1 )*3+1 ),
1125 $ 3*( istop-istart+1 ), jj, mycol )
1127 CALL sgebs2d( contxt,
'COL',
' ',
1128 $ 3*( istop-istart+1 ), 1,
1129 $ work( vecsidx+( istart-1 )*3+1 ),
1130 $ 3*( istop-istart+1 ) )
1135 IF( ( mycol.EQ.icurcol( ki ) ) .AND. ( nprow.GT.1 ) .AND.
1136 $ ( istart.LE.istop ) )
THEN
1137 IF( myrow.NE.icurrow( ki ) )
THEN
1138 CALL sgebr2d( contxt,
'COL',
' ',
1139 $ 3*( istop-istart+1 ), 1,
1140 $ work( vecsidx+( istart-1 )*3+1 ),
1141 $ 3*( istop-istart+1 ), icurrow( ki ),
1144 CALL sgebs2d( contxt,
'COL',
' ',
1145 $ 3*( istop-istart+1 ), 1,
1146 $ work( vecsidx+( istart-1 )*3+1 ),
1147 $ 3*( istop-istart+1 ) )
1154 DO 150 ki = 1, ibulge
1155 istart =
max( k1( ki ), m )
1156 istop =
min( k2( ki ), i-1 )
1158 modkm1 = mod( istart-1, hbl )
1159 IF( ( myrow.EQ.icurrow( ki ) ) .AND.
1160 $ ( mycol.EQ.icurcol( ki ) ) .AND.
1161 $ ( modkm1.EQ.hbl-2 ) .AND. ( istart.LT.i-1 ) )
THEN
1166 nr =
min( 3, i-k+1 )
1167 v2 = work( vecsidx+( k-1 )*3+1 )
1168 v3 = work( vecsidx+( k-1 )*3+2 )
1169 t1 = work( vecsidx+( k-1 )*3+3 )
1177 itmp1 =
min( 6, i2+2-k )
1178 itmp2 =
max( i1-k+2, 1 )
1180 sum = smalla( 2, j, ki ) +
1181 $ v2*smalla( 3, j, ki ) +
1182 $ v3*smalla( 4, j, ki )
1183 smalla( 2, j, ki ) = smalla( 2, j, ki ) - sum*t1
1184 smalla( 3, j, ki ) = smalla( 3, j, ki ) - sum*t2
1185 smalla( 4, j, ki ) = smalla( 4, j, ki ) - sum*t3
1188 sum = smalla( j, 2, ki ) +
1189 $ v2*smalla( j, 3, ki ) +
1190 $ v3*smalla( j, 4, ki )
1191 smalla( j, 2, ki ) = smalla( j, 2, ki ) - sum*t1
1192 smalla( j, 3, ki ) = smalla( j, 3, ki ) - sum*t2
1193 smalla( j, 4, ki ) = smalla( j, 4, ki ) - sum*t3
1198 IF( ( mod( istart-1, hbl ).EQ.hbl-1 ) .AND.
1199 $ ( istart.LE.istop ) .AND.
1200 $ ( myrow.EQ.icurrow( ki ) ) .AND.
1201 $ ( mycol.EQ.icurcol( ki ) ) )
THEN
1206 nr =
min( 3, i-k+1 )
1207 v2 = work( vecsidx+( k-1 )*3+1 )
1208 v3 = work( vecsidx+( k-1 )*3+2 )
1209 t1 = work( vecsidx+( k-1 )*3+3 )
1217 itmp1 =
min( 6, i2-k+3 )
1218 itmp2 =
max( i1-k+3, 1 )
1220 sum = smalla( 3, j, ki ) +
1221 $ v2*smalla( 4, j, ki ) +
1222 $ v3*smalla( 5, j, ki )
1223 smalla( 3, j, ki ) = smalla( 3, j, ki ) - sum*t1
1224 smalla( 4, j, ki ) = smalla( 4, j, ki ) - sum*t2
1225 smalla( 5, j, ki ) = smalla( 5, j, ki ) - sum*t3
1228 sum = smalla( j, 3, ki ) +
1229 $ v2*smalla( j, 4, ki ) +
1230 $ v3*smalla( j, 5, ki )
1231 smalla( j, 3, ki ) = smalla( j, 3, ki ) - sum*t1
1232 smalla( j, 4, ki ) = smalla( j, 4, ki ) - sum*t2
1233 smalla( j, 5, ki ) = smalla( j, 5, ki ) - sum*t3
1238 modkm1 = mod( istart-1, hbl )
1239 IF( ( myrow.EQ.icurrow( ki ) ) .AND.
1240 $ ( mycol.EQ.icurcol( ki ) ) .AND.
1241 $ ( ( ( modkm1.EQ.hbl-2 ) .AND. ( istart.EQ.i-
1242 $ 1 ) ) .OR. ( ( modkm1.LT.hbl-2 ) .AND. ( istart.LE.i-
1248 icol1 = localk2( ki )
1249 DO 140 k = istart, istop
1253 nr =
min( 3, i-k+1 )
1254 v2 = work( vecsidx+( k-1 )*3+1 )
1255 v3 = work( vecsidx+( k-1 )*3+2 )
1256 t1 = work( vecsidx+( k-1 )*3+3 )
1257 IF( k.LT.istop )
THEN
1263 CALL slaref(
'Col', a, lda, .false., z, ldz,
1264 $ .false., icol1, icol1, istart,
1265 $ istop,
min( istart+1, i )-k+irow1,
1266 $ irow1, liloz, lihiz,
1267 $ work( vecsidx+1 ), v2, v3, t1, t2,
1272 IF( ( nr.EQ.3 ) .AND. ( mod( k-1,
1273 $ hbl ).LT.hbl-2 ) )
THEN
1276 CALL slaref(
'Row', a, lda, .false., z, ldz,
1277 $ .false., irow1, irow1, istart,
1278 $ istop, icol1,
min(
min( k2( ki )
1279 $ +1, i-1 ), i2 )-k+icol1, liloz,
1280 $ lihiz, work( vecsidx+1 ), v2,
1290 modkm1 = mod( k-1, hbl )
1291 IF( ( modkm1.GE.hbl-2 ) .AND. ( k.LE.i-1 ) )
THEN
1292 IF( ( modkm1.EQ.hbl-2 ) .AND. ( k.LT.i-1 ) )
THEN
1296 CALL infog2l( k+2, k+2, desca, nprow, npcol, myrow,
1297 $ mycol, irow1, icol1, itmp1, itmp2 )
1298 CALL pslacp3(
min( 6, n-k+2 ), k-1, a, desca,
1299 $ smalla( 1, 1, ki ), 6, itmp1, itmp2,
1303 IF( modkm1.EQ.hbl-1 )
THEN
1307 CALL infog2l( k+1, k+1, desca, nprow, npcol, myrow,
1308 $ mycol, irow1, icol1, itmp1, itmp2 )
1309 CALL pslacp3(
min( 6, n-k+3 ), k-2, a, desca,
1310 $ smalla( 1, 1, ki ), 6, itmp1, itmp2,
1319 DO 160 ki = 1, ibulge
1320 IF( ( myrow.NE.icurrow( ki ) ) .AND.
1321 $ ( down.NE.icurrow( ki ) ) )
GO TO 160
1322 istart =
max( k1( ki ), m )
1323 istop =
min( k2( ki ), i-1 )
1325 IF( ( istop.GT.istart ) .AND.
1326 $ ( mod( istart-1, hbl ).LT.hbl-2 ) .AND.
1327 $ ( icurrow( ki ).EQ.myrow ) )
THEN
1328 irow1 =
min( k2( ki )+1, i-1 ) + 1
1329 CALL infog1l( irow1, hbl, npcol, mycol, desca(csrc_),
1331 itmp2 =
numroc( i2, hbl, mycol, desca(csrc_), npcol )
1333 CALL slaref(
'Row', a, lda, wantz, z, ldz, .true., ii,
1334 $ ii, istart, istop, itmp1, itmp2, liloz,
1335 $ lihiz, work( vecsidx+1 ), v2, v3, t1, t2,
1340 DO 180 ki = 1, ibulge
1341 IF( krow( ki ).GT.kp2row( ki ) )
1343 IF( ( myrow.NE.icurrow( ki ) ) .AND.
1344 $ ( down.NE.icurrow( ki ) ) )
GO TO 180
1345 istart =
max( k1( ki ), m )
1346 istop =
min( k2( ki ), i-1 )
1347 IF( ( istart.EQ.istop ) .OR.
1348 $ ( mod( istart-1, hbl ).GE.hbl-2 ) .OR.
1349 $ ( icurrow( ki ).NE.myrow ) )
THEN
1350 DO 170 k = istart, istop
1351 v2 = work( vecsidx+( k-1 )*3+1 )
1352 v3 = work( vecsidx+( k-1 )*3+2 )
1353 t1 = work( vecsidx+( k-1 )*3+3 )
1354 nr =
min( 3, i-k+1 )
1355 IF( ( nr.EQ.3 ) .AND. ( krow( ki ).LE.
1356 $ kp2row( ki ) ) )
THEN
1357 IF( ( k.LT.istop ) .AND.
1358 $ ( mod( k-1, hbl ).LT.hbl-2 ) )
THEN
1359 itmp1 =
min( k2( ki )+1, i-1 ) + 1
1361 IF( mod( k-1, hbl ).LT.hbl-2 )
THEN
1362 itmp1 =
min( k2( ki )+1, i-1 ) + 1
1364 IF( mod( k-1, hbl ).EQ.hbl-2 )
THEN
1365 itmp1 =
min( k+4, i2 ) + 1
1367 IF( mod( k-1, hbl ).EQ.hbl-1 )
THEN
1368 itmp1 =
min( k+3, i2 ) + 1
1375 irow2 = kp2row( ki )
1376 CALL infog1l( itmp1, hbl, npcol, mycol,
1377 $ desca(csrc_), icol1, icol2 )
1378 icol2 =
numroc(i2,hbl,mycol,desca(csrc_),npcol )
1379 IF( ( mod( k-1, hbl ).LT.hbl-2 ) .OR.
1380 $ ( nprow.EQ.1 ) )
THEN
1383 CALL slaref(
'Row', a, lda, wantz, z, ldz,
1384 $ .false., irow1, irow1, istart,
1385 $ istop, icol1, icol2, liloz,
1386 $ lihiz, work( vecsidx+1 ), v2,
1389 IF( ( mod( k-1, hbl ).EQ.hbl-2 ) .AND.
1390 $ ( nprow.GT.1 ) )
THEN
1391 IF( irow1.EQ.irow2 )
THEN
1392 CALL sgesd2d( contxt, 1, icol2-icol1+1,
1393 $ a( ( icol1-1 )*lda+irow2 ),
1397 IF( ( mod( k-1, hbl ).EQ.hbl-1 ) .AND.
1398 $ ( nprow.GT.1 ) )
THEN
1399 IF( irow1.EQ.irow2 )
THEN
1400 CALL sgesd2d( contxt, 1, icol2-icol1+1,
1401 $ a( ( icol1-1 )*lda+irow1 ),
1402 $ lda, down, mycol )
1410 DO 220 ki = 1, ibulge
1411 IF( krow( ki ).GT.kp2row( ki ) )
1413 IF( ( myrow.NE.icurrow( ki ) ) .AND.
1414 $ ( down.NE.icurrow( ki ) ) )
GO TO 220
1415 istart =
max( k1( ki ), m )
1416 istop =
min( k2( ki ), i-1 )
1417 IF( ( istart.EQ.istop ) .OR.
1418 $ ( mod( istart-1, hbl ).GE.hbl-2 ) .OR.
1419 $ ( icurrow( ki ).NE.myrow ) )
THEN
1420 DO 210 k = istart, istop
1421 v2 = work( vecsidx+( k-1 )*3+1 )
1422 v3 = work( vecsidx+( k-1 )*3+2 )
1423 t1 = work( vecsidx+( k-1 )*3+3 )
1424 nr =
min( 3, i-k+1 )
1425 IF( ( nr.EQ.3 ) .AND. ( krow( ki ).LE.
1426 $ kp2row( ki ) ) )
THEN
1427 IF( ( k.LT.istop ) .AND.
1428 $ ( mod( k-1, hbl ).LT.hbl-2 ) )
THEN
1429 itmp1 =
min( k2( ki )+1, i-1 ) + 1
1431 IF( mod( k-1, hbl ).LT.hbl-2 )
THEN
1432 itmp1 =
min( k2( ki )+1, i-1 ) + 1
1434 IF( mod( k-1, hbl ).EQ.hbl-2 )
THEN
1435 itmp1 =
min( k+4, i2 ) + 1
1437 IF( mod( k-1, hbl ).EQ.hbl-1 )
THEN
1438 itmp1 =
min( k+3, i2 ) + 1
1442 irow1 = krow( ki ) + k - istart
1443 irow2 = kp2row( ki ) + k - istart
1444 CALL infog1l( itmp1, hbl, npcol, mycol,
1445 $ desca(csrc_),icol1, icol2 )
1446 icol2 =
numroc(i2,hbl,mycol,desca(csrc_),npcol )
1447 IF( ( mod( k-1, hbl ).EQ.hbl-2 ) .AND.
1448 $ ( nprow.GT.1 ) )
THEN
1449 IF( irow1.NE.irow2 )
THEN
1450 CALL sgerv2d( contxt, 1, icol2-icol1+1,
1451 $ work( irbuf+1 ), 1, down,
1455 DO 190 j = icol1, icol2
1456 sum = a( ( j-1 )*lda+irow1 ) +
1457 $ v2*a( ( j-1 )*lda+irow1+1 ) +
1458 $ v3*work( irbuf+j-icol1+1 )
1459 a( ( j-1 )*lda+irow1 ) = a( ( j-1 )*
1460 $ lda+irow1 ) - sum*t1
1461 a( ( j-1 )*lda+irow1+1 ) = a( ( j-1 )*
1462 $ lda+irow1+1 ) - sum*t2
1463 work( irbuf+j-icol1+1 ) = work( irbuf+
1464 $ j-icol1+1 ) - sum*t3
1466 CALL sgesd2d( contxt, 1, icol2-icol1+1,
1467 $ work( irbuf+1 ), 1, down,
1471 IF( ( mod( k-1, hbl ).EQ.hbl-1 ) .AND.
1472 $ ( nprow.GT.1 ) )
THEN
1473 IF( irow1.NE.irow2 )
THEN
1474 CALL sgerv2d( contxt, 1, icol2-icol1+1,
1475 $ work( irbuf+1 ), 1, up,
1479 DO 200 j = icol1, icol2
1480 sum = work( irbuf+j-icol1+1 ) +
1481 $ v2*a( ( j-1 )*lda+irow1 ) +
1482 $ v3*a( ( j-1 )*lda+irow1+1 )
1483 work( irbuf+j-icol1+1 ) = work( irbuf+
1484 $ j-icol1+1 ) - sum*t1
1485 a( ( j-1 )*lda+irow1 ) = a( ( j-1 )*
1486 $ lda+irow1 ) - sum*t2
1487 a( ( j-1 )*lda+irow1+1 ) = a( ( j-1 )*
1488 $ lda+irow1+1 ) - sum*t3
1490 CALL sgesd2d( contxt, 1, icol2-icol1+1,
1491 $ work( irbuf+1 ), 1, up,
1500 DO 240 ki = 1, ibulge
1501 IF( krow( ki ).GT.kp2row( ki ) )
1503 IF( ( myrow.NE.icurrow( ki ) ) .AND.
1504 $ ( down.NE.icurrow( ki ) ) )
GO TO 240
1505 istart =
max( k1( ki ), m )
1506 istop =
min( k2( ki ), i-1 )
1507 IF( ( istart.EQ.istop ) .OR.
1508 $ ( mod( istart-1, hbl ).GE.hbl-2 ) .OR.
1509 $ ( icurrow( ki ).NE.myrow ) )
THEN
1510 DO 230 k = istart, istop
1511 v2 = work( vecsidx+( k-1 )*3+1 )
1512 v3 = work( vecsidx+( k-1 )*3+2 )
1513 t1 = work( vecsidx+( k-1 )*3+3 )
1514 nr =
min( 3, i-k+1 )
1515 IF( ( nr.EQ.3 ) .AND. ( krow( ki ).LE.
1516 $ kp2row( ki ) ) )
THEN
1517 IF( ( k.LT.istop ) .AND.
1518 $ ( mod( k-1, hbl ).LT.hbl-2 ) )
THEN
1519 itmp1 =
min( k2( ki )+1, i-1 ) + 1
1521 IF( mod( k-1, hbl ).LT.hbl-2 )
THEN
1522 itmp1 =
min( k2( ki )+1, i-1 ) + 1
1524 IF( mod( k-1, hbl ).EQ.hbl-2 )
THEN
1525 itmp1 =
min( k+4, i2 ) + 1
1527 IF( mod( k-1, hbl ).EQ.hbl-1 )
THEN
1528 itmp1 =
min( k+3, i2 ) + 1
1532 irow1 = krow( ki ) + k - istart
1533 irow2 = kp2row( ki ) + k - istart
1534 CALL infog1l( itmp1, hbl, npcol, mycol,
1535 $ desca(csrc_), icol1, icol2 )
1536 icol2 =
numroc(i2,hbl,mycol,desca(csrc_),npcol )
1537 IF( ( mod( k-1, hbl ).EQ.hbl-2 ) .AND.
1538 $ ( nprow.GT.1 ) )
THEN
1539 IF( irow1.EQ.irow2 )
THEN
1540 CALL sgerv2d( contxt, 1, icol2-icol1+1,
1541 $ a( ( icol1-1 )*lda+irow2 ),
1545 IF( ( mod( k-1, hbl ).EQ.hbl-1 ) .AND.
1546 $ ( nprow.GT.1 ) )
THEN
1547 IF( irow1.EQ.irow2 )
THEN
1548 CALL sgerv2d( contxt, 1, icol2-icol1+1,
1549 $ a( ( icol1-1 )*lda+irow1 ),
1550 $ lda, down, mycol )
1561 DO 260 ki = 1, ibulge
1562 IF( ( mycol.NE.icurcol( ki ) ) .AND.
1563 $ ( right.NE.icurcol( ki ) ) )
GO TO 260
1564 istart =
max( k1( ki ), m )
1565 istop =
min( k2( ki ), i-1 )
1567 IF( ( ( mod( istart-1, hbl ).LT.hbl-2 ) .OR. ( npcol.EQ.
1568 $ 1 ) ) .AND. ( icurcol( ki ).EQ.mycol ) .AND.
1569 $ ( i-istop+1.GE.3 ) )
THEN
1571 IF( ( k.LT.istop ) .AND. ( mod( k-1,
1572 $ hbl ).LT.hbl-2 ) )
THEN
1573 itmp1 =
min( istart+1, i ) - 1
1575 IF( mod( k-1, hbl ).LT.hbl-2 )
THEN
1576 itmp1 =
min( k+3, i )
1578 IF( mod( k-1, hbl ).EQ.hbl-2 )
THEN
1579 itmp1 =
max( i1, k-1 ) - 1
1581 IF( mod( k-1, hbl ).EQ.hbl-1 )
THEN
1582 itmp1 =
max( i1, k-2 ) - 1
1587 CALL infog1l( i1, hbl, nprow, myrow, desca(rsrc_),
1589 irow2 =
numroc( itmp1, hbl, myrow,desca(rsrc_),nprow )
1590 IF( irow1.LE.irow2 )
THEN
1595 CALL slaref(
'Col', a, lda, wantz, z, ldz, .true.,
1596 $ icol1, icol1, istart, istop, irow1,
1597 $ irow2, liloz, lihiz, work( vecsidx+1 ),
1598 $ v2, v3, t1, t2, t3 )
1600 IF( mod( k-1, hbl ).LT.hbl-2 )
THEN
1604 IF( mod( k-1, hbl ).LT.hbl-3 )
THEN
1606 IF( mod( ( itmp1 / hbl ), nprow ).EQ.myrow )
1608 IF( itmp2.GT.0 )
THEN
1609 irow2 = itmp2 +
min( k+3, i ) - itmp1
1617 CALL infog1l( itmp1+1, hbl, nprow, myrow,
1618 $ desca(rsrc_),irow1, irow2 )
1619 irow2 =
numroc(
min( k+3, i ), hbl, myrow,
1620 $ desca(rsrc_), nprow )
1622 v2 = work( vecsidx+( k-1 )*3+1 )
1623 v3 = work( vecsidx+( k-1 )*3+2 )
1624 t1 = work( vecsidx+( k-1 )*3+3 )
1627 icol1 = kcol( ki ) + istop - istart
1628 CALL slaref(
'Col', a, lda, .false., z, ldz,
1629 $ .false., icol1, icol1, istart, istop,
1630 $ irow1, irow2, liloz, lihiz,
1631 $ work( vecsidx+1 ), v2, v3, t1, t2,
1637 DO 320 ki = 1, ibulge
1638 IF( kcol( ki ).GT.kp2col( ki ) )
1640 IF( ( mycol.NE.icurcol( ki ) ) .AND.
1641 $ ( right.NE.icurcol( ki ) ) )
GO TO 320
1642 istart =
max( k1( ki ), m )
1643 istop =
min( k2( ki ), i-1 )
1644 IF( mod( istart-1, hbl ).GE.hbl-2 )
THEN
1656 DO 310 k = istart, istop
1658 v2 = work( vecsidx+( k-1 )*3+1 )
1659 v3 = work( vecsidx+( k-1 )*3+2 )
1660 t1 = work( vecsidx+( k-1 )*3+3 )
1661 nr =
min( 3, i-k+1 )
1662 IF( ( nr.EQ.3 ) .AND. ( kcol( ki ).LE.kp2col( ki ) ) )
1665 IF( ( k.LT.istop ) .AND.
1666 $ ( mod( k-1, hbl ).LT.hbl-2 ) )
THEN
1667 itmp1 =
min( istart+1, i ) - 1
1669 IF( mod( k-1, hbl ).LT.hbl-2 )
THEN
1670 itmp1 =
min( k+3, i )
1672 IF( mod( k-1, hbl ).EQ.hbl-2 )
THEN
1673 itmp1 =
max( i1, k-1 ) - 1
1675 IF( mod( k-1, hbl ).EQ.hbl-1 )
THEN
1676 itmp1 =
max( i1, k-2 ) - 1
1679 icol1 = kcol( ki ) + k - istart
1680 icol2 = kp2col( ki ) + k - istart
1681 CALL infog1l( i1, hbl, nprow, myrow, desca(rsrc_),
1683 irow2 =
numroc( itmp1, hbl, myrow, desca(rsrc_),
1685 IF( ( mod( k-1, hbl ).EQ.hbl-2 ) .AND.
1686 $ ( npcol.GT.1 ) )
THEN
1687 IF( icol1.EQ.icol2 )
THEN
1688 CALL sgesd2d( contxt, irow2-irow1+1, 1,
1689 $ a( ( icol1-1 )*lda+irow1 ),
1690 $ lda, myrow, left )
1691 CALL sgerv2d( contxt, irow2-irow1+1, 1,
1692 $ a( ( icol1-1 )*lda+irow1 ),
1693 $ lda, myrow, left )
1695 CALL sgerv2d( contxt, irow2-irow1+1, 1,
1696 $ work( icbuf+1 ), irow2-irow1+1,
1700 DO 270 j = irow1, irow2
1701 sum = a( ( icol1-1 )*lda+j ) +
1702 $ v2*a( icol1*lda+j ) +
1703 $ v3*work( icbuf+j-irow1+1 )
1704 a( ( icol1-1 )*lda+j ) = a( ( icol1-1 )*
1706 a( icol1*lda+j ) = a( icol1*lda+j ) -
1708 work( icbuf+j-irow1+1 ) = work( icbuf+j-
1709 $ irow1+1 ) - sum*t3
1711 CALL sgesd2d( contxt, irow2-irow1+1, 1,
1712 $ work( icbuf+1 ), irow2-irow1+1,
1716 IF( ( mod( k-1, hbl ).EQ.hbl-1 ) .AND.
1717 $ ( npcol.GT.1 ) )
THEN
1718 IF( icol1.EQ.icol2 )
THEN
1719 CALL sgesd2d( contxt, irow2-irow1+1, 1,
1720 $ a( ( icol1-1 )*lda+irow1 ),
1721 $ lda, myrow, right )
1722 CALL sgerv2d( contxt, irow2-irow1+1, 1,
1723 $ a( ( icol1-1 )*lda+irow1 ),
1724 $ lda, myrow, right )
1726 CALL sgerv2d( contxt, irow2-irow1+1, 1,
1727 $ work( icbuf+1 ), irow2-irow1+1,
1731 DO 280 j = irow1, irow2
1732 sum = work( icbuf+j-irow1+1 ) +
1733 $ v2*a( ( icol1-1 )*lda+j ) +
1734 $ v3*a( icol1*lda+j )
1735 work( icbuf+j-irow1+1 ) = work( icbuf+j-
1736 $ irow1+1 ) - sum*t1
1737 a( ( icol1-1 )*lda+j ) = a( ( icol1-1 )*
1739 a( icol1*lda+j ) = a( icol1*lda+j ) -
1742 CALL sgesd2d( contxt, irow2-irow1+1, 1,
1743 $ work( icbuf+1 ), irow2-irow1+1,
1749 IF( ( wantz ) .AND. ( mod( k-1,
1750 $ hbl ).GE.hbl-2 ) .AND. ( npcol.GT.1 ) )
THEN
1756 IF( mod( k-1, hbl ).EQ.hbl-2 )
THEN
1757 IF( icol1.EQ.icol2 )
THEN
1758 CALL sgesd2d( contxt, irow2-irow1+1, 1,
1759 $ z( ( icol1-1 )*ldz+irow1 ),
1760 $ ldz, myrow, left )
1761 CALL sgerv2d( contxt, irow2-irow1+1, 1,
1762 $ z( ( icol1-1 )*ldz+irow1 ),
1763 $ ldz, myrow, left )
1765 CALL sgerv2d( contxt, irow2-irow1+1, 1,
1767 $ irow2-irow1+1, myrow,
1771 icol1 = ( icol1-1 )*ldz
1772 DO 290 j = irow1, irow2
1773 sum = z( icol1+j ) +
1774 $ v2*z( icol1+j+ldz ) +
1775 $ v3*work( icbuf+j-irow1+1 )
1776 z( j+icol1 ) = z( j+icol1 ) - sum*t1
1777 z( j+icol1+ldz ) = z( j+icol1+ldz ) -
1779 work( icbuf+j-irow1+1 ) = work( icbuf+
1780 $ j-irow1+1 ) - sum*t3
1782 CALL sgesd2d( contxt, irow2-irow1+1, 1,
1784 $ irow2-irow1+1, myrow,
1788 IF( mod( k-1, hbl ).EQ.hbl-1 )
THEN
1789 IF( icol1.EQ.icol2 )
THEN
1790 CALL sgesd2d( contxt, irow2-irow1+1, 1,
1791 $ z( ( icol1-1 )*ldz+irow1 ),
1792 $ ldz, myrow, right )
1793 CALL sgerv2d( contxt, irow2-irow1+1, 1,
1794 $ z( ( icol1-1 )*ldz+irow1 ),
1795 $ ldz, myrow, right )
1797 CALL sgerv2d( contxt, irow2-irow1+1, 1,
1799 $ irow2-irow1+1, myrow, left )
1802 icol1 = ( icol1-1 )*ldz
1803 DO 300 j = irow1, irow2
1804 sum = work( icbuf+j-irow1+1 ) +
1806 $ v3*z( j+icol1+ldz )
1807 work( icbuf+j-irow1+1 ) = work( icbuf+
1808 $ j-irow1+1 ) - sum*t1
1809 z( j+icol1 ) = z( j+icol1 ) - sum*t2
1810 z( j+icol1+ldz ) = z( j+icol1+ldz ) -
1813 CALL sgesd2d( contxt, irow2-irow1+1, 1,
1815 $ irow2-irow1+1, myrow, left )
1819 IF( icurcol( ki ).EQ.mycol )
THEN
1820 IF( ( ispec.EQ.0 ) .OR. ( npcol.EQ.1 ) )
THEN
1821 localk2( ki ) = localk2( ki ) + 1
1824 IF( ( mod( k-1, hbl ).EQ.hbl-1 ) .AND.
1825 $ ( icurcol( ki ).EQ.right ) )
THEN
1827 localk2( ki ) = localk2( ki ) + 2
1829 localk2( ki ) = localk2( ki ) + 1
1832 IF( ( mod( k-1, hbl ).EQ.hbl-2 ) .AND.
1833 $ ( i-k.EQ.2 ) .AND. ( icurcol( ki ).EQ.
1835 localk2( ki ) = localk2( ki ) + 2
1848 DO 410 ki = 1, ibulge
1849 istart =
max( k1( ki ), m )
1850 istop =
min( k2( ki ), i-1 )
1851 IF( mod( istart-1, hbl ).GE.hbl-2 )
THEN
1863 DO 400 k = istart, istop
1865 v2 = work( vecsidx+( k-1 )*3+1 )
1866 v3 = work( vecsidx+( k-1 )*3+2 )
1867 t1 = work( vecsidx+( k-1 )*3+3 )
1868 nr =
min( 3, i-k+1 )
1870 IF ( icurrow( ki ).EQ.myrow )
THEN
1873 IF ( icurcol( ki ).EQ.mycol )
THEN
1880 CALL infog1l( k, hbl, npcol, mycol, desca(csrc_),
1882 lihih =
numroc( i2, hbl, mycol, desca(csrc_),npcol)
1883 CALL infog1l( 1, hbl, nprow, myrow, desca(rsrc_),
1885 itmp1 =
numroc( k+1,hbl, myrow,desca(rsrc_),nprow )
1886 IF( icurrow( ki ).EQ.myrow )
THEN
1887 IF( ( ispec.EQ.0 ) .OR. ( nprow.EQ.1 ) .OR.
1888 $ ( mod( k-1, hbl ).EQ.hbl-2 ) )
THEN
1890 DO 340 j = ( liloh-1 )*lda,
1891 $ ( lihih-1 )*lda, lda
1892 sum = a( itmp1+j ) + v2*a( itmp1+1+j )
1893 a( itmp1+j ) = a( itmp1+j ) - sum*t1
1894 a( itmp1+1+j ) = a( itmp1+1+j ) - sum*t2
1897 IF( mod( k-1, hbl ).EQ.hbl-1 )
THEN
1898 CALL sgerv2d( contxt, 1, lihih-liloh+1,
1899 $ work( irbuf+1 ), 1, up,
1901 DO 350 j = liloh, lihih
1902 sum = work( irbuf+j-liloh+1 ) +
1903 $ v2*a( ( j-1 )*lda+itmp1 )
1904 work( irbuf+j-liloh+1 ) = work( irbuf+
1905 $ j-liloh+1 ) - sum*t1
1906 a( ( j-1 )*lda+itmp1 ) = a( ( j-1 )*
1907 $ lda+itmp1 ) - sum*t2
1909 CALL sgesd2d( contxt, 1, lihih-liloh+1,
1910 $ work( irbuf+1 ), 1, up,
1915 IF( ( mod( k-1, hbl ).EQ.hbl-1 ) .AND.
1916 $ ( icurrow( ki ).EQ.down ) )
THEN
1917 CALL sgesd2d( contxt, 1, lihih-liloh+1,
1918 $ a( ( liloh-1 )*lda+itmp1 ),
1919 $ lda, down, mycol )
1920 CALL sgerv2d( contxt, 1, lihih-liloh+1,
1921 $ a( ( liloh-1 )*lda+itmp1 ),
1922 $ lda, down, mycol )
1929 CALL infog1l( i1, hbl, nprow, myrow, desca(rsrc_),
1931 lihih =
numroc( i, hbl, myrow, desca(rsrc_),nprow )
1933 IF( icurcol( ki ).EQ.mycol )
THEN
1935 IF( ( ispec.EQ.0 ) .OR. ( npcol.EQ.1 ) .OR.
1936 $ ( mod( k-1, hbl ).EQ.hbl-2 ) )
THEN
1937 CALL infog1l( k, hbl, npcol, mycol,
1938 $ desca(csrc_), itmp1,itmp2 )
1939 itmp2 =
numroc(k+1,hbl,mycol,desca(csrc_),
1941 DO 360 j = liloh, lihih
1942 sum = a( ( itmp1-1 )*lda+j ) +
1943 $ v2*a( itmp1*lda+j )
1944 a( ( itmp1-1 )*lda+j ) = a( ( itmp1-1 )*
1946 a( itmp1*lda+j ) = a( itmp1*lda+j ) -
1950 itmp1 = localk2( ki )
1951 IF( mod( k-1, hbl ).EQ.hbl-1 )
THEN
1952 CALL sgerv2d( contxt, lihih-liloh+1, 1,
1954 $ lihih-liloh+1, myrow, left )
1955 DO 370 j = liloh, lihih
1956 sum = work( icbuf+j ) +
1957 $ v2*a( ( itmp1-1 )*lda+j )
1958 work( icbuf+j ) = work( icbuf+j ) -
1960 a( ( itmp1-1 )*lda+j )
1961 $ = a( ( itmp1-1 )*lda+j ) - sum*t2
1963 CALL sgesd2d( contxt, lihih-liloh+1, 1,
1965 $ lihih-liloh+1, myrow, left )
1969 IF( ( mod( k-1, hbl ).EQ.hbl-1 ) .AND.
1970 $ ( icurcol( ki ).EQ.right ) )
THEN
1972 CALL sgesd2d( contxt, lihih-liloh+1, 1,
1973 $ a( ( itmp1-1 )*lda+liloh ),
1974 $ lda, myrow, right )
1975 CALL infog1l( k, hbl, npcol, mycol,
1976 $ desca(csrc_), itmp1, itmp2 )
1977 itmp2 =
numroc( k+1, hbl, mycol,
1978 $ desca(csrc_), npcol )
1979 CALL sgerv2d( contxt, lihih-liloh+1, 1,
1980 $ a( ( itmp1-1 )*lda+liloh ),
1981 $ lda, myrow, right )
1989 IF( icurcol( ki ).EQ.mycol )
THEN
1991 IF( ( ispec.EQ.0 ) .OR. ( npcol.EQ.1 ) .OR.
1992 $ ( mod( k-1, hbl ).EQ.hbl-2 ) )
THEN
1993 itmp1 = kcol( ki ) + k - istart
1994 itmp1 = ( itmp1-1 )*ldz
1995 DO 380 j = liloz, lihiz
1996 sum = z( j+itmp1 ) +
1997 $ v2*z( j+itmp1+ldz )
1998 z( j+itmp1 ) = z( j+itmp1 ) - sum*t1
1999 z( j+itmp1+ldz ) = z( j+itmp1+ldz ) -
2002 localk2( ki ) = localk2( ki ) + 1
2004 itmp1 = localk2( ki )
2006 IF( mod( k-1, hbl ).EQ.hbl-1 )
THEN
2007 CALL sgerv2d( contxt, lihiz-liloz+1, 1,
2008 $ work( icbuf+1 ), ldz,
2010 itmp1 = ( itmp1-1 )*ldz
2011 DO 390 j = liloz, lihiz
2012 sum = work( icbuf+j ) +
2014 work( icbuf+j ) = work( icbuf+j ) -
2016 z( j+itmp1 ) = z( j+itmp1 ) - sum*t2
2018 CALL sgesd2d( contxt, lihiz-liloz+1, 1,
2019 $ work( icbuf+1 ), ldz,
2021 localk2( ki ) = localk2( ki ) + 1
2028 IF( ( mod( k-1, hbl ).EQ.hbl-1 ) .AND.
2029 $ ( icurcol( ki ).EQ.right ) )
THEN
2031 itmp1 = ( itmp1-1 )*ldz
2032 CALL sgesd2d( contxt, lihiz-liloz+1, 1,
2033 $ z( liloz+itmp1 ), ldz,
2035 CALL sgerv2d( contxt, lihiz-liloz+1, 1,
2036 $ z( liloz+itmp1 ), ldz,
2038 localk2( ki ) = localk2( ki ) + 1
2047 IF( nprow.EQ.1 )
THEN
2048 krow( ki ) = krow( ki ) + k2( ki ) - k1( ki ) + 1
2049 kp2row( ki ) = kp2row( ki ) + k2( ki ) - k1( ki ) + 1
2051 IF( ( mod( k1( ki )-1, hbl ).LT.hbl-2 ) .AND.
2052 $ ( icurrow( ki ).EQ.myrow ) .AND. ( nprow.GT.1 ) )
2054 krow( ki ) = krow( ki ) + k2( ki ) - k1( ki ) + 1
2056 IF( ( mod( k2( ki ), hbl ).LT.hbl-2 ) .AND.
2057 $ ( icurrow( ki ).EQ.myrow ) .AND. ( nprow.GT.1 ) )
2059 kp2row( ki ) = kp2row( ki ) + k2( ki ) - k1( ki ) + 1
2061 IF( ( mod( k1( ki )-1, hbl ).GE.hbl-2 ) .AND.
2062 $ ( ( myrow.EQ.icurrow( ki ) ) .OR. ( down.EQ.
2063 $ icurrow( ki ) ) ) .AND. ( nprow.GT.1 ) )
THEN
2064 CALL infog1l( k2( ki )+1, hbl, nprow, myrow,
2065 $ desca(rsrc_), krow( ki ), itmp2 )
2066 itmp2 =
numroc( n, hbl, myrow, desca(rsrc_), nprow )
2068 IF( ( mod( k2( ki ), hbl ).GE.hbl-2 ) .AND.
2069 $ ( ( myrow.EQ.icurrow( ki ) ) .OR. ( up.EQ.
2070 $ icurrow( ki ) ) ) .AND. ( nprow.GT.1 ) )
THEN
2071 CALL infog1l( 1, hbl, nprow, myrow, desca(rsrc_),
2072 $ itmp2,kp2row( ki ) )
2073 kp2row( ki ) =
numroc( k2( ki )+3, hbl, myrow,
2074 $ desca(rsrc_), nprow )
2076 IF( npcol.EQ.1 )
THEN
2077 kcol( ki ) = kcol( ki ) + k2( ki ) - k1( ki ) + 1
2078 kp2col( ki ) = kp2col( ki ) + k2( ki ) - k1( ki ) + 1
2080 IF( ( mod( k1( ki )-1, hbl ).LT.hbl-2 ) .AND.
2081 $ ( icurcol( ki ).EQ.mycol ) .AND. ( npcol.GT.1 ) )
2083 kcol( ki ) = kcol( ki ) + k2( ki ) - k1( ki ) + 1
2085 IF( ( mod( k2( ki ), hbl ).LT.hbl-2 ) .AND.
2086 $ ( icurcol( ki ).EQ.mycol ) .AND. ( npcol.GT.1 ) )
2088 kp2col( ki ) = kp2col( ki ) + k2( ki ) - k1( ki ) + 1
2090 IF( ( mod( k1( ki )-1, hbl ).GE.hbl-2 ) .AND.
2091 $ ( ( mycol.EQ.icurcol( ki ) ) .OR. ( right.EQ.
2092 $ icurcol( ki ) ) ) .AND. ( npcol.GT.1 ) )
THEN
2093 CALL infog1l( k2( ki )+1, hbl, npcol, mycol,
2094 $ desca(csrc_), kcol( ki ), itmp2 )
2095 itmp2 =
numroc( n, hbl, mycol, desca(csrc_), npcol )
2097 IF( ( mod( k2( ki ), hbl ).GE.hbl-2 ) .AND.
2098 $ ( ( mycol.EQ.icurcol( ki ) ) .OR. ( left.EQ.
2099 $ icurcol( ki ) ) ) .AND. ( npcol.GT.1 ) )
THEN
2100 CALL infog1l( 1, hbl, npcol, mycol,desca(csrc_),itmp2,
2102 kp2col( ki ) =
numroc( k2( ki )+3, hbl, mycol,
2103 $ desca(csrc_), npcol )
2105 k1( ki ) = k2( ki ) + 1
2106 istop =
min( k1( ki )+rotn-mod( k1( ki ), rotn ), i-2 )
2107 istop =
min( istop, k1( ki )+hbl-3-
2108 $ mod( k1( ki )-1, hbl ) )
2109 istop =
min( istop, i2-2 )
2110 istop =
max( istop, k1( ki ) )
2113 IF( k1( ki ).EQ.istop )
THEN
2114 IF( ( mod( istop-1, hbl ).EQ.hbl-2 ) .AND.
2115 $ ( i-istop.GT.1 ) )
THEN
2119 icurrow( ki ) = mod( icurrow( ki )+1, nprow )
2120 icurcol( ki ) = mod( icurcol( ki )+1, npcol )
2124 IF( k2( ibulge ).LE.i-1 )
2133 work( 1 ) = float( lwkopt )
2142 CALL infog2l( i, i, desca, nprow, npcol, myrow, mycol, irow,
2143 $ icol, itmp1, itmp2 )
2144 IF( ( myrow.EQ.itmp1 ) .AND. ( mycol.EQ.itmp2 ) )
THEN
2145 wr( i ) = a( ( icol-1 )*lda+irow )
2150 ELSE IF( l.EQ.i-1 )
THEN
2154 CALL pselget(
'All',
' ', h11, a, l, l, desca )
2155 CALL pselget(
'All',
' ', h21, a, i, l, desca )
2156 CALL pselget(
'All',
' ', h12, a, l, i, desca )
2157 CALL pselget(
'All',
' ', h22, a, i, i, desca )
2158 CALL slanv2( h11, h12, h21, h22, wr( l ), wi( l ), wr( i ),
2160 CALL pselset( a, l, l, desca, h11 )
2161 CALL pselset( a, i, l, desca, h21 )
2162 CALL pselset( a, l, i, desca, h12 )
2163 CALL pselset( a, i, i, desca, h22 )
2168 IF(i .LT. n)
CALL psrot( n-i, a, l, i+1, desca, desca( m_ ),
2169 $ a, i, i+1, desca, desca( m_ ), cs,
2170 $ sn, work( vecsidx+1 ),
2171 $ lwork-vecsidx, ierr )
2176 IF (l .GT. ltop)
CALL psrot( l-ltop, a, ltop, l, desca, 1, a,
2177 $ ltop, i, desca, 1, cs, sn,
2178 $ work( vecsidx+1 ), lwork-vecsidx,
2181 CALL psrot( ihiz-iloz+1, z, iloz, l, descz, 1, z, iloz, i,
2182 $ descz, 1, cs, sn, work( vecsidx+1 ),
2183 $ lwork-vecsidx, ierr )
2185 IF( node .NE. 0 )
THEN
2196 IF( nh .LE. lds )
THEN
2197 CALL pslaqr4( wantt, wantz, n, l, i, a, desca, wr, wi,
2198 $ iloz, ihiz, z, descz, work( s1+1 ), nh,
2199 $ work( s2+1 ), nh, work( s3+1 ), 4*lds*lds,
2201 IF( info.NE.0 )
THEN
2202 work( 1 ) = float( lwkopt )
2205 IF( node.NE.0 )
THEN
2221 IF( m.EQ.l-10 )
THEN
2232 CALL sgsum2d( contxt,
'All',
' ', ihi-ilo+1, 1, wr(ilo), n,
2234 CALL sgsum2d( contxt,
'All',
' ', ihi-ilo+1, 1, wi(ilo), n,
2238 work( 1 ) = float( lwkopt )