20 void psamax_(
int * N,
float * AMAX,
int * INDX,
21 float * X,
int * IX,
int * JX,
int * DESCX,
int * INCX )
23 void psamax_( 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;
202 if( !( info = ( ( nprow == -1 ) ? -( 701 +
CTXT_ ) : 0 ) ) )
203 PB_Cchkvec( ctxt,
"PSAMAX",
"X", *N, 1, Xi, Xj, Xd, *INCX, 7, &info );
204 if( info ) {
PB_Cabort( ctxt,
"PSAMAX", info );
return; }
209 *INDX = 0; *AMAX =
ZERO;
213 if( *N == 0 )
return;
223 PB_Cinfog2l( Xi, Xj, Xd, nprow, npcol, myrow, mycol, &Xii, &Xjj,
228 if( ( *INCX == 1 ) && ( Xd[
M_] == 1 ) && ( *N == 1 ) )
233 if( ( ( myrow == Xrow ) || ( Xrow < 0 ) ) &&
234 ( ( mycol == Xcol ) || ( Xcol < 0 ) ) )
236 *INDX = *JX; *AMAX = X[Xii+Xjj*Xd[
LLD_]];
240 else if( *INCX == Xd[
M_] )
245 if( ( myrow == Xrow ) || ( Xrow < 0 ) )
255 Xnq =
PB_Cnumroc( *N, Xj, Xinb, Xnb, mycol, Xsrc, npcol );
263 isamax_( &Xnq, ((
char*)(X+(Xii+Xjj*Xld))), &Xld );
264 Mindxl2g( Xgindx, Xlindx, Xinb, Xnb, mycol, Xsrc, npcol );
265 work[0] = X[Xii+Xlindx*Xld];
266 work[1] = ((float )( Xgindx+1 ));
277 if( ( npcol >= 2 ) && ( Xcol >= 0 ) )
284 dist = k * ( mydist - 1 );
286 Csgesd2d( ctxt, 2, 1, ((
char*)work), 2, myrow, dst );
296 Csgerv2d( ctxt, 2, 1, ((
char*) &work[2]), 2, myrow,
298 if(
ABS( work[0] ) <
ABS( work[2] ) )
299 { work[0] = work[2]; work[1] = work[3]; }
305 if( k < npcol )
goto l_10;
314 Csgebs2d( ctxt,
ROW, &rbtop, 2, 1, ((
char*)work), 2 );
318 Csgebr2d( ctxt,
ROW, &rbtop, 2, 1, ((
char*)work), 2,
327 *INDX = ( ( *AMAX ==
ZERO ) ? ( *JX ) : ( (int)(work[1]) ) );
335 Xnq =
PB_Cnumroc( *N, Xj, Xinb, Xnb, mycol, Xsrc, npcol );
346 isamax_( &Xnq, ((
char*)(X+(Xii+Xjj*Xld))), &Xld );
347 *AMAX = X[Xii+Xlindx*Xld];
360 Csgamx2d( ctxt,
ROW, &rctop, 1, 1, ((
char*)AMAX), 1,
361 &idumm, &maxpos, 1, -1, mycol );
368 if( mycol == maxpos )
370 Mindxl2g( Xgindx, Xlindx, Xinb, Xnb, mycol, Xsrc, npcol );
372 Cigebs2d( ctxt,
ROW, &rbtop, 1, 1, ((
char*)INDX), 1 );
376 Cigebr2d( ctxt,
ROW, &rbtop, 1, 1, ((
char*)INDX), 1,
393 *INDX = ( ( *AMAX ==
ZERO ) ? ( *JX ) : Xlindx + 1 );
404 if( ( mycol == Xcol ) || ( Xcol < 0 ) )
414 Xnp =
PB_Cnumroc( *N, Xi, Ximb, Xmb, myrow, Xsrc, nprow );
422 isamax_( &Xnp, ((
char*)(X+(Xii+Xjj*Xld))), INCX );
423 Mindxl2g( Xgindx, Xlindx, Ximb, Xmb, myrow, Xsrc, nprow );
424 work[0] = X[Xlindx+Xjj*Xld];
425 work[1] = ((float )( Xgindx+1 ));
436 if( ( nprow >= 2 ) && ( Xrow >= 0 ) )
443 dist = k * ( mydist - 1 );
445 Csgesd2d( ctxt, 2, 1, ((
char*)work), 2, dst, mycol );
455 Csgerv2d( ctxt, 2, 1, ((
char*) &work[2]), 2,
457 if(
ABS( work[0] ) <
ABS( work[2] ) )
458 { work[0] = work[2]; work[1] = work[3]; }
464 if( k < nprow )
goto l_30;
486 *INDX = ( ( *AMAX ==
ZERO ) ? ( *IX ) : ( (int)(work[1]) ) );
494 Xnp =
PB_Cnumroc( *N, Xi, Ximb, Xmb, myrow, Xsrc, nprow );
506 isamax_( &Xnp, ((
char*)(X+(Xii+Xjj*Xld))), INCX );
507 *AMAX = X[Xlindx+Xjj*Xld];
521 &maxpos, &idumm, 1, -1, mycol );
528 if( myrow == maxpos )
530 Mindxl2g( Xgindx, Xlindx, Ximb, Xmb, myrow, Xsrc, nprow );
553 *INDX = ( ( *AMAX ==
ZERO ) ? ( *IX ) : Xlindx + 1 );