1 RECURSIVE SUBROUTINE pslaqr3( WANTT, WANTZ, N, KTOP, KBOT, NW, H,
2 $ DESCH, ILOZ, IHIZ, Z, DESCZ, NS, ND,
3 $ SR, SI, V, DESCV, NH, T, DESCT, NV,
4 $ WV, DESCW, WORK, LWORK, IWORK,
18 INTEGER ihiz, iloz, kbot, ktop, lwork, n, nd, nh, ns,
19 $ nv, nw, liwork, reclevel
23 INTEGER desch( * ), descz( * ), desct( * ), descv( * ),
24 $ descw( * ), iwork( * )
25 REAL h( * ), si( kbot ), sr( kbot ), t( * ),
26 $ v( * ), work( * ), wv( * ),
231 INTEGER block_cyclic_2d, csrc_, ctxt_, dlen_, dtype_,
232 $ lld_, mb_, m_, nb_, n_, rsrc_
235 parameter( block_cyclic_2d = 1, dlen_ = 9, dtype_ = 1,
236 $ ctxt_ = 2, m_ = 3, n_ = 4, mb_ = 5, nb_ = 6,
237 $ rsrc_ = 7, csrc_ = 8, lld_ = 9, recmax = 3,
238 $ sortgrad = .false. )
240 PARAMETER ( zero = 0.0, one = 1.0 )
243 REAL aa, bb, beta, cc, cs, dd, evi, evk, foo, s,
244 $ safmax, safmin, smlnum, sn, tau, ulp,
245 $ elem, elem1, elem2, elem3, r1, anorm, rnorm,
247 INTEGER i, ifst, ilst, info, infqr, j, jw, k, kcol,
248 $ kend, kln, krow, kwtop, ltop, lwk1, lwk2, lwk3,
249 $ lwkopt, nmin, lldh, lldz, lldt, lldv, lldwv,
250 $ ictxt, nprow, nmax, npcol, myrow, mycol, nb,
251 $ iroffh, m, rcols, taurows, rrows, taucols,
252 $ itau, ir, ipw, nprocs, mloc, iroffhh,
253 $ icoffhh, hhrsrc, hhcsrc, hhrows, hhcols,
254 $ iroffzz, icoffzz, zzrsrc, zzcsrc, zzrows,
255 $ zzcols, ierr, tzrows0, tzcols0, ierr0, ipt0,
256 $ ipz0, ipw0, nb2, round, lilst, kk, lilst0,
257 $ iwrk1, rsrc, csrc, lwk4, lwk5, iwrk2, lwk6,
258 $ lwk7, lwk8, ilwkopt, tzrows, tzcols, nsel,
259 $ npmin, ictxt_new, myrow_new, mycol_new
260 LOGICAL bulge, sorted, lquery
263 INTEGER par( 6 ), descr( dlen_ ),
264 $ desctau( dlen_ ), deschh( dlen_ ),
265 $ desczz( dlen_ ), desctz0( dlen_ ),
279 $
pslamve, blacs_gridinfo, blacs_gridmap,
280 $ blacs_gridexit, psgemr2d
283 INTRINSIC abs, float, int,
max,
min, sqrt
286 ictxt = desch( ctxt_ )
287 CALL blacs_gridinfo( ictxt, nprow, npcol, myrow, mycol )
297 lldwv = descw( lld_ )
299 iroffh = mod( ktop - 1, nb )
300 jw =
min( nw, kbot-ktop+1 )
305 par(1) =
pilaenvx(ictxt, 17,
'PSLAQR3',
'SV', jw, nb, -1, -1)
306 par(2) =
pilaenvx(ictxt, 18,
'PSLAQR3',
'SV', jw, nb, -1, -1)
307 par(3) =
pilaenvx(ictxt, 19,
'PSLAQR3',
'SV', jw, nb, -1, -1)
308 par(4) =
pilaenvx(ictxt, 20,
'PSLAQR3',
'SV', jw, nb, -1, -1)
309 par(5) =
pilaenvx(ictxt, 21,
'PSLAQR3',
'SV', jw, nb, -1, -1)
310 par(6) =
pilaenvx(ictxt, 22,
'PSLAQR3',
'SV', jw, nb, -1, -1)
314 lquery = lwork.EQ.-1 .OR. liwork.EQ.-1
324 taurows =
numroc( 1, 1, mycol, descv(rsrc_), nprow )
325 taucols =
numroc( jw+iroffh, nb, mycol, descv(csrc_),
327 CALL psgehrd( jw, 1, jw, t, 1, 1, desct, work, work, -1,
329 lwk1 = int( work( 1 ) ) + taurows*taucols
333 CALL psormhr(
'Right',
'No', jw, jw, 1, jw, t, 1, 1, desct,
334 $ work, v, 1, 1, descv, work, -1, info )
335 lwk2 = int( work( 1 ) )
339 nmin =
pilaenvx( ictxt, 12,
'PSLAQR3',
'SV', jw, 1, jw, lwork )
341 IF( jw+iroffh.GT.nmin .AND. jw+iroffh.LE.nmax
342 $ .AND. reclevel.LT.recmax )
THEN
343 CALL pslaqr0( .true., .true., jw+iroffh, 1+iroffh,
344 $ jw+iroffh, t, desct, sr, si, 1, jw, v, descv,
345 $ work, -1, iwork, liwork-nsel, infqr,
347 lwk3 = int( work( 1 ) )
350 rsrc = desct( rsrc_ )
351 csrc = desct( csrc_ )
354 CALL pslaqr1( .true., .true., jw+iroffh, 1, jw+iroffh, t,
355 $ desct, sr, si, 1, jw+iroffh, v, descv, work, -1,
356 $ iwork, liwork-nsel, infqr )
357 desct( rsrc_ ) = rsrc
358 desct( csrc_ ) = csrc
359 lwk3 = int( work( 1 ) )
365 tzrows0 =
numroc( jw+iroffh, nb, myrow, 0, nprow )
366 tzcols0 =
numroc( jw+iroffh, nb, mycol, 0, npcol )
367 lwk4 = 2 * tzrows0*tzcols0
371 CALL pstrord(
'Vectors', iwork, par, jw+iroffh, t, 1, 1,
372 $ desct, v, 1, 1, descv, ddum, ddum, mloc, work, -1,
373 $ iwork, liwork-nsel, info )
374 lwk5 = int( work( 1 ) )
380 rrows =
numroc( n+iroffh, nb, myrow, descv(rsrc_), nprow )
381 rcols =
numroc( 1, 1, mycol, descv(csrc_), npcol )
382 lwk6 = rrows*rcols + taurows*taucols +
398 tzrows =
numroc( jw+iroffh, nb, myrow, desct(rsrc_), nprow )
399 tzcols =
numroc( jw+iroffh, nb, mycol, desct(csrc_), npcol )
400 lwk8 = 2*tzrows*tzcols
404 lwkopt =
max( lwk1, lwk2, lwk3+lwk4, lwk5, lwk6, lwk7, lwk8 )
405 ilwkopt =
max( iwrk1, iwrk2 )
410 work( 1 ) = float( lwkopt )
414 iwork( 1 ) = ilwkopt + nsel
430 safmin =
slamch(
'SAFE MINIMUM' )
431 safmax = one / safmin
432 CALL slabad( safmin, safmax )
433 ulp =
slamch(
'PRECISION' )
434 smlnum = safmin*( float( n ) / ulp )
438 jw =
min( nw, kbot-ktop+1 )
439 kwtop = kbot - jw + 1
440 IF( kwtop.EQ.ktop )
THEN
443 CALL pselget(
'All',
'1-Tree', s, h, kwtop, kwtop-1, desch )
446 IF( kbot.EQ.kwtop )
THEN
450 CALL pselget(
'All',
'1-Tree', sr( kwtop ), h, kwtop, kwtop,
455 IF( abs( s ).LE.
max( smlnum, ulp*abs( sr( kwtop ) ) ) )
460 $
CALL pselset( h, kwtop, kwtop-1 , desch, zero )
465 IF( kwtop.EQ.ktop .AND. kbot-kwtop.EQ.1 )
THEN
469 CALL pselget(
'All',
'1-Tree', aa, h, kwtop, kwtop, desch )
470 CALL pselget(
'All',
'1-Tree', bb, h, kwtop, kwtop+1, desch )
471 CALL pselget(
'All',
'1-Tree', cc, h, kwtop+1, kwtop, desch )
472 CALL pselget(
'All',
'1-Tree', dd, h, kwtop+1, kwtop+1, desch )
473 CALL slanv2( aa, bb, cc, dd, sr(kwtop), si(kwtop),
474 $ sr(kwtop+1), si(kwtop+1), cs, sn )
477 IF( cc.EQ.zero )
THEN
479 IF( i+2.LE.n .AND. wantt )
480 $
CALL psrot( n-i-1, h, i, i+2, desch, desch(m_), h, i+1,
481 $ i+2, desch, desch(m_), cs, sn, work, lwork, info )
483 $
CALL psrot( i-1, h, 1, i, desch, 1, h, 1, i+1, desch, 1,
484 $ cs, sn, work, lwork, info )
486 $
CALL psrot( ihiz-iloz+1, z, iloz, i, descz, 1, z, iloz,
487 $ i+1, descz, 1, cs, sn, work, lwork, info )
488 CALL pselset( h, i, i, desch, aa )
489 CALL pselset( h, i, i+1, desch, bb )
490 CALL pselset( h, i+1, i, desch, cc )
491 CALL pselset( h, i+1, i+1, desch, dd )
493 work( 1 ) = float( lwkopt )
500 iroffh = mod( kwtop - 1, nb )
505 desct( m_ ) = jw+iroffh
506 desct( n_ ) = jw+iroffh
515 CALL pslaset(
'All', iroffh, jw+iroffh, zero, one, t, 1, 1,
517 CALL pslaset(
'All', jw, iroffh, zero, zero, t, 1+iroffh, 1,
519 CALL pslacpy(
'All', 1, jw, h, kwtop, kwtop, desch, t, 1+iroffh,
521 CALL pslacpy(
'Upper', jw-1, jw-1, h, kwtop+1, kwtop, desch, t,
522 $ 1+iroffh+1, 1+iroffh, desct )
524 $
CALL pslaset(
'Lower', jw-2, jw-2, zero, zero, t, 1+iroffh+2,
526 CALL pslacpy(
'All', jw-1, 1, h, kwtop+1, kwtop+jw-1, desch, t,
527 $ 1+iroffh+1, 1+iroffh+jw-1, desct )
531 CALL pslaset(
'All', jw+iroffh, jw+iroffh, zero, one, v, 1, 1,
536 npmin =
pilaenvx( ictxt, 23,
'PSLAQR3',
'SV', jw, nb, nprow,
538 nmin =
pilaenvx( ictxt, 12,
'PSLAQR3',
'SV', jw, 1, jw, lwork )
540 IF(
min(nprow, npcol).LE.npmin+1 .OR. reclevel.GE.1 )
THEN
545 IF( jw+iroffh.GT.nmin .AND. jw+iroffh.LE.nmax
546 $ .AND. reclevel.LT.recmax )
THEN
547 CALL pslaqr0( .true., .true., jw+iroffh, 1+iroffh,
548 $ jw+iroffh, t, desct, sr( kwtop-iroffh ),
549 $ si( kwtop-iroffh ), 1+iroffh, jw+iroffh, v, descv,
550 $ work, lwork, iwork(nsel+1), liwork-nsel, infqr,
553 IF( desct(rsrc_).EQ.0 .AND. desct(csrc_).EQ.0 )
THEN
554 IF( jw+iroffh.GT.desct( mb_ ) )
THEN
555 CALL pslaqr1( .true., .true., jw+iroffh, 1,
556 $ jw+iroffh, t, desct, sr( kwtop-iroffh ),
557 $ si( kwtop-iroffh ), 1, jw+iroffh, v,
558 $ descv, work, lwork, iwork(nsel+1), liwork-nsel,
561 IF( myrow.EQ.0 .AND. mycol.EQ.0 )
THEN
562 CALL slahqr( .true., .true., jw+iroffh, 1+iroffh,
563 $ jw+iroffh, t, desct(lld_),
564 $ sr( kwtop-iroffh ), si( kwtop-iroffh ),
565 $ 1+iroffh, jw+iroffh, v, descv(lld_), infqr )
570 $
CALL igamn2d( ictxt,
'All',
'1-Tree', 1, 1, infqr,
571 $ 1, -1, -1, -1, -1, -1 )
573 ELSEIF( jw+iroffh.LE.desct( mb_ ) )
THEN
574 IF( myrow.EQ.desct(rsrc_) .AND. mycol.EQ.desct(csrc_) )
576 CALL slahqr( .true., .true., jw+iroffh, 1+iroffh,
577 $ jw+iroffh, t, desct(lld_),
578 $ sr( kwtop-iroffh ), si( kwtop-iroffh ),
579 $ 1+iroffh, jw+iroffh, v, descv(lld_), infqr )
584 $
CALL igamn2d( ictxt,
'All',
'1-Tree', 1, 1, infqr,
585 $ 1, -1, -1, -1, -1, -1 )
587 tzrows0 =
numroc( jw+iroffh, nb, myrow, 0, nprow )
588 tzcols0 =
numroc( jw+iroffh, nb, mycol, 0, npcol )
589 CALL descinit( desctz0, jw+iroffh, jw+iroffh, nb, nb, 0,
590 $ 0, ictxt,
max(1,tzrows0), ierr0 )
592 ipz0 = ipt0 +
max(1,tzrows0)*tzcols0
593 ipw0 = ipz0 +
max(1,tzrows0)*tzcols0
594 CALL pslamve(
'All', jw+iroffh, jw+iroffh, t, 1, 1,
595 $ desct, work(ipt0), 1, 1, desctz0, work(ipw0) )
596 CALL pslaset(
'All', jw+iroffh, jw+iroffh, zero, one,
597 $ work(ipz0), 1, 1, desctz0 )
598 CALL pslaqr1( .true., .true., jw+iroffh, 1,
599 $ jw+iroffh, work(ipt0), desctz0,
600 $ sr( kwtop-iroffh ), si( kwtop-iroffh ),
601 $ 1, jw+iroffh, work(ipz0),
602 $ desctz0, work(ipw0), lwork-ipw0+1, iwork(nsel+1),
603 $ liwork-nsel, infqr )
604 CALL pslamve(
'All', jw+iroffh, jw+iroffh, work(ipt0), 1,
605 $ 1, desctz0, t, 1, 1, desct, work(ipw0) )
606 CALL pslamve(
'All', jw+iroffh, jw+iroffh, work(ipz0), 1,
607 $ 1, desctz0, v, 1, 1, descv, work(ipw0) )
619 pmap( j+1+i*npmin ) = blacs_pnum( ictxt, i, j )
622 CALL blacs_gridmap( ictxt_new, pmap, npmin, npmin, npmin )
623 CALL blacs_gridinfo( ictxt_new, npmin, npmin, myrow_new,
625 IF( myrow.GE.npmin .OR. mycol.GE.npmin ) ictxt_new = -1
626 IF( ictxt_new.GE.0 )
THEN
627 tzrows0 =
numroc( jw, nb, myrow_new, 0, npmin )
628 tzcols0 =
numroc( jw, nb, mycol_new, 0, npmin )
629 CALL descinit( desctz0, jw, jw, nb, nb, 0,
630 $ 0, ictxt_new,
max(1,tzrows0), ierr0 )
632 ipz0 = ipt0 +
max(1,tzrows0)*
max(1,tzcols0)
633 ipw0 = ipz0 +
max(1,tzrows0)*
max(1,tzcols0)
638 desctz0( ctxt_ ) = -1
641 CALL psgemr2d( jw, jw, t, 1+iroffh, 1+iroffh, desct,
642 $ work(ipt0), 1, 1, desctz0, ictxt )
643 IF( ictxt_new.GE.0 )
THEN
644 CALL pslaset(
'All', jw, jw, zero, one, work(ipz0), 1, 1,
646 nmin =
pilaenvx( ictxt_new, 12,
'PSLAQR3',
'SV', jw, 1, jw,
648 IF( jw.GT.nmin .AND. jw.LE.nmax .AND. reclevel.LT.1 )
THEN
649 CALL pslaqr0( .true., .true., jw, 1, jw, work(ipt0),
650 $ desctz0, sr( kwtop ), si( kwtop ), 1, jw,
651 $ work(ipz0), desctz0, work(ipw0), lwork-ipw0+1,
652 $ iwork(nsel+1), liwork-nsel, infqr,
655 CALL pslaqr1( .true., .true., jw, 1, jw, work(ipt0),
656 $ desctz0, sr( kwtop ), si( kwtop ), 1, jw,
657 $ work(ipz0), desctz0, work(ipw0), lwork-ipw0+1,
658 $ iwork(nsel+1), liwork-nsel, infqr )
661 CALL psgemr2d( jw, jw, work(ipt0), 1, 1, desctz0, t, 1+iroffh,
662 $ 1+iroffh, desct, ictxt )
663 CALL psgemr2d( jw, jw, work(ipz0), 1, 1, desctz0, v, 1+iroffh,
664 $ 1+iroffh, descv, ictxt )
666 $
CALL blacs_gridexit( ictxt_new )
667 IF( myrow+mycol.GT.0 )
THEN
673 CALL igamn2d( ictxt,
'All',
'1-Tree', 1, 1, infqr, 1, -1, -1,
675 CALL sgsum2d( ictxt,
'All',
' ', jw, 1, sr(kwtop), jw, -1, -1 )
676 CALL sgsum2d( ictxt,
'All',
' ', jw, 1, si(kwtop), jw, -1, -1 )
682 $ infqr = infqr - iroffh
687 CALL pselset( t, j+2, j, desct, zero )
688 CALL pselset( t, j+3, j, desct, zero )
691 $
CALL pselset( t, jw, jw-2, desct, zero )
711 DO 70 j = 1, iroffh + infqr
716 ilst = infqr + 1 + iroffh
718 CALL pselget(
'All',
'1-Tree', elem, t, ilst, ilst-1, desct )
720 IF( bulge ) ilst = ilst+1
724 IF( ilst.LE.ns+iroffh )
THEN
728 lilst =
max(ilst,ns+iroffh-nb+1)
729 IF( lilst.GT.1 )
THEN
730 CALL pselget(
'All',
'1-Tree', elem, t, lilst, lilst-1,
733 IF( bulge ) lilst = lilst+1
738 DO 90 j = iroffh+1, lilst-1
748 IF( lilst.LE.ns+iroffh )
THEN
752 CALL pselget(
'All',
'1-Tree', elem, t, ns+iroffh,
753 $ ns+iroffh-1, desct )
759 IF( .NOT.bulge )
THEN
763 CALL pselget(
'All',
'1-Tree', elem, t, ns+iroffh,
768 CALL pselget(
'All',
'1-Tree', elem, v, 1+iroffh,
770 IF( abs( s*elem ).LE.
max( smlnum, ulp*foo ) )
THEN
780 DO 110 j = lilst, jw+iroffh
783 iwork( ifst+iroffh ) = 1
784 CALL pstrord(
'Vectors', iwork, par, jw+iroffh, t, 1,
785 $ 1, desct, v, 1, 1, descv, work,
786 $ work(jw+iroffh+1), mloc,
787 $ work(2*(jw+iroffh)+1), lwork-2*(jw+iroffh),
788 $ iwork(nsel+1), liwork-nsel, info )
793 iwork( ifst+iroffh ) = 0
802 lilst =
max(info, lilst)
803 ilst =
max(info, ilst)
810 CALL pselget(
'All',
'1-Tree', elem1, t, ns+iroffh,
812 CALL pselget(
'All',
'1-Tree', elem2, t, ns+iroffh,
813 $ ns+iroffh-1, desct )
814 CALL pselget(
'All',
'1-Tree', elem3, t, ns+iroffh-1,
816 foo = abs( elem1 ) + sqrt( abs( elem2 ) )*
817 $ sqrt( abs( elem3 ) )
820 CALL pselget(
'All',
'1-Tree', elem1, v, 1+iroffh,
822 CALL pselget(
'All',
'1-Tree', elem2, v, 1+iroffh,
823 $ ns+iroffh-1, descv )
824 IF(
max( abs( s*elem1 ), abs( s*elem2 ) ).LE.
825 $
max( smlnum, ulp*foo ) )
THEN
835 DO 120 j = lilst, jw+iroffh
838 iwork( ifst+iroffh ) = 1
839 iwork( ifst+iroffh-1 ) = 1
840 CALL pstrord(
'Vectors', iwork, par, jw+iroffh, t, 1,
841 $ 1, desct, v, 1, 1, descv, work,
842 $ work(jw+iroffh+1), mloc,
843 $ work(2*(jw+iroffh)+1), lwork-2*(jw+iroffh),
844 $ iwork(nsel+1), liwork-nsel, info )
849 iwork( ifst+iroffh ) = 0
850 iwork( ifst+iroffh-1 ) = 0
860 lilst =
max(info, lilst)
861 ilst =
max(info, ilst)
874 DO 130 j = ilst, lilst0-1
877 CALL pstrord(
'Vectors', iwork, par, jw+iroffh, t, 1, 1,
878 $ desct, v, 1, 1, descv, work, work(jw+iroffh+1),
879 $ m, work(2*(jw+iroffh)+1), lwork-2*(jw+iroffh),
880 $ iwork(nsel+1), liwork-nsel, info )
887 $ ilst =
max(info, ilst)
897 CALL scopy( jw, work(1+iroffh), 1, sr( kwtop ), 1 )
898 CALL scopy( jw, work(jw+2*iroffh+1), 1, si( kwtop ), 1 )
909 IF( ns.LT.jw .AND. sortgrad )
THEN
925 i = infqr + 1 + iroffh
926 IF( i.EQ.ns+iroffh )
THEN
928 ELSE IF( si( kwtop-iroffh + i-1 ).EQ.zero )
THEN
936 evi = abs( sr( kwtop-iroffh+i-1 ) )
938 evi = abs( sr( kwtop-iroffh+i-1 ) ) +
939 $ abs( si( kwtop-iroffh+i-1 ) )
943 evk = abs( sr( kwtop-iroffh+k-1 ) )
944 ELSEIF( si( kwtop-iroffh+k-1 ).EQ.zero )
THEN
945 evk = abs( sr( kwtop-iroffh+k-1 ) )
947 evk = abs( sr( kwtop-iroffh+k-1 ) ) +
948 $ abs( si( kwtop-iroffh+k-1 ) )
951 IF( evi.GE.evk )
THEN
968 IF( k.NE.kend .AND. si( kwtop-iroffh+k-1 ).NE.zero )
THEN
974 IF( k.LT.kend ) iwork(k+1) = 0
977 DO 170 j = k+2, jw+iroffh
980 CALL pstrord(
'Vectors', iwork, par, jw+iroffh, t, 1, 1,
981 $ desct, v, 1, 1, descv, work, work(jw+iroffh+1), m,
982 $ work(2*(jw+iroffh)+1), lwork-2*(jw+iroffh),
983 $ iwork(nsel+1), liwork-nsel, ierr )
984 CALL scopy( jw, work(1+iroffh), 1, sr( kwtop ), 1 )
985 CALL scopy( jw, work(jw+2*iroffh+1), 1, si( kwtop ), 1 )
994 ELSE IF( si( kwtop-iroffh+i-1 ).EQ.zero )
THEN
1007 desct( m_ ) = nw+iroffh
1008 desct( n_ ) = nh+iroffh
1010 IF( ns.LT.jw .OR. s.EQ.zero )
THEN
1011 IF( ns.GT.1 .AND. s.NE.zero )
THEN
1015 rrows =
numroc( ns+iroffh, nb, myrow, descv(rsrc_), nprow )
1016 rcols =
numroc( 1, 1, mycol, descv(csrc_), npcol )
1017 CALL descinit( descr, ns+iroffh, 1, nb, 1, descv(rsrc_),
1018 $ descv(csrc_), ictxt,
max(1, rrows), info )
1019 taurows =
numroc( 1, 1, mycol, descv(rsrc_), nprow )
1020 taucols =
numroc( jw+iroffh, nb, mycol, descv(csrc_),
1022 CALL descinit( desctau, 1, jw+iroffh, 1, nb, descv(rsrc_),
1023 $ descv(csrc_), ictxt,
max(1, taurows), info )
1026 itau = ir + descr( lld_ ) * rcols
1027 ipw = itau + desctau( lld_ ) * taucols
1029 CALL pslaset(
'All', ns+iroffh, 1, zero, zero, work(itau),
1032 CALL pscopy( ns, v, 1+iroffh, 1+iroffh, descv, descv(m_),
1033 $ work(ir), 1+iroffh, 1, descr, 1 )
1034 CALL pslarfg( ns, beta, 1+iroffh, 1, work(ir), 2+iroffh, 1,
1035 $ descr, 1, work(itau+iroffh) )
1036 CALL pselset( work(ir), 1+iroffh, 1, descr, one )
1038 CALL pslaset(
'Lower', jw-2, jw-2, zero, zero, t, 3+iroffh,
1041 CALL pslarf(
'Left', ns, jw, work(ir), 1+iroffh, 1, descr,
1042 $ 1, work(itau+iroffh), t, 1+iroffh, 1+iroffh,
1043 $ desct, work( ipw ) )
1044 CALL pslarf(
'Right', ns, ns, work(ir), 1+iroffh, 1, descr,
1045 $ 1, work(itau+iroffh), t, 1+iroffh, 1+iroffh,
1046 $ desct, work( ipw ) )
1047 CALL pslarf(
'Right', jw, ns, work(ir), 1+iroffh, 1, descr,
1048 $ 1, work(itau+iroffh), v, 1+iroffh, 1+iroffh,
1049 $ descv, work( ipw ) )
1052 ipw = itau + desctau( lld_ ) * taucols
1053 CALL psgehrd( jw+iroffh, 1+iroffh, ns+iroffh, t, 1, 1,
1054 $ desct, work(itau), work( ipw ), lwork-ipw+1, info )
1059 IF( kwtop.GT.1 )
THEN
1060 CALL pselget(
'All',
'1-Tree', elem, v, 1+iroffh,
1062 CALL pselset( h, kwtop, kwtop-1, desch, s*elem )
1064 CALL pslacpy(
'Upper', jw-1, jw-1, t, 1+iroffh+1, 1+iroffh,
1065 $ desct, h, kwtop+1, kwtop, desch )
1066 CALL pslacpy(
'All', 1, jw, t, 1+iroffh, 1+iroffh, desct, h,
1067 $ kwtop, kwtop, desch )
1068 CALL pslacpy(
'All', jw-1, 1, t, 1+iroffh+1, 1+iroffh+jw-1,
1069 $ desct, h, kwtop+1, kwtop+jw-1, desch )
1074 IF( ns.GT.1 .AND. s.NE.zero )
THEN
1075 CALL psormhr(
'Right',
'No', jw+iroffh, ns+iroffh, 1+iroffh,
1076 $ ns+iroffh, t, 1, 1, desct, work(itau), v, 1,
1077 $ 1, descv, work( ipw ), lwork-ipw+1, info )
1087 kln =
max( 0, kwtop-ltop )
1088 iroffhh = mod( ltop-1, nb )
1089 icoffhh = mod( kwtop-1, nb )
1090 hhrsrc =
indxg2p( ltop, nb, myrow, desch(rsrc_), nprow )
1091 hhcsrc =
indxg2p( kwtop, nb, mycol, desch(csrc_), npcol )
1092 hhrows =
numroc( kln+iroffhh, nb, myrow, hhrsrc, nprow )
1093 hhcols =
numroc( jw+icoffhh, nb, mycol, hhcsrc, npcol )
1094 CALL descinit( deschh, kln+iroffhh, jw+icoffhh, nb, nb,
1095 $ hhrsrc, hhcsrc, ictxt,
max(1, hhrows), ierr )
1096 CALL psgemm(
'No',
'No', kln, jw, jw, one, h, ltop,
1097 $ kwtop, desch, v, 1+iroffh, 1+iroffh, descv, zero,
1098 $ work, 1+iroffhh, 1+icoffhh, deschh )
1099 CALL pslacpy(
'All', kln, jw, work, 1+iroffhh, 1+icoffhh,
1100 $ deschh, h, ltop, kwtop, desch )
1106 iroffhh = mod( kwtop-1, nb )
1107 icoffhh = mod( kbot, nb )
1108 hhrsrc =
indxg2p( kwtop, nb, myrow, desch(rsrc_), nprow )
1109 hhcsrc =
indxg2p( kbot+1, nb, mycol, desch(csrc_), npcol )
1110 hhrows =
numroc( jw+iroffhh, nb, myrow, hhrsrc, nprow )
1111 hhcols =
numroc( kln+icoffhh, nb, mycol, hhcsrc, npcol )
1112 CALL descinit( deschh, jw+iroffhh, kln+icoffhh, nb, nb,
1113 $ hhrsrc, hhcsrc, ictxt,
max(1, hhrows), ierr )
1114 CALL psgemm(
'Tr',
'No', jw, kln, jw, one, v,
1115 $ 1+iroffh, 1+iroffh, descv, h, kwtop, kbot+1,
1116 $ desch, zero, work, 1+iroffhh, 1+icoffhh, deschh )
1117 CALL pslacpy(
'All', jw, kln, work, 1+iroffhh, 1+icoffhh,
1118 $ deschh, h, kwtop, kbot+1, desch )
1125 iroffzz = mod( iloz-1, nb )
1126 icoffzz = mod( kwtop-1, nb )
1127 zzrsrc =
indxg2p( iloz, nb, myrow, descz(rsrc_), nprow )
1128 zzcsrc =
indxg2p( kwtop, nb, mycol, descz(csrc_), npcol )
1129 zzrows =
numroc( kln+iroffzz, nb, myrow, zzrsrc, nprow )
1130 zzcols =
numroc( jw+icoffzz, nb, mycol, zzcsrc, npcol )
1131 CALL descinit( desczz, kln+iroffzz, jw+icoffzz, nb, nb,
1132 $ zzrsrc, zzcsrc, ictxt,
max(1, zzrows), ierr )
1133 CALL psgemm(
'No',
'No', kln, jw, jw, one, z, iloz,
1134 $ kwtop, descz, v, 1+iroffh, 1+iroffh, descv,
1135 $ zero, work, 1+iroffzz, 1+icoffzz, desczz )
1136 CALL pslacpy(
'All', kln, jw, work, 1+iroffzz, 1+icoffzz,
1137 $ desczz, z, iloz, kwtop, descz )
1151 work( 1 ) = float( lwkopt )
1152 iwork( 1 ) = ilwkopt + nsel