1 SUBROUTINE pdlaedz( N, N1, ID, Q, IQ, JQ, LDQ, DESCQ, Z, WORK )
9 INTEGER ID, IQ, JQ, LDQ, N, N1
13 DOUBLE PRECISION Q( LDQ, * ), WORK( * ), Z( * )
25 INTEGER BLOCK_CYCLIC_2D, DLEN_, DTYPE_, CTXT_, M_, N_,
26 $ MB_, NB_, RSRC_, CSRC_, LLD_
27 parameter( block_cyclic_2d = 1, dlen_ = 9, dtype_ = 1,
28 $ ctxt_ = 2, m_ = 3, n_ = 4, mb_ = 5, nb_ = 6,
29 $ rsrc_ = 7, csrc_ = 8, lld_ = 9 )
33 INTEGER COL, I, IBUF, ICTXT, IIQ, IIZ1, IIZ2, IQCOL,
34 $ IQROW, IZ, IZ1, IZ1COL, IZ1ROW, IZ2, IZ2COL,
35 $ IZ2ROW, J, JJQ, JJZ1, JJZ2, MYCOL, MYROW, N2,
36 $ NB, NBLOC, NPCOL, NPROW, NQ1, NQ2, ZSIZ
42 EXTERNAL blacs_gridinfo, dcopy, dgebr2d, dgebs2d,
52 IF( block_cyclic_2d*csrc_*ctxt_*dlen_*dtype_*lld_*mb_*m_*nb_*n_*
55 ictxt = descq( ctxt_ )
57 CALL blacs_gridinfo( ictxt, nprow, npcol, myrow, mycol )
58 CALL infog2l( id, id, descq, nprow, npcol, myrow, mycol, iiq, jjq,
64 CALL infog2l( iq-1+( id+n1-1 ), jq-1+id, descq, nprow, npcol,
65 $ myrow, mycol, iiz1, jjz1, iz1row, iz1col )
66 nq1 = numroc( n1, nb, mycol, iz1col, npcol )
67 IF( ( myrow.EQ.iz1row ) .AND. ( nq1.NE.0 ) )
THEN
68 CALL dcopy( nq1, q( iiz1, jjz1 ), ldq, work, 1 )
69 IF( myrow.NE.iqrow .OR. mycol.NE.iqcol )
70 $
CALL dgesd2d( ictxt, nq1, 1, work, nq1, iqrow, iqcol )
75 IF( myrow.EQ.iqrow .AND. mycol.EQ.iqcol )
THEN
77 DO 20 i = 0, npcol - 1
78 nq1 = numroc( n1, nb, col, iz1col, npcol )
80 IF( iz1row.NE.iqrow .OR. col.NE.iqcol )
THEN
82 CALL dgerv2d( ictxt, nq1, 1, work( ibuf ), nq1,
89 nbloc = ( nq1-1 ) / nb + 1
91 zsiz =
min( nb, nq1-iz1 )
92 CALL dcopy( zsiz, work( ibuf+iz1 ), 1, z( iz ), 1 )
97 col = mod( col+1, npcol )
103 CALL infog2l( iq-1+( id+n1 ), jq-1+( id+n1 ), descq, nprow, npcol,
104 $ myrow, mycol, iiz2, jjz2, iz2row, iz2col )
105 nq2 = numroc( n2, nb, mycol, iz2col, npcol )
106 IF( ( myrow.EQ.iz2row ) .AND. ( nq2.NE.0 ) )
THEN
107 CALL dcopy( nq2, q( iiz2, jjz2 ), ldq, work, 1 )
108 IF( myrow.NE.iqrow .OR. mycol.NE.iqcol )
109 $
CALL dgesd2d( ictxt, nq2, 1, work, nq2, iqrow, iqcol )
114 IF( myrow.EQ.iqrow .AND. mycol.EQ.iqcol )
THEN
116 DO 40 i = 0, npcol - 1
117 nq2 = numroc( n2, nb, col, iz2col, npcol )
119 IF( iqrow.NE.iz2row .OR. iqcol.NE.col )
THEN
121 CALL dgerv2d( ictxt, nq2, 1, work( ibuf ), nq2,
128 nbloc = ( nq2-1 ) / nb + 1
130 zsiz =
min( nb, nq2-iz2 )
131 CALL dcopy( zsiz, work( ibuf+iz2 ), 1, z( iz ), 1 )
136 col = mod( col+1, npcol )
142 IF( myrow.EQ.iqrow .AND. mycol.EQ.iqcol )
THEN
143 CALL dgebs2d( ictxt,
'All',
' ', n, 1, z, n )
145 CALL dgebr2d( ictxt,
'All',
' ', n, 1, z, n, iqrow, iqcol )