1 RECURSIVE SUBROUTINE pdlaqr3( 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 DOUBLE PRECISION 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. )
239 DOUBLE PRECISION zero, one
240 PARAMETER ( zero = 0.0d0, one = 1.0d0 )
243 DOUBLE PRECISION 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_ ),
267 DOUBLE PRECISION ddum( 1 )
273 $ mpi_wtime,
iceil, blacs_pnum
279 $
pdlamve, blacs_gridinfo, blacs_gridmap,
280 $ blacs_gridexit, pdgemr2d
283 INTRINSIC abs, dble, 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,
'PDLAQR3',
'SV', jw, nb, -1, -1)
306 par(2) =
pilaenvx(ictxt, 18,
'PDLAQR3',
'SV', jw, nb, -1, -1)
307 par(3) =
pilaenvx(ictxt, 19,
'PDLAQR3',
'SV', jw, nb, -1, -1)
308 par(4) =
pilaenvx(ictxt, 20,
'PDLAQR3',
'SV', jw, nb, -1, -1)
309 par(5) =
pilaenvx(ictxt, 21,
'PDLAQR3',
'SV', jw, nb, -1, -1)
310 par(6) =
pilaenvx(ictxt, 22,
'PDLAQR3',
'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 pdgehrd( jw, 1, jw, t, 1, 1, desct, work, work, -1,
329 lwk1 = int( work( 1 ) ) + taurows*taucols
333 CALL pdormhr(
'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,
'PDLAQR3',
'SV', jw, 1, jw, lwork )
341 IF( jw+iroffh.GT.nmin .AND. jw+iroffh.LE.nmax
342 $ .AND. reclevel.LT.recmax )
THEN
343 CALL pdlaqr0( .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 pdlaqr1( .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 pdtrord(
'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 +
402 lwkopt =
max( lwk1, lwk2, lwk3+lwk4, lwk5, lwk6, lwk7, lwk8 )
403 ilwkopt =
max( iwrk1, iwrk2 )
408 work( 1 ) = dble( lwkopt )
412 iwork( 1 ) = ilwkopt + nsel
428 safmin =
dlamch(
'SAFE MINIMUM' )
429 safmax = one / safmin
430 CALL dlabad( safmin, safmax )
431 ulp =
dlamch(
'PRECISION' )
432 smlnum = safmin*( dble( n ) / ulp )
436 jw =
min( nw, kbot-ktop+1 )
437 kwtop = kbot - jw + 1
438 IF( kwtop.EQ.ktop )
THEN
441 CALL pdelget(
'All',
'1-Tree', s, h, kwtop, kwtop-1, desch )
444 IF( kbot.EQ.kwtop )
THEN
448 CALL pdelget(
'All',
'1-Tree', sr( kwtop ), h, kwtop, kwtop,
453 IF( abs( s ).LE.
max( smlnum, ulp*abs( sr( kwtop ) ) ) )
458 $
CALL pdelset( h, kwtop, kwtop-1 , desch, zero )
463 IF( kwtop.EQ.ktop .AND. kbot-kwtop.EQ.1 )
THEN
467 CALL pdelget(
'All',
'1-Tree', aa, h, kwtop, kwtop, desch )
468 CALL pdelget(
'All',
'1-Tree', bb, h, kwtop, kwtop+1, desch )
469 CALL pdelget(
'All',
'1-Tree', cc, h, kwtop+1, kwtop, desch )
470 CALL pdelget(
'All',
'1-Tree', dd, h, kwtop+1, kwtop+1, desch )
471 CALL dlanv2( aa, bb, cc, dd, sr(kwtop), si(kwtop),
472 $ sr(kwtop+1), si(kwtop+1), cs, sn )
475 IF( cc.EQ.zero )
THEN
477 IF( i+2.LE.n .AND. wantt )
478 $
CALL pdrot( n-i-1, h, i, i+2, desch, desch(m_), h, i+1,
479 $ i+2, desch, desch(m_), cs, sn, work, lwork, info )
481 $
CALL pdrot( i-1, h, 1, i, desch, 1, h, 1, i+1, desch, 1,
482 $ cs, sn, work, lwork, info )
484 $
CALL pdrot( ihiz-iloz+1, z, iloz, i, descz, 1, z, iloz,
485 $ i+1, descz, 1, cs, sn, work, lwork, info )
486 CALL pdelset( h, i, i, desch, aa )
487 CALL pdelset( h, i, i+1, desch, bb )
488 CALL pdelset( h, i+1, i, desch, cc )
489 CALL pdelset( h, i+1, i+1, desch, dd )
491 work( 1 ) = dble( lwkopt )
498 iroffh = mod( kwtop - 1, nb )
503 desct( m_ ) = jw+iroffh
504 desct( n_ ) = jw+iroffh
513 CALL pdlaset(
'All', iroffh, jw+iroffh, zero, one, t, 1, 1,
515 CALL pdlaset(
'All', jw, iroffh, zero, zero, t, 1+iroffh, 1,
517 CALL pdlacpy(
'All', 1, jw, h, kwtop, kwtop, desch, t, 1+iroffh,
519 CALL pdlacpy(
'Upper', jw-1, jw-1, h, kwtop+1, kwtop, desch, t,
520 $ 1+iroffh+1, 1+iroffh, desct )
522 $
CALL pdlaset(
'Lower', jw-2, jw-2, zero, zero, t, 1+iroffh+2,
524 CALL pdlacpy(
'All', jw-1, 1, h, kwtop+1, kwtop+jw-1, desch, t,
525 $ 1+iroffh+1, 1+iroffh+jw-1, desct )
529 CALL pdlaset(
'All', jw+iroffh, jw+iroffh, zero, one, v, 1, 1,
534 npmin =
pilaenvx( ictxt, 23,
'PDLAQR3',
'SV', jw, nb, nprow,
536 nmin =
pilaenvx( ictxt, 12,
'PDLAQR3',
'SV', jw, 1, jw, lwork )
538 IF(
min(nprow, npcol).LE.npmin+1 .OR. reclevel.GE.1 )
THEN
543 IF( jw+iroffh.GT.nmin .AND. jw+iroffh.LE.nmax
544 $ .AND. reclevel.LT.recmax )
THEN
545 CALL pdlaqr0( .true., .true., jw+iroffh, 1+iroffh,
546 $ jw+iroffh, t, desct, sr( kwtop-iroffh ),
547 $ si( kwtop-iroffh ), 1+iroffh, jw+iroffh, v, descv,
548 $ work, lwork, iwork(nsel+1), liwork-nsel, infqr,
551 IF( desct(rsrc_).EQ.0 .AND. desct(csrc_).EQ.0 )
THEN
552 IF( jw+iroffh.GT.desct( mb_ ) )
THEN
553 CALL pdlaqr1( .true., .true., jw+iroffh, 1,
554 $ jw+iroffh, t, desct, sr( kwtop-iroffh ),
555 $ si( kwtop-iroffh ), 1, jw+iroffh, v,
556 $ descv, work, lwork, iwork(nsel+1), liwork-nsel,
559 IF( myrow.EQ.0 .AND. mycol.EQ.0 )
THEN
560 CALL dlahqr( .true., .true., jw+iroffh, 1+iroffh,
561 $ jw+iroffh, t, desct(lld_),
562 $ sr( kwtop-iroffh ), si( kwtop-iroffh ),
563 $ 1+iroffh, jw+iroffh, v, descv(lld_), infqr )
568 $
CALL igamn2d( ictxt,
'All',
'1-Tree', 1, 1, infqr,
569 $ 1, -1, -1, -1, -1, -1 )
571 ELSEIF( jw+iroffh.LE.desct( mb_ ) )
THEN
572 IF( myrow.EQ.desct(rsrc_) .AND. mycol.EQ.desct(csrc_) )
574 CALL dlahqr( .true., .true., jw+iroffh, 1+iroffh,
575 $ jw+iroffh, t, desct(lld_),
576 $ sr( kwtop-iroffh ), si( kwtop-iroffh ),
577 $ 1+iroffh, jw+iroffh, v, descv(lld_), infqr )
582 $
CALL igamn2d( ictxt,
'All',
'1-Tree', 1, 1, infqr,
583 $ 1, -1, -1, -1, -1, -1 )
585 tzrows0 =
numroc( jw+iroffh, nb, myrow, 0, nprow )
586 tzcols0 =
numroc( jw+iroffh, nb, mycol, 0, npcol )
587 CALL descinit( desctz0, jw+iroffh, jw+iroffh, nb, nb, 0,
588 $ 0, ictxt,
max(1,tzrows0), ierr0 )
590 ipz0 = ipt0 +
max(1,tzrows0)*tzcols0
591 ipw0 = ipz0 +
max(1,tzrows0)*tzcols0
592 CALL pdlamve(
'All', jw+iroffh, jw+iroffh, t, 1, 1,
593 $ desct, work(ipt0), 1, 1, desctz0, work(ipw0) )
594 CALL pdlaset(
'All', jw+iroffh, jw+iroffh, zero, one,
595 $ work(ipz0), 1, 1, desctz0 )
596 CALL pdlaqr1( .true., .true., jw+iroffh, 1,
597 $ jw+iroffh, work(ipt0), desctz0,
598 $ sr( kwtop-iroffh ), si( kwtop-iroffh ),
599 $ 1, jw+iroffh, work(ipz0),
600 $ desctz0, work(ipw0), lwork-ipw0+1, iwork(nsel+1),
601 $ liwork-nsel, infqr )
602 CALL pdlamve(
'All', jw+iroffh, jw+iroffh, work(ipt0), 1,
603 $ 1, desctz0, t, 1, 1, desct, work(ipw0) )
604 CALL pdlamve(
'All', jw+iroffh, jw+iroffh, work(ipz0), 1,
605 $ 1, desctz0, v, 1, 1, descv, work(ipw0) )
617 pmap( j+1+i*npmin ) = blacs_pnum( ictxt, i, j )
620 CALL blacs_gridmap( ictxt_new, pmap, npmin, npmin, npmin )
621 CALL blacs_gridinfo( ictxt_new, npmin, npmin, myrow_new,
623 IF( myrow.GE.npmin .OR. mycol.GE.npmin ) ictxt_new = -1
624 IF( ictxt_new.GE.0 )
THEN
625 tzrows0 =
numroc( jw, nb, myrow_new, 0, npmin )
626 tzcols0 =
numroc( jw, nb, mycol_new, 0, npmin )
627 CALL descinit( desctz0, jw, jw, nb, nb, 0,
628 $ 0, ictxt_new,
max(1,tzrows0), ierr0 )
630 ipz0 = ipt0 +
max(1,tzrows0)*
max(1,tzcols0)
631 ipw0 = ipz0 +
max(1,tzrows0)*
max(1,tzcols0)
636 desctz0( ctxt_ ) = -1
639 CALL pdgemr2d( jw, jw, t, 1+iroffh, 1+iroffh, desct,
640 $ work(ipt0), 1, 1, desctz0, ictxt )
641 IF( ictxt_new.GE.0 )
THEN
642 CALL pdlaset(
'All', jw, jw, zero, one, work(ipz0), 1, 1,
644 nmin =
pilaenvx( ictxt_new, 12,
'PDLAQR3',
'SV', jw, 1, jw,
646 IF( jw.GT.nmin .AND. jw.LE.nmax .AND. reclevel.LT.1 )
THEN
647 CALL pdlaqr0( .true., .true., jw, 1, jw, work(ipt0),
648 $ desctz0, sr( kwtop ), si( kwtop ), 1, jw,
649 $ work(ipz0), desctz0, work(ipw0), lwork-ipw0+1,
650 $ iwork(nsel+1), liwork-nsel, infqr,
653 CALL pdlaqr1( .true., .true., jw, 1, jw, work(ipt0),
654 $ desctz0, sr( kwtop ), si( kwtop ), 1, jw,
655 $ work(ipz0), desctz0, work(ipw0), lwork-ipw0+1,
656 $ iwork(nsel+1), liwork-nsel, infqr )
659 CALL pdgemr2d( jw, jw, work(ipt0), 1, 1, desctz0, t, 1+iroffh,
660 $ 1+iroffh, desct, ictxt )
661 CALL pdgemr2d( jw, jw, work(ipz0), 1, 1, desctz0, v, 1+iroffh,
662 $ 1+iroffh, descv, ictxt )
664 $
CALL blacs_gridexit( ictxt_new )
665 IF( myrow+mycol.GT.0 )
THEN
671 CALL igamn2d( ictxt,
'All',
'1-Tree', 1, 1, infqr, 1, -1, -1,
673 CALL dgsum2d( ictxt,
'All',
' ', jw, 1, sr(kwtop), jw, -1, -1 )
674 CALL dgsum2d( ictxt,
'All',
' ', jw, 1, si(kwtop), jw, -1, -1 )
680 $ infqr = infqr - iroffh
685 CALL pdelset( t, j+2, j, desct, zero )
686 CALL pdelset( t, j+3, j, desct, zero )
689 $
CALL pdelset( t, jw, jw-2, desct, zero )
709 DO 70 j = 1, iroffh + infqr
714 ilst = infqr + 1 + iroffh
716 CALL pdelget(
'All',
'1-Tree', elem, t, ilst, ilst-1, desct )
718 IF( bulge ) ilst = ilst+1
722 IF( ilst.LE.ns+iroffh )
THEN
726 lilst =
max(ilst,ns+iroffh-nb+1)
727 IF( lilst.GT.1 )
THEN
728 CALL pdelget(
'All',
'1-Tree', elem, t, lilst, lilst-1,
731 IF( bulge ) lilst = lilst+1
736 DO 90 j = iroffh+1, lilst-1
746 IF( lilst.LE.ns+iroffh )
THEN
750 CALL pdelget(
'All',
'1-Tree', elem, t, ns+iroffh,
751 $ ns+iroffh-1, desct )
757 IF( .NOT.bulge )
THEN
761 CALL pdelget(
'All',
'1-Tree', elem, t, ns+iroffh,
766 CALL pdelget(
'All',
'1-Tree', elem, v, 1+iroffh,
768 IF( abs( s*elem ).LE.
max( smlnum, ulp*foo ) )
THEN
778 DO 110 j = lilst, jw+iroffh
781 iwork( ifst+iroffh ) = 1
782 CALL pdtrord(
'Vectors', iwork, par, jw+iroffh, t, 1,
783 $ 1, desct, v, 1, 1, descv, work,
784 $ work(jw+iroffh+1), mloc,
785 $ work(2*(jw+iroffh)+1), lwork-2*(jw+iroffh),
786 $ iwork(nsel+1), liwork-nsel, info )
791 iwork( ifst+iroffh ) = 0
800 lilst =
max(info, lilst)
801 ilst =
max(info, ilst)
808 CALL pdelget(
'All',
'1-Tree', elem1, t, ns+iroffh,
810 CALL pdelget(
'All',
'1-Tree', elem2, t, ns+iroffh,
811 $ ns+iroffh-1, desct )
812 CALL pdelget(
'All',
'1-Tree', elem3, t, ns+iroffh-1,
814 foo = abs( elem1 ) + sqrt( abs( elem2 ) )*
815 $ sqrt( abs( elem3 ) )
818 CALL pdelget(
'All',
'1-Tree', elem1, v, 1+iroffh,
820 CALL pdelget(
'All',
'1-Tree', elem2, v, 1+iroffh,
821 $ ns+iroffh-1, descv )
822 IF(
max( abs( s*elem1 ), abs( s*elem2 ) ).LE.
823 $
max( smlnum, ulp*foo ) )
THEN
833 DO 120 j = lilst, jw+iroffh
836 iwork( ifst+iroffh ) = 1
837 iwork( ifst+iroffh-1 ) = 1
838 CALL pdtrord(
'Vectors', iwork, par, jw+iroffh, t, 1,
839 $ 1, desct, v, 1, 1, descv, work,
840 $ work(jw+iroffh+1), mloc,
841 $ work(2*(jw+iroffh)+1), lwork-2*(jw+iroffh),
842 $ iwork(nsel+1), liwork-nsel, info )
847 iwork( ifst+iroffh ) = 0
848 iwork( ifst+iroffh-1 ) = 0
858 lilst =
max(info, lilst)
859 ilst =
max(info, ilst)
872 DO 130 j = ilst, lilst0-1
875 CALL pdtrord(
'Vectors', iwork, par, jw+iroffh, t, 1, 1,
876 $ desct, v, 1, 1, descv, work, work(jw+iroffh+1),
877 $ m, work(2*(jw+iroffh)+1), lwork-2*(jw+iroffh),
878 $ iwork(nsel+1), liwork-nsel, info )
885 $ ilst =
max(info, ilst)
895 CALL dcopy( jw, work(1+iroffh), 1, sr( kwtop ), 1 )
896 CALL dcopy( jw, work(jw+2*iroffh+1), 1, si( kwtop ), 1 )
907 IF( ns.LT.jw .AND. sortgrad )
THEN
923 i = infqr + 1 + iroffh
924 IF( i.EQ.ns+iroffh )
THEN
926 ELSE IF( si( kwtop-iroffh + i-1 ).EQ.zero )
THEN
934 evi = abs( sr( kwtop-iroffh+i-1 ) )
936 evi = abs( sr( kwtop-iroffh+i-1 ) ) +
937 $ abs( si( kwtop-iroffh+i-1 ) )
941 evk = abs( sr( kwtop-iroffh+k-1 ) )
942 ELSEIF( si( kwtop-iroffh+k-1 ).EQ.zero )
THEN
943 evk = abs( sr( kwtop-iroffh+k-1 ) )
945 evk = abs( sr( kwtop-iroffh+k-1 ) ) +
946 $ abs( si( kwtop-iroffh+k-1 ) )
949 IF( evi.GE.evk )
THEN
966 IF( k.NE.kend .AND. si( kwtop-iroffh+k-1 ).NE.zero )
THEN
972 IF( k.LT.kend ) iwork(k+1) = 0
975 DO 170 j = k+2, jw+iroffh
978 CALL pdtrord(
'Vectors', iwork, par, jw+iroffh, t, 1, 1,
979 $ desct, v, 1, 1, descv, work, work(jw+iroffh+1), m,
980 $ work(2*(jw+iroffh)+1), lwork-2*(jw+iroffh),
981 $ iwork(nsel+1), liwork-nsel, ierr )
982 CALL dcopy( jw, work(1+iroffh), 1, sr( kwtop ), 1 )
983 CALL dcopy( jw, work(jw+2*iroffh+1), 1, si( kwtop ), 1 )
992 ELSE IF( si( kwtop-iroffh+i-1 ).EQ.zero )
THEN
1005 desct( m_ ) = nw+iroffh
1006 desct( n_ ) = nh+iroffh
1008 IF( ns.LT.jw .OR. s.EQ.zero )
THEN
1009 IF( ns.GT.1 .AND. s.NE.zero )
THEN
1013 rrows =
numroc( ns+iroffh, nb, myrow, descv(rsrc_), nprow )
1014 rcols =
numroc( 1, 1, mycol, descv(csrc_), npcol )
1015 CALL descinit( descr, ns+iroffh, 1, nb, 1, descv(rsrc_),
1016 $ descv(csrc_), ictxt,
max(1, rrows), info )
1017 taurows =
numroc( 1, 1, mycol, descv(rsrc_), nprow )
1018 taucols =
numroc( jw+iroffh, nb, mycol, descv(csrc_),
1020 CALL descinit( desctau, 1, jw+iroffh, 1, nb, descv(rsrc_),
1021 $ descv(csrc_), ictxt,
max(1, taurows), info )
1024 itau = ir + descr( lld_ ) * rcols
1025 ipw = itau + desctau( lld_ ) * taucols
1027 CALL pdlaset(
'All', ns+iroffh, 1, zero, zero, work(itau),
1030 CALL pdcopy( ns, v, 1+iroffh, 1+iroffh, descv, descv(m_),
1031 $ work(ir), 1+iroffh, 1, descr, 1 )
1032 CALL pdlarfg( ns, beta, 1+iroffh, 1, work(ir), 2+iroffh, 1,
1033 $ descr, 1, work(itau+iroffh) )
1034 CALL pdelset( work(ir), 1+iroffh, 1, descr, one )
1036 CALL pdlaset(
'Lower', jw-2, jw-2, zero, zero, t, 3+iroffh,
1039 CALL pdlarf(
'Left', ns, jw, work(ir), 1+iroffh, 1, descr,
1040 $ 1, work(itau+iroffh), t, 1+iroffh, 1+iroffh,
1041 $ desct, work( ipw ) )
1042 CALL pdlarf(
'Right', ns, ns, work(ir), 1+iroffh, 1, descr,
1043 $ 1, work(itau+iroffh), t, 1+iroffh, 1+iroffh,
1044 $ desct, work( ipw ) )
1045 CALL pdlarf(
'Right', jw, ns, work(ir), 1+iroffh, 1, descr,
1046 $ 1, work(itau+iroffh), v, 1+iroffh, 1+iroffh,
1047 $ descv, work( ipw ) )
1050 ipw = itau + desctau( lld_ ) * taucols
1051 CALL pdgehrd( jw+iroffh, 1+iroffh, ns+iroffh, t, 1, 1,
1052 $ desct, work(itau), work( ipw ), lwork-ipw+1, info )
1057 IF( kwtop.GT.1 )
THEN
1058 CALL pdelget(
'All',
'1-Tree', elem, v, 1+iroffh,
1060 CALL pdelset( h, kwtop, kwtop-1, desch, s*elem )
1062 CALL pdlacpy(
'Upper', jw-1, jw-1, t, 1+iroffh+1, 1+iroffh,
1063 $ desct, h, kwtop+1, kwtop, desch )
1064 CALL pdlacpy(
'All', 1, jw, t, 1+iroffh, 1+iroffh, desct, h,
1065 $ kwtop, kwtop, desch )
1066 CALL pdlacpy(
'All', jw-1, 1, t, 1+iroffh+1, 1+iroffh+jw-1,
1067 $ desct, h, kwtop+1, kwtop+jw-1, desch )
1072 IF( ns.GT.1 .AND. s.NE.zero )
THEN
1073 CALL pdormhr(
'Right',
'No', jw+iroffh, ns+iroffh, 1+iroffh,
1074 $ ns+iroffh, t, 1, 1, desct, work(itau), v, 1,
1075 $ 1, descv, work( ipw ), lwork-ipw+1, info )
1085 kln =
max( 0, kwtop-ltop )
1086 iroffhh = mod( ltop-1, nb )
1087 icoffhh = mod( kwtop-1, nb )
1088 hhrsrc =
indxg2p( ltop, nb, myrow, desch(rsrc_), nprow )
1089 hhcsrc =
indxg2p( kwtop, nb, mycol, desch(csrc_), npcol )
1090 hhrows =
numroc( kln+iroffhh, nb, myrow, hhrsrc, nprow )
1091 hhcols =
numroc( jw+icoffhh, nb, mycol, hhcsrc, npcol )
1092 CALL descinit( deschh, kln+iroffhh, jw+icoffhh, nb, nb,
1093 $ hhrsrc, hhcsrc, ictxt,
max(1, hhrows), ierr )
1094 CALL pdgemm(
'No',
'No', kln, jw, jw, one, h, ltop,
1095 $ kwtop, desch, v, 1+iroffh, 1+iroffh, descv, zero,
1096 $ work, 1+iroffhh, 1+icoffhh, deschh )
1097 CALL pdlacpy(
'All', kln, jw, work, 1+iroffhh, 1+icoffhh,
1098 $ deschh, h, ltop, kwtop, desch )
1104 iroffhh = mod( kwtop-1, nb )
1105 icoffhh = mod( kbot, nb )
1106 hhrsrc =
indxg2p( kwtop, nb, myrow, desch(rsrc_), nprow )
1107 hhcsrc =
indxg2p( kbot+1, nb, mycol, desch(csrc_), npcol )
1108 hhrows =
numroc( jw+iroffhh, nb, myrow, hhrsrc, nprow )
1109 hhcols =
numroc( kln+icoffhh, nb, mycol, hhcsrc, npcol )
1110 CALL descinit( deschh, jw+iroffhh, kln+icoffhh, nb, nb,
1111 $ hhrsrc, hhcsrc, ictxt,
max(1, hhrows), ierr )
1112 CALL pdgemm(
'Tr',
'No', jw, kln, jw, one, v,
1113 $ 1+iroffh, 1+iroffh, descv, h, kwtop, kbot+1,
1114 $ desch, zero, work, 1+iroffhh, 1+icoffhh, deschh )
1115 CALL pdlacpy(
'All', jw, kln, work, 1+iroffhh, 1+icoffhh,
1116 $ deschh, h, kwtop, kbot+1, desch )
1123 iroffzz = mod( iloz-1, nb )
1124 icoffzz = mod( kwtop-1, nb )
1125 zzrsrc =
indxg2p( iloz, nb, myrow, descz(rsrc_), nprow )
1126 zzcsrc =
indxg2p( kwtop, nb, mycol, descz(csrc_), npcol )
1127 zzrows =
numroc( kln+iroffzz, nb, myrow, zzrsrc, nprow )
1128 zzcols =
numroc( jw+icoffzz, nb, mycol, zzcsrc, npcol )
1129 CALL descinit( desczz, kln+iroffzz, jw+icoffzz, nb, nb,
1130 $ zzrsrc, zzcsrc, ictxt,
max(1, zzrows), ierr )
1131 CALL pdgemm(
'No',
'No', kln, jw, jw, one, z, iloz,
1132 $ kwtop, descz, v, 1+iroffh, 1+iroffh, descv,
1133 $ zero, work, 1+iroffzz, 1+icoffzz, desczz )
1134 CALL pdlacpy(
'All', kln, jw, work, 1+iroffzz, 1+icoffzz,
1135 $ desczz, z, iloz, kwtop, descz )
1149 work( 1 ) = dble( lwkopt )
1150 iwork( 1 ) = ilwkopt + nsel