21 int * M,
int * N,
float * ALPHA,
22 float * A,
int * IA,
int * JA,
int * DESCA,
23 float * B,
int * IB,
int * JB,
int * DESCB )
25 void pctrsm_( SIDE, UPLO, TRANS, DIAG, M, N, ALPHA,
26 A, IA, JA, DESCA, B, IB, JB, DESCB )
31 int * IA, * IB, * JA, * JB, * M, * N;
242 char DiagA, DirB, OpC, OpR, SideOp, TopC, TopR, TranOp, UploA,
243 Var, ctop, ctopsave, rtop, rtopsave;
244 int Ai, Aj, Bi, Bj, ChooseAB, ForceTop, ctxt, info, itmp, lside,
245 mycol, myrow, nb, notran, nounit, npcol, nprow, upper;
246 double ABestL, ABestR, Best, tmp1, tmp2, tmp3, tmp4;
267 if( !( info = ( ( nprow == -1 ) ? -( 1101 +
CTXT_ ) : 0 ) ) )
269 if( ( !lside ) && ( SideOp !=
CRIGHT ) )
271 PB_Cwarn( ctxt, __LINE__,
"PCTRSM",
"Illegal SIDE = %c\n", SideOp );
274 else if( ( !upper ) && ( UploA !=
CLOWER ) )
276 PB_Cwarn( ctxt, __LINE__,
"PCTRSM",
"Illegal UPLO = %c\n", UploA );
279 else if( ( !notran ) && ( TranOp !=
CTRAN ) && ( TranOp !=
CCOTRAN ) )
281 PB_Cwarn( ctxt, __LINE__,
"PCTRSM",
"Illegal TRANS = %c\n", TranOp );
284 else if( ( !nounit ) && ( DiagA !=
CUNIT ) )
286 PB_Cwarn( ctxt, __LINE__,
"PCTRSM",
"Illegal DIAG = %c\n", DiagA );
290 PB_Cchkmat( ctxt,
"PCTRSM",
"A", *M, 5, *M, 5, Ai, Aj, Ad, 11,
293 PB_Cchkmat( ctxt,
"PCTRSM",
"A", *N, 6, *N, 6, Ai, Aj, Ad, 11,
295 PB_Cchkmat( ctxt,
"PCTRSM",
"B", *M, 5, *N, 6, Bi, Bj, Bd, 15,
298 if( info ) {
PB_Cabort( ctxt,
"PCTRSM", info );
return; }
303 if( *M == 0 || *N == 0 )
return;
314 ((
char *) B), Bi, Bj, Bd );
339 ABestR = (double)(*M) *
340 ( ( ( ( Ad[
CSRC_] == -1 ) || ( npcol == 1 ) ) ?
ZERO : tmp1 /
TWO ) +
341 ( ( ( Bd[
RSRC_] == -1 ) || ( nprow == 1 ) ) ?
ZERO : tmp4 ) );
343 Best = (double)(*N) *
344 ( (double)(
CEIL( *M, itmp )) * (
double)(itmp) *
345 ( ( ( Ad[
RSRC_] == -1 ) || ( nprow == 1 ) ) ?
ZERO :
ONE ) +
346 ( ( ( Ad[
CSRC_] == -1 ) || ( npcol == 1 ) ) ?
ZERO :
ONE ) );
347 ChooseAB = ( ABestR <= ( 2.0 * Best ) );
353 ABestL = (double)(*M) *
354 ( ( ( ( Ad[
CSRC_] == -1 ) || ( npcol == 1 ) ) ?
ZERO : tmp1 /
TWO ) +
356 ( ( ( Bd[
RSRC_] == -1 ) || ( nprow == 1 ) ) ?
ZERO : tmp4 ) );
357 ABestR = (double)(*M) *
358 ( ( ( ( Ad[
CSRC_] == -1 ) || ( npcol == 1 ) ) ?
ZERO : tmp1 /
TWO ) +
359 ( ( ( Bd[
RSRC_] == -1 ) || ( nprow == 1 ) ) ?
ZERO : tmp4 ) +
360 MAX( tmp2, tmp1 ) /
TWO );
363 Best = (double)(*N) *
364 ( (double)(
CEIL( *M, itmp )) * (
double)(itmp) *
365 ( ( ( ( Ad[
RSRC_] == -1 ) || ( nprow == 1 ) ) ?
ZERO :
ONE ) +
366 ( ( ( Ad[
CSRC_] == -1 ) || ( npcol == 1 ) ) ?
ZERO :
ONE ) ) +
368 ChooseAB = ( ( ABestL <= ( 2.0 * Best ) ) ||
369 ( ABestR <= ( 2.0 * Best ) ) );
377 ABestR = (double)(*N) *
378 ( ( ( ( Ad[
RSRC_] == -1 ) || ( nprow == 1 ) ) ?
ZERO : tmp2 /
TWO ) +
379 ( ( ( Bd[
CSRC_] == -1 ) || ( npcol == 1 ) ) ?
ZERO : tmp3 ) );
381 Best = (double)(*M) *
382 ( (double)(
CEIL( *N, itmp )) * (
double)(itmp) *
383 ( ( ( Ad[
RSRC_] == -1 ) || ( nprow == 1 ) ) ?
ZERO :
ONE ) +
384 ( ( ( Ad[
CSRC_] == -1 ) || ( npcol == 1 ) ) ?
ZERO :
ONE ) );
385 ChooseAB = ( ABestR <= ( 2.0 * Best ) );
391 ABestL = (double)(*N) *
392 ( ( ( ( Ad[
RSRC_] == -1 ) || ( nprow == 1 ) ) ?
ZERO : tmp2 /
TWO ) +
394 ( ( ( Bd[
CSRC_] == -1 ) || ( npcol == 1 ) ) ?
ZERO : tmp3 ) );
395 ABestR = (double)(*N) *
396 ( ( ( ( Ad[
RSRC_] == -1 ) || ( nprow == 1 ) ) ?
ZERO : tmp2 /
TWO ) +
397 ( ( ( Bd[
CSRC_] == -1 ) || ( npcol == 1 ) ) ?
ZERO : tmp3 ) +
398 MAX( tmp2, tmp1 ) /
TWO );
401 Best = (double)(*M) *
402 ( (double)(
CEIL( *N, itmp )) * (
double)(itmp) *
403 ( ( ( ( Ad[
RSRC_] == -1 ) || ( nprow == 1 ) ) ?
ZERO :
ONE ) +
404 ( ( ( Ad[
CSRC_] == -1 ) || ( npcol == 1 ) ) ?
ZERO :
ONE ) ) +
406 ChooseAB = ( ( ABestL <= ( 2.0 * Best ) ) ||
407 ( ABestR <= ( 2.0 * Best ) ) );
427 ForceTop = ( ( *M > nb ) && ( *N > nb ) );
441 if( ABestL <= ABestR )
465 if( ABestL <= ABestR )
483 if( ( rtopsave = rtop ) != TopR )
485 if( ( ctopsave = ctop ) != TopC )
497 PB_CptrsmAB( type, &Var, &SideOp, &UploA, &TranOp, &DiagA, *M, *N,
498 ((
char *)ALPHA), ((
char *)A), Ai, Aj, Ad, ((
char *)B),
505 rtopsave = *
PB_Ctop( &ctxt, &OpR,
ROW, &rtopsave );
514 if( ( lside && notran ) || ( !lside && !notran ) )
540 if( ( rtopsave = rtop ) != TopR )
542 if( ( ctopsave = ctop ) != TopC )
548 PB_CptrsmB( type, &DirB, &SideOp, &UploA, &TranOp, &DiagA, *M, *N,
549 ((
char *)ALPHA), ((
char *)A), Ai, Aj, Ad, ((
char *)B),
554 rtopsave = *
PB_Ctop( &ctxt, &OpR,
ROW, &rtopsave );