20 void pcamax_(
int * N,
float * AMAX,
int * INDX,
21 float * X,
int * IX,
int * JX,
int * DESCX,
int * INCX )
23 void pcamax_( N, AMAX, INDX, X, IX, JX, DESCX, INCX )
27 int * INCX, * INDX, * IX, * JX, * N;
183 char cbtop, cctop, rbtop, rctop;
184 int Xcol, Xgindx, Xi, Xii, Ximb, Xinb, Xj, Xjj, Xlindx, Xld, Xmb,
185 Xnb, Xnp, Xnq, Xrow, Xsrc, ctxt, dist, dst, idumm, info, k,
186 maxpos, mycol, mydist, myrow, npcol, nprow, src, size;
204 if( !( info = ( ( nprow == -1 ) ? -( 701 +
CTXT_ ) : 0 ) ) )
205 PB_Cchkvec( ctxt,
"PCAMAX",
"X", *N, 1, Xi, Xj, Xd, *INCX, 7, &info );
206 if( info ) {
PB_Cabort( ctxt,
"PCAMAX", info );
return; }
215 if( *N == 0 )
return;
225 PB_Cinfog2l( Xi, Xj, Xd, nprow, npcol, myrow, mycol, &Xii, &Xjj,
230 if( ( *INCX == 1 ) && ( Xd[
M_] == 1 ) && ( *N == 1 ) )
235 if( ( ( myrow == Xrow ) || ( Xrow < 0 ) ) &&
236 ( ( mycol == Xcol ) || ( Xcol < 0 ) ) )
240 Xptr =
Mptr( ((
char *) X), Xii, Xjj, Xd[
LLD_], type->
size );
246 else if( *INCX == Xd[
M_] )
251 if( ( myrow == Xrow ) || ( Xrow < 0 ) )
261 Xnq =
PB_Cnumroc( *N, Xj, Xinb, Xnb, mycol, Xsrc, npcol );
272 Mindxl2g( Xgindx, Xlindx, Xinb, Xnb, mycol, Xsrc, npcol );
273 Xptr =
Mptr( ((
char *) X), Xii, Xlindx, Xld, size );
276 work[1][
REAL_PART] = ((float )( Xgindx+1 ));
290 if( ( npcol >= 2 ) && ( Xcol >= 0 ) )
297 dist = k * ( mydist - 1 );
299 Ccgesd2d( ctxt, 2, 1, ((
char*)work), 2, myrow, dst );
309 Ccgerv2d( ctxt, 2, 1, ((
char*) work[2]), 2, myrow,
325 if( k < npcol )
goto l_10;
334 Ccgebs2d( ctxt,
ROW, &rbtop, 2, 1, ((
char*)work), 2 );
338 Ccgebr2d( ctxt,
ROW, &rbtop, 2, 1, ((
char*)work), 2,
350 ( *JX ) : ( (int)(work[1][
REAL_PART]) ) );
358 Xnq =
PB_Cnumroc( *N, Xj, Xinb, Xnb, mycol, Xsrc, npcol );
372 Xptr =
Mptr( ((
char *) X), Xii, Xlindx, Xld, size );
388 Ccgamx2d( ctxt,
ROW, &rctop, 1, 1, ((
char*)AMAX), 1,
389 &idumm, &maxpos, 1, -1, mycol );
396 if( mycol == maxpos )
398 Mindxl2g( Xgindx, Xlindx, Xinb, Xnb, mycol, Xsrc, npcol );
400 Cigebs2d( ctxt,
ROW, &rbtop, 1, 1, ((
char*)INDX), 1 );
404 Cigebr2d( ctxt,
ROW, &rbtop, 1, 1, ((
char*)INDX), 1,
423 ( *JX ) : Xlindx + 1 );
434 if( ( mycol == Xcol ) || ( Xcol < 0 ) )
444 Xnp =
PB_Cnumroc( *N, Xi, Ximb, Xmb, myrow, Xsrc, nprow );
455 Mindxl2g( Xgindx, Xlindx, Ximb, Xmb, myrow, Xsrc, nprow );
456 Xptr =
Mptr( ((
char *) X), Xlindx, Xjj, Xld, size );
459 work[1][
REAL_PART] = ((float )( Xgindx+1 ));
473 if( ( nprow >= 2 ) && ( Xrow >= 0 ) )
480 dist = k * ( mydist - 1 );
482 Ccgesd2d( ctxt, 2, 1, ((
char*)work), 2, dst, mycol );
492 Ccgerv2d( ctxt, 2, 1, ((
char*) work[2]), 2,
508 if( k < nprow )
goto l_30;
533 ( *IX ) : ( (int)(work[1][
REAL_PART]) ) );
541 Xnp =
PB_Cnumroc( *N, Xi, Ximb, Xmb, myrow, Xsrc, nprow );
556 Xptr =
Mptr( ((
char *) X), Xlindx, Xjj, Xld, size );
573 &maxpos, &idumm, 1, -1, mycol );
580 if( myrow == maxpos )
582 Mindxl2g( Xgindx, Xlindx, Ximb, Xmb, myrow, Xsrc, nprow );
607 ( *IX ) : Xlindx + 1 );