21 int * M,
int * N,
int * K,
23 double * A,
int * IA,
int * JA,
int * DESCA,
24 double * B,
int * IB,
int * JB,
int * DESCB,
26 double * C,
int * IC,
int * JC,
int * DESCC )
28 void pdgemm_( TRANSA, TRANSB, M, N, K, ALPHA, A, IA, JA, DESCA,
29 B, IB, JB, DESCB, BETA, C, IC, JC, DESCC )
34 int * IA, * IB, * IC, * JA, * JB, * JC, * K, * M, * N;
35 double * ALPHA, * BETA;
39 int * DESCA, * DESCB, * DESCC;
245 char DirAB, DirBC, OpC, OpR, TrA, TrB, ctop, ctopsave, rtop,
247 int Ai, Aj, Bi, Bj, ChooseAB, ChooseBC, Ci, Cj, ForceTop, ctxt,
248 info, mycol, myrow, nb, nota, notb, npcol, nprow;
249 double ABest, ACest, BCest, tmp1, tmp2, tmp3, tmp4;
270 if( !( info = ( ( nprow == -1 ) ? -( 1001 +
CTXT_ ) : 0 ) ) )
272 if( ( !nota ) && ( TrA !=
CTRAN ) && ( TrA !=
CCOTRAN ) )
274 PB_Cwarn( ctxt, __LINE__,
"PDGEMM",
"Illegal TRANSA = %c\n", TrA );
277 else if( ( !notb ) && ( TrB !=
CTRAN ) && ( TrB !=
CCOTRAN ) )
279 PB_Cwarn( ctxt, __LINE__,
"PDGEMM",
"Illegal TRANSB = %c\n", TrB );
283 PB_Cchkmat( ctxt,
"PDGEMM",
"A", *M, 3, *K, 5, Ai, Aj, Ad, 10,
286 PB_Cchkmat( ctxt,
"PDGEMM",
"A", *K, 5, *M, 3, Ai, Aj, Ad, 10,
289 PB_Cchkmat( ctxt,
"PDGEMM",
"B", *K, 5, *N, 4, Bi, Bj, Bd, 14,
292 PB_Cchkmat( ctxt,
"PDGEMM",
"B", *N, 4, *K, 5, Bi, Bj, Bd, 14,
294 PB_Cchkmat( ctxt,
"PDGEMM",
"C", *M, 3, *N, 4, Ci, Cj, Cd, 19,
297 if( info ) {
PB_Cabort( ctxt,
"PDGEMM", info );
return; }
302 if( ( *M == 0 ) || ( *N == 0 ) ||
318 ((
char * ) C), Ci, Cj, Cd );
323 ((
char * ) C), Ci, Cj, Cd );
341 ABest = (double)(*K);
342 ACest = (double)(*M);
343 BCest = (double)(*N);
350 ABest *= ( ( ( Ad[
CSRC_] == -1 ) || ( npcol == 1 ) ) ?
ZERO : tmp1 ) +
351 ( ( ( Bd[
RSRC_] == -1 ) || ( nprow == 1 ) ) ?
ZERO : tmp2 );
355 ACest *= ( npcol == 1 ?
ZERO : tmp1 ) +
MAX( tmp1, tmp3 ) +
361 ( nprow == 1 ?
ZERO : tmp2 ) +
MAX( tmp2, tmp4 );
367 ABest *= ( npcol == 1 ?
ZERO : tmp1 ) +
MAX( tmp1, tmp3 ) +
368 ( nprow == 1 ?
ZERO : tmp2 );
371 ACest *= ( ( ( Ad[
CSRC_] == -1 ) || ( npcol == 1 ) ) ?
ZERO : tmp1 ) +
373 ( ( ( Bd[
RSRC_] == -1 ) || ( nprow == 1 ) ) ?
ZERO : tmp2 );
377 BCest *= ( ( ( Bd[
CSRC_] == -1 ) || ( npcol == 1 ) ) ?
ZERO : tmp1 ) +
387 ABest *= ( npcol == 1 ?
ZERO : tmp1 ) +
388 ( nprow == 1 ?
ZERO : tmp2 ) +
MAX( tmp2, tmp4 );
392 ACest *=
CBRATIO * ( npcol == 1 ?
ZERO : tmp1 ) +
MAX( tmp1, tmp3 ) +
393 ( ( ( Ad[
RSRC_] == -1 ) || ( nprow == 1 ) ) ?
ZERO : tmp2 );
397 ( ( ( Ad[
CSRC_] == -1 ) || ( npcol == 1 ) ) ?
ZERO : tmp1 ) +
398 ( ( ( Bd[
RSRC_] == -1 ) || ( nprow == 1 ) ) ?
ZERO : tmp2 );
404 ABest *= ( npcol == 1 ?
ZERO : tmp1 ) +
MAX( tmp1, tmp3 ) +
405 ( nprow == 1 ?
ZERO : tmp2 ) +
MAX( tmp2, tmp4 );
409 ACest *=
CBRATIO * ( npcol == 1 ?
ZERO : tmp1 ) +
MAX( tmp1, tmp3 ) +
410 ( nprow == 1 ?
ZERO : tmp2 ) +
MAX( tmp2, tmp4 );
414 BCest *= ( npcol == 1 ?
ZERO : tmp1 ) +
MAX( tmp1, tmp3 ) +
418 ChooseAB = ( ( ABest <= ( 1.3 * BCest ) ) && ( ABest <= ( 1.3 * ACest ) ) );
419 ChooseBC = ( ( BCest <= ACest ) && ( ( 1.3 * BCest ) <= ABest ) );
426 ForceTop = ( ( *M > nb ) && ( *N > nb ) && ( *K > nb ) );
477 NOTRAN :
TRAN ), *M, *N, *K, ((
char *)ALPHA), ((
char *)A),
478 Ai, Aj, Ad, ((
char *)B), Bi, Bj, Bd, ((
char *)BETA),
479 ((
char *)C), Ci, Cj, Cd );
484 NOTRAN :
TRAN ), *M, *N, *K, ((
char *)ALPHA), ((
char *)A),
485 Ai, Aj, Ad, ((
char *)B), Bi, Bj, Bd, ((
char *)BETA),
486 ((
char *)C), Ci, Cj, Cd );
491 NOTRAN :
TRAN ), *M, *N, *K, ((
char *)ALPHA), ((
char *)A),
492 Ai, Aj, Ad, ((
char *)B), Bi, Bj, Bd, ((
char *)BETA),
493 ((
char *)C), Ci, Cj, Cd );
500 rtopsave = *
PB_Ctop( &ctxt, &OpR,
ROW, &rtopsave );