13void pzrot_(
Int *n,
complex16 X[],
Int *ix,
Int *jx,
Int desc_X[],
Int *incx,
complex16 Y[],
Int *iy,
Int *jy,
Int desc_Y[],
Int *incy,
double *c,
complex16 *s )
173 Int ictxt, iix, iiy, info, ixcol, ixrow, iycol, iyrow, jjx,
174 jjy, lcm, lcmp, mycol, myrow, nn, np, np0,
175 nprow, npcol, nq, nz, ione=1, tmp1, wksz;
198 ictxt = desc_X[
CTXT_];
205 info = -(500+
CTXT_+1);
208 pbchkvect( *n, 1, *ix, *jx, desc_X, *incx, 5, &iix, &jjx,
209 &ixrow, &ixcol, nprow, npcol, myrow, mycol, &info );
210 pbchkvect( *n, 1, *iy, *jy, desc_Y, *incy, 10, &iiy, &jjy,
211 &iyrow, &iycol, nprow, npcol, myrow, mycol, &info );
217 if( *incx == desc_X[
M_] )
219 if( *incy == desc_Y[
M_] )
221 if( ( ixcol != iycol ) ||
222 ( ( (*jx-1) % desc_X[
NB_] ) !=
223 ( (*jy-1) % desc_Y[
NB_] ) ) )
225 else if( desc_Y[
NB_] != desc_X[
NB_] )
226 info = -(1000+
NB_+1);
228 else if( ( *incy == 1 ) && ( *incy != desc_Y[
M_] ) )
230 if( ( (*jx-1) % desc_X[
NB_] ) != ( (*iy-1) % desc_Y[
MB_] ) )
232 else if( desc_Y[
MB_] != desc_X[
NB_] )
233 info = -(1000+
MB_+1);
240 else if( ( *incx == 1 ) && ( *incx != desc_X[
M_] ) )
242 if( *incy == desc_Y[
M_] )
244 if( ( (*ix-1) % desc_X[
MB_] ) != ( (*jy-1) % desc_Y[
NB_] ) )
246 else if( desc_Y[
NB_] != desc_X[
MB_] )
247 info = -(1000+
NB_+1);
249 else if( ( *incy == 1 ) && ( *incy != desc_Y[
M_] ) )
251 if( ( ixrow != iyrow ) ||
252 ( ( (*ix-1) % desc_X[
MB_] ) !=
253 ( (*iy-1) % desc_Y[
MB_] ) ) )
255 else if( desc_Y[
MB_] != desc_X[
MB_] )
256 info = -(1000+
MB_+1);
268 if( ictxt != desc_Y[
CTXT_] )
269 info = -(1000+
CTXT_+1);
272 if( info ) {
PB_Cabort( ictxt,
"PZROT", info );
return; }
286 if( *n == 0 )
return;
292 if( ( myrow == ixrow ) && ( mycol == ixcol ) )
294 buff = &X[iix-1+(jjx-1)*desc_X[
LLD_]];
295 if( ( myrow != iyrow ) || ( mycol != iycol ) )
297 zgesd2d_( &ictxt, n, n, buff, n, &iyrow, &iycol );
298 zgerv2d_( &ictxt, n, n, ywork, n, &iyrow, &iycol );
301 *ywork = Y[iiy-1+(jjy-1)*desc_Y[
LLD_]];
302 zrot_( n, buff, n, ywork, n, c, s );
303 X[iix-1+(jjx-1)*desc_X[
LLD_]] = *buff;
304 if( ( myrow == iyrow ) && ( mycol == iycol ) )
305 Y[iiy-1+(jjy-1)*desc_Y[
LLD_]] = *ywork;
307 else if( ( myrow == iyrow ) && ( mycol == iycol ) )
309 zgesd2d_( &ictxt, n, n, &Y[iiy-1+(jjy-1)*desc_Y[
LLD_]], n,
311 zgerv2d_( &ictxt, n, n, xwork, n, &ixrow, &ixcol );
312 zrot_( n, xwork, n, &Y[iiy-1+(jjy-1)*desc_Y[
LLD_]], n, c, s );
317 if( ( *incx == desc_X[
M_] ) && ( *incy == desc_Y[
M_] ) )
319 nz = (*jx-1) % desc_Y[
NB_];
321 nq = numroc_( &nn, &desc_X[
NB_], &mycol, &ixcol, &npcol );
328 zrot_( &nq, &X[iix-1+(jjx-1)*desc_X[
LLD_]], &desc_X[
LLD_],
329 &Y[iiy-1+(jjy-1)*desc_Y[
LLD_]], &desc_Y[
LLD_], c, s );
337 &X[iix-1+(jjx-1)*desc_X[
LLD_]], &desc_X[
LLD_],
340 zgerv2d_( &ictxt, &nq, &ione, buff, &nq, &iyrow, &mycol );
341 zrot_( &nq, &X[iix-1+(jjx-1)*desc_X[
LLD_]], &desc_X[
LLD_],
344 else if( myrow == iyrow )
347 &Y[iiy-1+(jjy-1)*desc_Y[
LLD_]], &desc_Y[
LLD_],
350 zgerv2d_( &ictxt, &nq, &ione, buff, &nq, &ixrow, &mycol );
351 zrot_( &nq, buff, &ione,
352 &Y[iiy-1+(jjy-1)*desc_Y[
LLD_]], &desc_Y[
LLD_], c, s );
356 else if( ( *incx == 1 ) && ( *incx != desc_X[
M_] ) &&
357 ( *incy == 1 ) && ( *incy != desc_Y[
M_] ) )
359 nz = (*ix-1) % desc_X[
MB_];
361 np = numroc_( &nn, &desc_X[
MB_], &myrow, &ixrow, &nprow );
368 zrot_( &np, &X[iix-1+(jjx-1)*desc_X[
LLD_]], incx,
369 &Y[iiy-1+(jjy-1)*desc_Y[
LLD_]], incy, c, s );
377 &X[iix-1+(jjx-1)*desc_X[
LLD_]], &desc_X[
LLD_],
380 zgerv2d_( &ictxt, &np, &ione, buff, &np, &myrow, &iycol );
381 zrot_( &np, &X[iix-1+(jjx-1)*desc_X[
LLD_]], incx,
384 else if( mycol == iycol )
387 &Y[iiy-1+(jjy-1)*desc_Y[
LLD_]], &desc_Y[
LLD_],
390 zgerv2d_( &ictxt, &np, &ione, buff, &np, &myrow, &ixcol );
391 zrot_( &np, buff, &ione,
392 &Y[iiy-1+(jjy-1)*desc_Y[
LLD_]], incy, c, s );
398 lcm = ilcm_( &nprow, &npcol );
399 if( ( *incx == 1 ) && ( *incx != desc_X[
M_] ) )
402 nz = (*jy-1) % desc_Y[
NB_];
404 tmp1 = nn / desc_Y[
MB_];
405 np = numroc_( &nn, &desc_X[
MB_], &myrow, &ixrow, &nprow );
406 np0 =
MYROC0( tmp1, nn, desc_X[
MB_], nprow );
407 tmp1 = np0 / desc_X[
MB_];
408 wksz =
MYROC0( tmp1, np0, desc_X[
MB_], lcmp );
418 &desc_Y[
NB_], &nz, &Y[iiy-1+(jjy-1)*desc_Y[
LLD_]],
419 &desc_Y[
LLD_], &zero, buff, &ione, &iyrow, &iycol,
420 &ixrow, &ixcol, buff+np );
423 zrot_( &np, &X[iix-1+(jjx-1)*desc_X[
LLD_]],
424 incx, buff, &ione, c, s );
427 &desc_Y[
NB_], &nz, buff, &ione, &zero,
428 &Y[iiy-1+(jjy-1)*desc_Y[
LLD_]], &desc_Y[
LLD_],
429 &ixrow, &ixcol, &iyrow, &iycol, buff+np );
434 nz = (*jx-1) % desc_X[
NB_];
436 tmp1 = nn / desc_X[
MB_];
437 np = numroc_( &nn, desc_Y+
MB_, &myrow, &iyrow, &nprow );
438 np0 =
MYROC0( tmp1, nn, desc_Y[
MB_], nprow );
439 tmp1 = np0 / desc_Y[
MB_];
440 wksz =
MYROC0( tmp1, np0, desc_Y[
MB_], lcmp );
448 &desc_X[
NB_], &nz, &X[iix-1+(jjx-1)*desc_X[
LLD_]],
449 &desc_X[
LLD_], &zero, buff, &ione, &ixrow, &ixcol,
450 &iyrow, &iycol, buff+np );
453 zrot_( &np, buff, &ione,
454 &Y[iiy-1+(jjy-1)*desc_Y[
LLD_]], incy, c, s );
457 &desc_X[
NB_], &nz, buff, &ione, &zero,
458 &X[iix-1+(jjx-1)*desc_X[
LLD_]], &desc_X[
LLD_],
459 &iyrow, &iycol, &ixrow, &ixcol, buff+np );