13 void pcrot_( n, X, ix, jx, desc_X, incx, Y, iy, jy, desc_Y, incy, c, s )
21 int * incx, * incy, * ix, * iy, * jx, * jy, * n;
28 int desc_X[], desc_Y[];
185 int ictxt, iix, iiy, info, ixcol, ixrow, iycol, iyrow, jjx,
186 jjy, lcm, lcmp, mycol, myrow, nn, np, np0,
187 nprow, npcol, nq, nz, ione=1, tmp1, wksz;
188 complex xwork[1], ywork[1], zero;
210 ictxt = desc_X[
CTXT_];
217 info = -(500+
CTXT_+1);
220 pbchkvect( *n, 1, *ix, *jx, desc_X, *incx, 5, &iix, &jjx,
221 &ixrow, &ixcol, nprow, npcol, myrow, mycol, &info );
222 pbchkvect( *n, 1, *iy, *jy, desc_Y, *incy, 10, &iiy, &jjy,
223 &iyrow, &iycol, nprow, npcol, myrow, mycol, &info );
229 if( *incx == desc_X[
M_] )
231 if( *incy == desc_Y[
M_] )
233 if( ( ixcol != iycol ) ||
234 ( ( (*jx-1) % desc_X[
NB_] ) !=
235 ( (*jy-1) % desc_Y[
NB_] ) ) )
237 else if( desc_Y[
NB_] != desc_X[
NB_] )
238 info = -(1000+
NB_+1);
240 else if( ( *incy == 1 ) && ( *incy != desc_Y[
M_] ) )
242 if( ( (*jx-1) % desc_X[
NB_] ) != ( (*iy-1) % desc_Y[
MB_] ) )
244 else if( desc_Y[
MB_] != desc_X[
NB_] )
245 info = -(1000+
MB_+1);
252 else if( ( *incx == 1 ) && ( *incx != desc_X[
M_] ) )
254 if( *incy == desc_Y[
M_] )
256 if( ( (*ix-1) % desc_X[
MB_] ) != ( (*jy-1) % desc_Y[
NB_] ) )
258 else if( desc_Y[
NB_] != desc_X[
MB_] )
259 info = -(1000+
NB_+1);
261 else if( ( *incy == 1 ) && ( *incy != desc_Y[
M_] ) )
263 if( ( ixrow != iyrow ) ||
264 ( ( (*ix-1) % desc_X[
MB_] ) !=
265 ( (*iy-1) % desc_Y[
MB_] ) ) )
267 else if( desc_Y[
MB_] != desc_X[
MB_] )
268 info = -(1000+
MB_+1);
280 if( ictxt != desc_Y[
CTXT_] )
281 info = -(1000+
CTXT_+1);
284 if( info ) {
PB_Cabort( ictxt,
"PCROT", info );
return; }
297 if( *n == 0 )
return;
303 if( ( myrow == ixrow ) && ( mycol == ixcol ) )
305 buff = &X[iix-1+(jjx-1)*desc_X[
LLD_]];
306 if( ( myrow != iyrow ) || ( mycol != iycol ) )
308 cgesd2d_( &ictxt, n, n, buff, n, &iyrow, &iycol );
309 cgerv2d_( &ictxt, n, n, ywork, n, &iyrow, &iycol );
312 *ywork = Y[iiy-1+(jjy-1)*desc_Y[
LLD_]];
313 crot_( n, buff, n, ywork, n, c, s );
314 X[iix-1+(jjx-1)*desc_X[
LLD_]] = *buff;
315 if( ( myrow == iyrow ) && ( mycol == iycol ) )
316 Y[iiy-1+(jjy-1)*desc_Y[
LLD_]] = *ywork;
318 else if( ( myrow == iyrow ) && ( mycol == iycol ) )
320 cgesd2d_( &ictxt, n, n, &Y[iiy-1+(jjy-1)*desc_Y[
LLD_]], n,
322 cgerv2d_( &ictxt, n, n, xwork, n, &ixrow, &ixcol );
323 crot_( n, xwork, n, &Y[iiy-1+(jjy-1)*desc_Y[
LLD_]], n, c, s );
328 if( ( *incx == desc_X[
M_] ) && ( *incy == desc_Y[
M_] ) )
330 nz = (*jx-1) % desc_Y[
NB_];
332 nq = numroc_( &nn, &desc_X[
NB_], &mycol, &ixcol, &npcol );
340 &Y[iiy-1+(jjy-1)*desc_Y[
LLD_]], &desc_Y[
LLD_], c, s );
348 &X[iix-1+(jjx-1)*desc_X[
LLD_]], &desc_X[
LLD_],
351 cgerv2d_( &ictxt, &nq, &ione, buff, &nq, &iyrow, &mycol );
355 else if( myrow == iyrow )
358 &Y[iiy-1+(jjy-1)*desc_Y[
LLD_]], &desc_Y[
LLD_],
361 cgerv2d_( &ictxt, &nq, &ione, buff, &nq, &ixrow, &mycol );
362 crot_( &nq, buff, &ione,
363 &Y[iiy-1+(jjy-1)*desc_Y[
LLD_]], &desc_Y[
LLD_], c, s );
367 else if( ( *incx == 1 ) && ( *incx != desc_X[
M_] ) &&
368 ( *incy == 1 ) && ( *incy != desc_Y[
M_] ) )
370 nz = (*ix-1) % desc_X[
MB_];
372 np = numroc_( &nn, &desc_X[
MB_], &myrow, &ixrow, &nprow );
379 crot_( &np, &X[iix-1+(jjx-1)*desc_X[
LLD_]], incx,
380 &Y[iiy-1+(jjy-1)*desc_Y[
LLD_]], incy, c, s );
388 &X[iix-1+(jjx-1)*desc_X[
LLD_]], &desc_X[
LLD_],
391 cgerv2d_( &ictxt, &np, &ione, buff, &np, &myrow, &iycol );
392 crot_( &np, &X[iix-1+(jjx-1)*desc_X[
LLD_]], incx,
395 else if( mycol == iycol )
398 &Y[iiy-1+(jjy-1)*desc_Y[
LLD_]], &desc_Y[
LLD_],
401 cgerv2d_( &ictxt, &np, &ione, buff, &np, &myrow, &ixcol );
402 crot_( &np, buff, &ione,
403 &Y[iiy-1+(jjy-1)*desc_Y[
LLD_]], incy, c, s );
409 lcm = ilcm_( &nprow, &npcol );
410 if( ( *incx == 1 ) && ( *incx != desc_X[
M_] ) )
413 nz = (*jy-1) % desc_Y[
NB_];
415 tmp1 = nn / desc_Y[
MB_];
416 np = numroc_( &nn, &desc_X[
MB_], &myrow, &ixrow, &nprow );
417 np0 =
MYROC0( tmp1, nn, desc_X[
MB_], nprow );
418 tmp1 = np0 / desc_X[
MB_];
419 wksz =
MYROC0( tmp1, np0, desc_X[
MB_], lcmp );
429 &desc_Y[
NB_], &nz, &Y[iiy-1+(jjy-1)*desc_Y[
LLD_]],
430 &desc_Y[
LLD_], &zero, buff, &ione, &iyrow, &iycol,
431 &ixrow, &ixcol, buff+np );
434 crot_( &np, &X[iix-1+(jjx-1)*desc_X[
LLD_]],
435 incx, buff, &ione, c, s );
438 &desc_Y[
NB_], &nz, buff, &ione, &zero,
439 &Y[iiy-1+(jjy-1)*desc_Y[
LLD_]], &desc_Y[
LLD_],
440 &ixrow, &ixcol, &iyrow, &iycol, buff+np );
445 nz = (*jx-1) % desc_X[
NB_];
447 tmp1 = nn / desc_X[
MB_];
448 np = numroc_( &nn, desc_Y+
MB_, &myrow, &iyrow, &nprow );
449 np0 =
MYROC0( tmp1, nn, desc_Y[
MB_], nprow );
450 tmp1 = np0 / desc_Y[
MB_];
451 wksz =
MYROC0( tmp1, np0, desc_Y[
MB_], lcmp );
459 &desc_X[
NB_], &nz, &X[iix-1+(jjx-1)*desc_X[
LLD_]],
460 &desc_X[
LLD_], &zero, buff, &ione, &ixrow, &ixcol,
461 &iyrow, &iycol, buff+np );
464 crot_( &np, buff, &ione,
465 &Y[iiy-1+(jjy-1)*desc_Y[
LLD_]], incy, c, s );
468 &desc_X[
NB_], &nz, buff, &ione, &zero,
469 &X[iix-1+(jjx-1)*desc_X[
LLD_]], &desc_X[
LLD_],
470 &iyrow, &iycol, &ixrow, &ixcol, buff+np );