14 #include "../PBpblas.h"
15 #include "../PBtools.h"
16 #include "../PBblacs.h"
17 #include "../PBblas.h"
21 char * X,
int IX,
int JX,
int * DESCX,
int INCX,
22 char * Y,
int IY,
int JY,
int * DESCY,
int INCY,
25 void PB_Cpdot11(
TYPE, N, DOT, X, IX, JX, DESCX, INCX, Y, IY, JY, DESCY,
30 int INCX, INCY, IX, IY, JX, JY, N;
221 char Xscope, Yscope, * top;
222 int RRorCC, Xcol, Xii, XisD, XisOne, XisR, XisRow, Xjj, Xld,
223 Xlinc, XmyprocD, XmyprocR, XprocD, XprocR, Xrow, Ycol, Yii,
224 YisD, YisOne, YisR, YisRow, Yjj, YmyprocD, YmyprocR, YprocD,
225 YprocR, Yrow, cdst, ctxt, ione=1, mycol, myrow, npcol, nprow,
243 PB_Cinfog2l( IX, JX, DESCX, nprow, npcol, myrow, mycol, &Xii, &Xjj,
245 if( ( XisRow = ( INCX == DESCX[
M_ ] ) ) != 0 )
247 Xld = DESCX[
LLD_ ]; Xlinc = Xld;
248 XprocD = Xcol; XmyprocD = mycol; XprocR = Xrow; XmyprocR = myrow;
249 XisR = ( ( Xrow == -1 ) || ( nprow == 1 ) );
250 XisD = ( ( Xcol >= 0 ) && ( npcol > 1 ) );
254 Xld = DESCX[
LLD_ ]; Xlinc = 1;
255 XprocD = Xrow; XmyprocD = myrow; XprocR = Xcol; XmyprocR = mycol;
256 XisR = ( ( Xcol == -1 ) || ( npcol == 1 ) );
257 XisD = ( ( Xrow >= 0 ) && ( nprow > 1 ) );
259 XisOne = ( ( N == 1 ) && ( DESCX[
M_ ] == 1 ) );
263 PB_Cinfog2l( IY, JY, DESCY, nprow, npcol, myrow, mycol, &Yii, &Yjj,
265 if( ( YisRow = ( INCY == DESCY[
M_ ] ) ) != 0 )
267 YprocD = Ycol; YmyprocD = mycol; YprocR = Yrow; YmyprocR = myrow;
268 YisR = ( ( Yrow == -1 ) || ( nprow == 1 ) );
269 YisD = ( ( Ycol >= 0 ) && ( npcol > 1 ) );
273 YprocD = Yrow; YmyprocD = myrow; YprocR = Ycol; YmyprocR = mycol;
274 YisR = ( ( Ycol == -1 ) || ( npcol == 1 ) );
275 YisD = ( ( Yrow >= 0 ) && ( nprow > 1 ) );
277 YisOne = ( ( N == 1 ) && ( DESCY[
M_ ] == 1 ) );
281 RRorCC = ( ( XisRow && YisRow ) || ( !( XisRow ) && !( YisRow ) ) );
285 PB_Cdescset( dbuf, 1, 1, 1, 1, 1, 1, Xrow, Xcol, ctxt, 1 );
293 if( XisR || ( XmyprocR == XprocR ) )
295 if( ( XisD && ( XmyprocD == XprocD ) ) || ( !XisD ) )
296 FDOT( &ione, DOT,
Mptr( X, Xii, Xjj, Xld,
TYPE->size ), &Xlinc, buf,
298 if( XisD && !XisOne )
302 TYPE->Cgsum2d( ctxt, &Xscope, top, 1, 1, DOT, 1, -1, 0 );
305 if( buf ) free( buf );
324 if( YisR || YmyprocR == YprocR )
334 if( XprocD != YprocD )
336 if( XmyprocD == XprocD )
337 TYPE->Cgesd2d( ctxt, 1, 1, DOT, 1, XmyprocR, YprocD );
338 else if( YmyprocD == YprocD )
339 TYPE->Cgerv2d( ctxt, 1, 1, DOT, 1, XmyprocR, XprocD );
348 if( XmyprocD == XprocD )
349 TYPE->Cgebs2d( ctxt,
ROW, top, 1, 1, DOT, 1 );
351 TYPE->Cgebr2d( ctxt,
ROW, top, 1, 1, DOT, 1, XmyprocR,
367 if( XmyprocD == XprocD )
368 TYPE->Cgebs2d( ctxt,
ROW, top, 1, 1, DOT, 1 );
370 TYPE->Cgebr2d( ctxt,
ROW, top, 1, 1, DOT, 1, XmyprocR,
373 else if( XprocD != YprocR )
378 if( XmyprocD == XprocD )
379 TYPE->Cgesd2d( ctxt, 1, 1, DOT, 1, XmyprocR, YprocR );
380 if( YmyprocR == YprocR )
381 TYPE->Cgerv2d( ctxt, 1, 1, DOT, 1, XmyprocR, XprocD );
396 if( ( XprocD != YprocD ) || ( !YisR && ( XprocR != YprocR ) ) )
402 rdst = ( YisR ? XprocR : YprocR );
403 if( ( XmyprocR == XprocR ) && ( XmyprocD == XprocD ) )
404 TYPE->Cgesd2d( ctxt, 1, 1, DOT, 1, rdst, YprocD );
405 if( ( YmyprocR == rdst ) && ( YmyprocD == YprocD ) )
406 TYPE->Cgerv2d( ctxt, 1, 1, DOT, 1, XprocR, XprocD );
409 if( YisR && ( YmyprocD == YprocD ) )
415 if( XmyprocR == XprocR )
416 TYPE->Cgebs2d( ctxt,
COLUMN, top, 1, 1, DOT, 1 );
418 TYPE->Cgebr2d( ctxt,
COLUMN, top, 1, 1, DOT, 1, XprocR,
427 if( YisRow ) { Yscope =
CROW; rdst = YprocR; cdst = XprocD; }
428 else { Yscope =
CCOLUMN; rdst = XprocR; cdst = YprocR; }
435 if( ( RRorCC && ( XprocR != YprocR ) ) ||
436 ( !( RRorCC ) && ( XprocD != YprocR ) ) )
438 if( ( XmyprocR == XprocR ) && ( XmyprocD == XprocD ) )
439 TYPE->Cgesd2d( ctxt, 1, 1, DOT, 1, rdst, cdst );
440 if( ( myrow == rdst ) && ( mycol == cdst ) )
441 TYPE->Cgerv2d( ctxt, 1, 1, DOT, 1, XprocR, XprocD );
446 if( ( myrow == rdst ) && ( mycol == cdst ) )
449 TYPE->Cgebs2d( ctxt, &Yscope, top, 1, 1, DOT, 1 );
451 else if( ( YisRow && ( myrow == rdst ) ) ||
452 ( !( YisRow ) && ( mycol == cdst ) ) )
455 TYPE->Cgebr2d( ctxt, &Yscope, top, 1, 1, DOT, 1, rdst, cdst );
464 if( ( XmyprocR == XprocR ) && ( XmyprocD == XprocD ) )
466 TYPE->Cgebs2d( ctxt,
ALL, top, 1, 1, DOT, 1 );
470 TYPE->Cgebr2d( ctxt,
ALL, top, 1, 1, DOT, 1, XprocR, XprocD );
488 if( YisD && YisOne && ( YmyprocD != YprocD ) )
return;
498 if( XmyprocR == XprocR )
499 TYPE->Cgebs2d( ctxt,
COLUMN, top, 1, 1, DOT, 1 );
501 TYPE->Cgebr2d( ctxt,
COLUMN, top, 1, 1, DOT, 1, XprocR,
507 if( XmyprocR == XprocR )
508 TYPE->Cgebs2d( ctxt,
ROW, top, 1, 1, DOT, 1 );
510 TYPE->Cgebr2d( ctxt,
ROW, top, 1, 1, DOT, 1, XmyprocD,
514 else if( XprocR != YprocR )
521 if( XmyprocR == XprocR )
522 TYPE->Cgesd2d( ctxt, 1, 1, DOT, 1, YprocR, YmyprocD );
523 if( YmyprocR == YprocR )
524 TYPE->Cgerv2d( ctxt, 1, 1, DOT, 1, XprocR, XmyprocD );
528 if( XmyprocR == XprocR )
529 TYPE->Cgesd2d( ctxt, 1, 1, DOT, 1, YmyprocD, YprocR );
530 if( YmyprocR == YprocR )
531 TYPE->Cgerv2d( ctxt, 1, 1, DOT, 1, XmyprocD, XprocR );
543 if( XisRow || !( YisD ) || ( YisD && !( YisOne ) ) )
545 if( YisR || YmyprocR == YprocR )
550 if( XmyprocR == XprocR )
551 TYPE->Cgebs2d( ctxt,
COLUMN, top, 1, 1, DOT, 1 );
553 TYPE->Cgebr2d( ctxt,
COLUMN, top, 1, 1, DOT, 1, XprocR,
559 if( XmyprocR == XprocR )
560 TYPE->Cgebs2d( ctxt,
ROW, top, 1, 1, DOT, 1 );
562 TYPE->Cgebr2d( ctxt,
ROW, top, 1, 1, DOT, 1, XmyprocD,
567 else if( XprocR != YprocD )
574 if( YisR || YmyprocR == YprocR )
576 if( XmyprocR == XprocR )
578 TYPE->Cgesd2d( ctxt, 1, 1, DOT, 1, YmyprocR, YprocD );
580 if( YmyprocD == YprocD )
582 TYPE->Cgerv2d( ctxt, 1, 1, DOT, 1, YmyprocR, XprocR );