1 SUBROUTINE pdtreecomb( ICTXT, SCOPE, N, MINE, RDEST0, CDEST0,
11 INTEGER CDEST0, ICTXT, N, RDEST0
14 DOUBLE PRECISION MINE( * )
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
66 DOUBLE PRECISION HIS( 2 )
69 EXTERNAL blacs_gridinfo, dgebr2d, dgebs2d,
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 dgesd2d( 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 dgerv2d( ictxt, n, 1, his, n, rmssg, cmssg )
184 CALL subptr( mine, his )
198 IF( mydist2.EQ.0 )
THEN
199 CALL dgebs2d( ictxt, scope,
' ', n, 1, mine, n )
201 CALL dgebr2d( ictxt, scope,
' ', n, 1, mine, n,
220 DOUBLE PRECISION V1( 2 ), V2( 2 )
247 IF( abs( v1( 1 ) ).LT.abs( v2( 1 ) ) )
THEN
266 DOUBLE PRECISION V1( 2 ), V2( 2 )
287 DOUBLE PRECISION ZERO
288 parameter( zero = 0.0d+0 )
292 IF( v1( 1 ).GE.v2( 1 ) )
THEN
293 IF( v1( 1 ).NE.zero )
294 $ v1( 2 ) = v1( 2 ) + ( v2( 1 ) / v1( 1 ) )**2 * v2( 2 )
296 v1( 2 ) = v2( 2 ) + ( v1( 1 ) / v2( 1 ) )**2 * v1( 2 )
314 DOUBLE PRECISION X, Y
334 DOUBLE PRECISION ONE, ZERO
335 parameter( one = 1.0d+0, zero = 0.0d+0 )
338 DOUBLE PRECISION W, Z
351 x = w*sqrt( one+( z / w )**2 )