1 SUBROUTINE pdrot( N, X, IX, JX, DESCX, INCX, Y, IY, JY, DESCY,
2 $ INCY, CS, SN, WORK, LWORK, INFO )
15 INTEGER N, IX, JX, INCX, IY, JY, INCY, LWORK, INFO
16 DOUBLE PRECISION CS, SN
19 INTEGER DESCX( * ), DESCY( * )
20 DOUBLE PRECISION X( * ), Y( * ), WORK( * )
176 INTEGER BLOCK_CYCLIC_2D, CSRC_, CTXT_, DLEN_, DTYPE_,
177 $ lld_, mb_, m_, nb_, n_, rsrc_
178 parameter( block_cyclic_2d = 1, dlen_ = 9, dtype_ = 1,
179 $ ctxt_ = 2, m_ = 3, n_ = 4, mb_ = 5, nb_ = 6,
180 $ rsrc_ = 7, csrc_ = 8, lld_ = 9 )
183 LOGICAL LQUERY, LEFT, RIGHT
184 INTEGER ICTXT, NPROW, NPCOL, MYROW, MYCOL, NPROCS,
185 $ mb, nb, xyrows, xycols, rsrc1, rsrc2, csrc1,
186 $ csrc2, icoffxy, iroffxy, mnwrk, lldx, lldy,
187 $ indx, jxx, xloc1, xloc2, rsrc, csrc, yloc1,
188 $ yloc2, jyy, ixx, iyy
191 INTEGER NUMROC, INDXG2P, INDXG2L
192 EXTERNAL numroc, indxg2p, indxg2l
207 ictxt = descx( ctxt_ )
208 CALL blacs_gridinfo( ictxt, nprow, npcol, myrow, mycol )
217 ELSEIF( ix.LT.1 .OR. ix.GT.descx(m_) )
THEN
219 ELSEIF( jx.LT.1 .OR. jx.GT.descx(n_) )
THEN
221 ELSEIF( incx.NE.1 .AND. incx.NE.descx(m_) )
THEN
223 ELSEIF( iy.LT.1 .OR. iy.GT.descy(m_) )
THEN
225 ELSEIF( jy.LT.1 .OR. jy.GT.descy(n_) )
THEN
227 ELSEIF( incy.NE.1 .AND. incy.NE.descy(m_) )
THEN
229 ELSEIF( (incx.EQ.descx(m_) .AND. incy.NE.descy(m_)) .OR.
230 $ (incx.EQ.1 .AND. incy.NE.1 ) )
THEN
232 ELSEIF( (incx.EQ.1 .AND. incy.EQ.1) .AND.
235 ELSEIF( (incx.EQ.descx(m_) .AND. incy.EQ.descy(m_)) .AND.
242 left = incx.EQ.descx(m_) .AND. incy.EQ.descy(m_)
243 right = incx.EQ.1 .AND. incy.EQ.1
248 IF( left .AND. descx(nb_).NE.descy(nb_) )
THEN
249 info = -(100*5 + nb_)
251 IF( right .AND. descx(mb_).NE.descy(nb_) )
THEN
252 info = -(100*10 + mb_)
256 IF( left .AND. descx(csrc_).NE.descy(csrc_) )
THEN
257 info = -(100*5 + csrc_)
259 IF( right .AND. descx(rsrc_).NE.descy(rsrc_) )
THEN
260 info = -(100*10 + rsrc_)
269 rsrc1 = indxg2p( ix, mb, myrow, descx(rsrc_), nprow )
270 rsrc2 = indxg2p( iy, mb, myrow, descy(rsrc_), nprow )
271 csrc = indxg2p( jx, nb, mycol, descx(csrc_), npcol )
272 icoffxy = mod( jx - 1, nb )
273 xycols = numroc( n+icoffxy, nb, mycol, csrc, npcol )
274 IF( ( myrow.EQ.rsrc1 .OR. myrow.EQ.rsrc2 ) .AND.
275 $ mycol.EQ.csrc ) xycols = xycols - icoffxy
276 IF( rsrc1.NE.rsrc2 )
THEN
282 csrc1 = indxg2p( jx, nb, mycol, descx(csrc_), npcol )
283 csrc2 = indxg2p( jy, nb, mycol, descy(csrc_), npcol )
284 rsrc = indxg2p( ix, mb, myrow, descx(rsrc_), nprow )
285 iroffxy = mod( ix - 1, mb )
286 xyrows = numroc( n+iroffxy, mb, myrow, rsrc, nprow )
287 IF( ( mycol.EQ.csrc1 .OR. mycol.EQ.csrc2 ) .AND.
288 $ myrow.EQ.rsrc ) xyrows = xyrows - iroffxy
289 IF( csrc1.NE.csrc2 )
THEN
296 IF( .NOT.lquery . and. lwork.LT.mnwrk ) info = -15
302 CALL pxerbla( ictxt,
'PDROT', -info )
304 ELSEIF( lquery )
THEN
305 work( 1 ) = dble(mnwrk)
323 IF( nprocs.EQ.1 )
THEN
325 CALL drot( n, x((jx-1)*lldx+ix), lldx, y((jy-1)*lldy+iy),
328 CALL drot( n, x((jx-1)*lldx+ix), 1, y((jy-1)*lldy+iy),
338 DO 10 indx = 1, npcol
339 IF( myrow.EQ.rsrc1 .AND. xycols.GT.0 )
THEN
343 jxx = jx-icoffxy + (indx-1)*nb
345 CALL infog2l( ix, jxx, descx, nprow, npcol, myrow,
346 $ mycol, xloc1, xloc2, rsrc, csrc )
347 IF( myrow.EQ.rsrc .AND. mycol.EQ.csrc )
THEN
348 IF( rsrc1.NE.rsrc2 )
THEN
349 CALL dgesd2d( ictxt, 1, xycols,
350 $ x((xloc2-1)*lldx+xloc1), lldx,
352 CALL dgerv2d( ictxt, 1, xycols, work, 1,
354 CALL drot( xycols, x((xloc2-1)*lldx+xloc1),
355 $ lldx, work, 1, cs, sn )
357 CALL infog2l( iy, jxx, descy, nprow, npcol,
358 $ myrow, mycol, yloc1, yloc2, rsrc,
360 CALL drot( xycols, x((xloc2-1)*lldx+xloc1),
361 $ lldx, y((yloc2-1)*lldy+yloc1), lldy, cs,
366 IF( myrow.EQ.rsrc2 .AND. rsrc1.NE.rsrc2 )
THEN
370 jyy = jy-icoffxy + (indx-1)*nb
372 CALL infog2l( iy, jyy, descy, nprow, npcol, myrow,
373 $ mycol, yloc1, yloc2, rsrc, csrc )
374 IF( myrow.EQ.rsrc .AND. mycol.EQ.csrc )
THEN
375 CALL dgesd2d( ictxt, 1, xycols,
376 $ y((yloc2-1)*lldy+yloc1), lldy,
378 CALL dgerv2d( ictxt, 1, xycols, work, 1,
380 CALL drot( xycols, work, 1, y((yloc2-1)*lldy+yloc1),
386 DO 20 indx = 1, nprow
387 IF( mycol.EQ.csrc1 .AND. xyrows.GT.0 )
THEN
391 ixx = ix-iroffxy + (indx-1)*mb
393 CALL infog2l( ixx, jx, descx, nprow, npcol, myrow,
394 $ mycol, xloc1, xloc2, rsrc, csrc )
395 IF( myrow.EQ.rsrc .AND. mycol.EQ.csrc )
THEN
396 IF( csrc1.NE.csrc2 )
THEN
397 CALL dgesd2d( ictxt, xyrows, 1,
398 $ x((xloc2-1)*lldx+xloc1), lldx,
400 CALL dgerv2d( ictxt, xyrows, 1, work, xyrows,
402 CALL drot( xyrows, x((xloc2-1)*lldx+xloc1),
403 $ 1, work, 1, cs, sn )
405 CALL infog2l( ixx, jy, descy, nprow, npcol,
406 $ myrow, mycol, yloc1, yloc2, rsrc,
408 CALL drot( xyrows, x((xloc2-1)*lldx+xloc1),
409 $ 1, y((yloc2-1)*lldy+yloc1), 1, cs,
414 IF( mycol.EQ.csrc2 .AND. csrc1.NE.csrc2 )
THEN
418 iyy = iy-iroffxy + (indx-1)*mb
420 CALL infog2l( iyy, jy, descy, nprow, npcol, myrow,
421 $ mycol, yloc1, yloc2, rsrc, csrc )
422 IF( myrow.EQ.rsrc .AND. mycol.EQ.csrc )
THEN
423 CALL dgesd2d( ictxt, xyrows, 1,
424 $ y((yloc2-1)*lldy+yloc1), lldy,
426 CALL dgerv2d( ictxt, xyrows, 1, work, xyrows,
428 CALL drot( xyrows, work, 1, y((yloc2-1)*lldy+yloc1),
437 work( 1 ) = dble(mnwrk)