1 SUBROUTINE pctreecomb( ICTXT, SCOPE, N, MINE, RDEST0, CDEST0,
11 INTEGER CDEST0, ICTXT, N, RDEST0
60 LOGICAL BCAST, RSCOPE, CSCOPE
61 INTEGER CMSSG, DEST, DIST, HISDIST, I, IAM, MYCOL,
62 $ myrow, mydist, mydist2, np, npcol, nprow,
63 $ rmssg, tcdest, trdest
69 EXTERNAL blacs_gridinfo, cgebr2d, cgebs2d,
85 bcast = ( ( rdest0.EQ.-1 ).OR.( cdest0.EQ.-1 ) )
96 CALL blacs_gridinfo( ictxt, nprow, npcol, myrow, mycol )
100 rscope = lsame( scope,
'R' )
101 cscope = lsame( scope,
'C' )
106 ELSE IF( myrow.NE.trdest )
THEN
110 mydist = mod( npcol + mycol - tcdest, npcol )
111 ELSE IF( cscope )
THEN
114 ELSE IF( mycol.NE.tcdest )
THEN
118 mydist = mod( nprow + myrow - trdest, nprow )
119 ELSE IF( lsame( scope,
'A' ) )
THEN
121 iam = myrow*npcol + mycol
122 dest = trdest*npcol + tcdest
123 mydist = mod( np + iam - dest, np )
138 IF( mod( mydist, 2 ).NE.0 )
THEN
142 dist = i * ( mydist - mod( mydist, 2 ) )
147 cmssg = mod( tcdest + dist, np )
148 ELSE IF( cscope )
THEN
149 rmssg = mod( trdest + dist, np )
151 cmssg = mod( dest + dist, np )
152 rmssg = cmssg / npcol
153 cmssg = mod( cmssg, npcol )
156 CALL cgesd2d( ictxt, n, 1, mine, n, rmssg, cmssg )
167 cmssg = mod( tcdest + dist, np )
168 hisdist = mod( np + cmssg - tcdest, np )
169 ELSE IF( cscope )
THEN
170 rmssg = mod( trdest + dist, np )
171 hisdist = mod( np + rmssg - trdest, np )
173 cmssg = mod( dest + dist, np )
174 rmssg = cmssg / npcol
175 cmssg = mod( cmssg, npcol )
176 hisdist = mod( np + rmssg*npcol+cmssg - dest, np )
179 IF( mydist2.LT.hisdist )
THEN
183 CALL cgerv2d( ictxt, n, 1, his, n, rmssg, cmssg )
184 CALL subptr( mine, his )
198 IF( mydist2.EQ.0 )
THEN
199 CALL cgebs2d( ictxt, scope,
' ', n, 1, mine, n )
201 CALL cgebr2d( ictxt, scope,
' ', n, 1, mine, n,
220 COMPLEX V1( 2 ), V2( 2 )
243 INTRINSIC abs, real, aimag
248 cabs1(zdum) = abs(real(zdum)) + abs(aimag(zdum))
252 IF( cabs1( v1( 1 ) ).LT.cabs1( v2( 1 ) ) )
THEN