13 void pzrot_( 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;
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,
"PZROT", info );
return; }
298 if( *n == 0 )
return;
304 if( ( myrow == ixrow ) && ( mycol == ixcol ) )
306 buff = &X[iix-1+(jjx-1)*desc_X[
LLD_]];
307 if( ( myrow != iyrow ) || ( mycol != iycol ) )
309 zgesd2d_( &ictxt, n, n, buff, n, &iyrow, &iycol );
310 zgerv2d_( &ictxt, n, n, ywork, n, &iyrow, &iycol );
313 *ywork = Y[iiy-1+(jjy-1)*desc_Y[
LLD_]];
314 zrot_( n, buff, n, ywork, n, c, s );
315 X[iix-1+(jjx-1)*desc_X[
LLD_]] = *buff;
316 if( ( myrow == iyrow ) && ( mycol == iycol ) )
317 Y[iiy-1+(jjy-1)*desc_Y[
LLD_]] = *ywork;
319 else if( ( myrow == iyrow ) && ( mycol == iycol ) )
321 zgesd2d_( &ictxt, n, n, &Y[iiy-1+(jjy-1)*desc_Y[
LLD_]], n,
323 zgerv2d_( &ictxt, n, n, xwork, n, &ixrow, &ixcol );
324 zrot_( n, xwork, n, &Y[iiy-1+(jjy-1)*desc_Y[
LLD_]], n, c, s );
329 if( ( *incx == desc_X[
M_] ) && ( *incy == desc_Y[
M_] ) )
331 nz = (*jx-1) % desc_Y[
NB_];
333 nq = numroc_( &nn, &desc_X[
NB_], &mycol, &ixcol, &npcol );
340 zrot_( &nq, &X[iix-1+(jjx-1)*desc_X[
LLD_]], &desc_X[
LLD_],
341 &Y[iiy-1+(jjy-1)*desc_Y[
LLD_]], &desc_Y[
LLD_], c, s );
349 &X[iix-1+(jjx-1)*desc_X[
LLD_]], &desc_X[
LLD_],
352 zgerv2d_( &ictxt, &nq, &ione, buff, &nq, &iyrow, &mycol );
353 zrot_( &nq, &X[iix-1+(jjx-1)*desc_X[
LLD_]], &desc_X[
LLD_],
356 else if( myrow == iyrow )
359 &Y[iiy-1+(jjy-1)*desc_Y[
LLD_]], &desc_Y[
LLD_],
362 zgerv2d_( &ictxt, &nq, &ione, buff, &nq, &ixrow, &mycol );
363 zrot_( &nq, buff, &ione,
364 &Y[iiy-1+(jjy-1)*desc_Y[
LLD_]], &desc_Y[
LLD_], c, s );
368 else if( ( *incx == 1 ) && ( *incx != desc_X[
M_] ) &&
369 ( *incy == 1 ) && ( *incy != desc_Y[
M_] ) )
371 nz = (*ix-1) % desc_X[
MB_];
373 np = numroc_( &nn, &desc_X[
MB_], &myrow, &ixrow, &nprow );
380 zrot_( &np, &X[iix-1+(jjx-1)*desc_X[
LLD_]], incx,
381 &Y[iiy-1+(jjy-1)*desc_Y[
LLD_]], incy, c, s );
389 &X[iix-1+(jjx-1)*desc_X[
LLD_]], &desc_X[
LLD_],
392 zgerv2d_( &ictxt, &np, &ione, buff, &np, &myrow, &iycol );
393 zrot_( &np, &X[iix-1+(jjx-1)*desc_X[
LLD_]], incx,
396 else if( mycol == iycol )
399 &Y[iiy-1+(jjy-1)*desc_Y[
LLD_]], &desc_Y[
LLD_],
402 zgerv2d_( &ictxt, &np, &ione, buff, &np, &myrow, &ixcol );
403 zrot_( &np, buff, &ione,
404 &Y[iiy-1+(jjy-1)*desc_Y[
LLD_]], incy, c, s );
410 lcm = ilcm_( &nprow, &npcol );
411 if( ( *incx == 1 ) && ( *incx != desc_X[
M_] ) )
414 nz = (*jy-1) % desc_Y[
NB_];
416 tmp1 = nn / desc_Y[
MB_];
417 np = numroc_( &nn, &desc_X[
MB_], &myrow, &ixrow, &nprow );
418 np0 =
MYROC0( tmp1, nn, desc_X[
MB_], nprow );
419 tmp1 = np0 / desc_X[
MB_];
420 wksz =
MYROC0( tmp1, np0, desc_X[
MB_], lcmp );
430 &desc_Y[
NB_], &nz, &Y[iiy-1+(jjy-1)*desc_Y[
LLD_]],
431 &desc_Y[
LLD_], &zero, buff, &ione, &iyrow, &iycol,
432 &ixrow, &ixcol, buff+np );
435 zrot_( &np, &X[iix-1+(jjx-1)*desc_X[
LLD_]],
436 incx, buff, &ione, c, s );
439 &desc_Y[
NB_], &nz, buff, &ione, &zero,
440 &Y[iiy-1+(jjy-1)*desc_Y[
LLD_]], &desc_Y[
LLD_],
441 &ixrow, &ixcol, &iyrow, &iycol, buff+np );
446 nz = (*jx-1) % desc_X[
NB_];
448 tmp1 = nn / desc_X[
MB_];
449 np = numroc_( &nn, desc_Y+
MB_, &myrow, &iyrow, &nprow );
450 np0 =
MYROC0( tmp1, nn, desc_Y[
MB_], nprow );
451 tmp1 = np0 / desc_Y[
MB_];
452 wksz =
MYROC0( tmp1, np0, desc_Y[
MB_], lcmp );
460 &desc_X[
NB_], &nz, &X[iix-1+(jjx-1)*desc_X[
LLD_]],
461 &desc_X[
LLD_], &zero, buff, &ione, &ixrow, &ixcol,
462 &iyrow, &iycol, buff+np );
465 zrot_( &np, buff, &ione,
466 &Y[iiy-1+(jjy-1)*desc_Y[
LLD_]], incy, c, s );
469 &desc_X[
NB_], &nz, buff, &ione, &zero,
470 &X[iix-1+(jjx-1)*desc_X[
LLD_]], &desc_X[
LLD_],
471 &iyrow, &iycol, &ixrow, &ixcol, buff+np );