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_CpdotNN(
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, XisR, XisRow, Xjj, Xld, Xlinc, XmyprocD,
223 XmyprocR, XnprocsR, XprocR, Xrow, Ycol, Yii, YisR, YisRow,
224 Yjj, Yld, Ylinc, YmyprocD, YmyprocR, YnprocsR, YprocR, Yrow,
225 csrc, ctxt, ione=1, mycol, myrow, npcol, nprow, rsrc, size;
241 PB_Cinfog2l( IX, JX, DESCX, nprow, npcol, myrow, mycol, &Xii, &Xjj,
243 if( ( XisRow = ( INCX == DESCX[
M_] ) ) != 0 )
245 Xld = DESCX[
LLD_]; Xlinc = Xld;
246 XmyprocD = mycol; XprocR = Xrow; XmyprocR = myrow; XnprocsR = nprow;
247 XisR = ( ( Xrow == -1 ) || ( XnprocsR == 1 ) );
251 Xld = DESCX[
LLD_]; Xlinc = 1;
252 XmyprocD = myrow; XprocR = Xcol; XmyprocR = mycol; XnprocsR = npcol;
253 XisR = ( ( Xcol == -1 ) || ( XnprocsR == 1 ) );
258 PB_Cinfog2l( IY, JY, DESCY, nprow, npcol, myrow, mycol, &Yii, &Yjj,
260 if( ( YisRow = ( INCY == DESCY[
M_] ) ) != 0 )
262 Yld = DESCY[
LLD_]; Ylinc = Yld;
263 YmyprocD = mycol; YprocR = Yrow; YmyprocR = myrow; YnprocsR = nprow;
264 YisR = ( ( Yrow == -1 ) || ( YnprocsR == 1 ) );
268 Yld = DESCY[
LLD_]; Ylinc = 1;
269 YmyprocD = myrow; YprocR = Ycol; YmyprocR = mycol; YnprocsR = npcol;
270 YisR = ( ( Ycol == -1 ) || ( YnprocsR == 1 ) );
275 RRorCC = ( ( XisRow && YisRow ) || ( !( XisRow ) && !( YisRow ) ) );
289 if( ( XmyprocR != XprocR ) && ( YmyprocR != YprocR ) )
302 if( XprocR == YprocR )
307 FDOT( &N, DOT,
Mptr( X, Xii, Xjj, Xld, size ), &Xlinc,
Mptr( Y,
308 Yii, Yjj, Yld, size ), &Ylinc );
315 if( XmyprocR == XprocR )
324 TYPE->Cgesd2d( ctxt, 1, N,
Mptr( X, Xii, Xjj, Xld, size ),
325 Xld, YprocR, XmyprocD );
326 TYPE->Cgerv2d( ctxt, 1, N, buf, 1, YprocR, XmyprocD );
330 TYPE->Cgesd2d( ctxt, N, 1,
Mptr( X, Xii, Xjj, Xld, size ),
331 Xld, XmyprocD, YprocR );
332 TYPE->Cgerv2d( ctxt, N, 1, buf, N, XmyprocD, YprocR );
334 FDOT( &N, DOT,
Mptr( X, Xii, Xjj, Xld, size ), &Xlinc, buf,
336 if( buf ) free( buf );
339 if( YmyprocR == YprocR )
348 TYPE->Cgesd2d( ctxt, 1, N,
Mptr( Y, Yii, Yjj, Yld, size ),
349 Yld, XprocR, YmyprocD );
350 TYPE->Cgerv2d( ctxt, 1, N, buf, 1, XprocR, YmyprocD );
354 TYPE->Cgesd2d( ctxt, N, 1,
Mptr( Y, Yii, Yjj, Yld, size ),
355 Yld, YmyprocD, XprocR );
356 TYPE->Cgerv2d( ctxt, N, 1, buf, N, YmyprocD, XprocR );
358 FDOT( &N, DOT, buf, &ione,
Mptr( Y, Yii, Yjj, Yld, size ),
360 if( buf ) free( buf );
369 if( ( XmyprocR == XprocR ) && ( YmyprocR == YprocR ) )
375 FDOT( &N, DOT,
Mptr( X, Xii, Xjj, Xld, size ), &Xlinc,
Mptr( Y,
376 Yii, Yjj, Yld, size ), &Ylinc );
378 TYPE->Cgebs2d( ctxt,
ROW, top, 1, 1, DOT, 1 );
380 TYPE->Cgebs2d( ctxt,
COLUMN, top, 1, 1, DOT, 1 );
382 else if( XmyprocR == XprocR )
384 if( XisRow ) { Xscope =
CROW; rsrc = XprocR; csrc = YprocR; }
385 else { Xscope =
CCOLUMN; rsrc = YprocR; csrc = XprocR; }
387 TYPE->Cgebr2d( ctxt, &Xscope, top, 1, 1, DOT, 1, rsrc, csrc );
389 else if( YmyprocR == YprocR )
391 if( YisRow ) { Yscope =
CROW; rsrc = YprocR; csrc = XprocR; }
392 else { Yscope =
CCOLUMN; rsrc = XprocR; csrc = YprocR; }
394 TYPE->Cgebr2d( ctxt, &Yscope, top, 1, 1, DOT, 1, rsrc, csrc );
403 if( XmyprocR == XprocR )
411 FDOT( &N, DOT,
Mptr( X, Xii, Xjj, Xld, size ), &Xlinc,
Mptr( Y, Yii,
412 Yjj, Yld, size ), &Ylinc );
417 TYPE->Cgebs2d( ctxt,
COLUMN, top, 1, 1, DOT, 1 );
422 TYPE->Cgebs2d( ctxt,
ROW, top, 1, 1, DOT, 1 );
433 TYPE->Cgebr2d( ctxt,
COLUMN, top, 1, 1, DOT, 1, XprocR,
439 TYPE->Cgebr2d( ctxt,
ROW, top, 1, 1, DOT, 1, XmyprocD,
450 if( YisR || ( YmyprocR == YprocR ) )
457 FDOT( &N, DOT,
Mptr( X, Xii, Xjj, Xld, size ), &Xlinc,
Mptr( Y, Yii,
458 Yjj, Yld, size ), &Ylinc );
471 if( YmyprocR == YprocR )
472 TYPE->Cgebs2d( ctxt,
COLUMN, top, 1, 1, DOT, 1 );
474 TYPE->Cgebr2d( ctxt,
COLUMN, top, 1, 1, DOT, 1, YprocR,
480 if( YmyprocR == YprocR )
481 TYPE->Cgebs2d( ctxt,
ROW, top, 1, 1, DOT, 1 );
483 TYPE->Cgebr2d( ctxt,
ROW, top, 1, 1, DOT, 1, YmyprocD, YprocR );