14 #include "../PBpblas.h"
15 #include "../PBtools.h"
16 #include "../PBblacs.h"
17 #include "../PBblas.h"
22 char * A,
int IA,
int JA,
int * DESCA,
char * AROC,
24 char * B,
int IB,
int JB,
int * DESCB,
char * BROC )
26 void PB_CpaxpbyNN(
TYPE, CONJUG, M, N, ALPHA, A, IA, JA, DESCA, AROC,
27 BETA, B, IB, JB, DESCB, BROC )
31 char * AROC, * BROC, * CONJUG;
32 int IA, IB, JA, JB, M, N;
217 int Acol, Aii, AisR, AisRow, Ajj, Ald, AmyprocD, AmyprocR,
218 AnprocsD, AnprocsR, AprocR, Arow, Bcol, Bii, BisR, BisRow,
219 Bjj, Bld, BmyprocD, BmyprocR, BnprocsD, BnprocsR, BprocR,
220 Brow, RRorCC, csrc, ctxt, iroca, mycol, myrow, npcol, nprow,
238 PB_Cinfog2l( IA, JA, DESCA, nprow, npcol, myrow, mycol, &Aii, &Ajj,
240 if( ( AisRow = (
Mupcase( AROC[0] ) ==
CROW ) ) != 0 )
242 Ald = DESCA[
LLD_]; AmyprocD = mycol; AnprocsD = npcol;
243 AprocR = Arow; AmyprocR = myrow; AnprocsR = nprow;
244 AisR = ( ( Arow == -1 ) || ( AnprocsR == 1 ) );
248 Ald = DESCA[
LLD_]; AmyprocD = myrow; AnprocsD = nprow;
249 AprocR = Acol; AmyprocR = mycol; AnprocsR = npcol;
250 AisR = ( ( Acol == -1 ) || ( AnprocsR == 1 ) );
255 PB_Cinfog2l( IB, JB, DESCB, nprow, npcol, myrow, mycol, &Bii, &Bjj,
257 if( ( BisRow = (
Mupcase( BROC[0] ) ==
CROW ) ) != 0 )
259 Bld = DESCB[
LLD_]; BmyprocD = mycol; BnprocsD = npcol;
260 BprocR = Brow; BmyprocR = myrow; BnprocsR = nprow;
261 BisR = ( ( Brow == -1 ) || ( BnprocsR == 1 ) );
265 Bld = DESCB[
LLD_]; BmyprocD = myrow; BnprocsD = nprow;
266 BprocR = Bcol; BmyprocR = mycol; BnprocsR = npcol;
267 BisR = ( ( Bcol == -1 ) || ( BnprocsR == 1 ) );
272 RRorCC = ( ( AisRow && BisRow ) || ( !( AisRow ) && !( BisRow ) ) );
286 if( ( AmyprocR != AprocR ) && ( BmyprocR != BprocR ) )
300 else add =
TYPE->Fmmadd;
302 if( AprocR == BprocR )
304 add( &M, &N, ALPHA,
Mptr( A, Aii, Ajj, Ald, size ), &Ald, BETA,
305 Mptr( B, Bii, Bjj, Bld, size ), &Bld );
312 if( AmyprocR == AprocR )
318 TYPE->Cgesd2d( ctxt, M, N,
Mptr( A, Aii, Ajj, Ald, size ),
319 Ald, BprocR, AmyprocD );
321 TYPE->Cgesd2d( ctxt, M, N,
Mptr( A, Aii, Ajj, Ald, size ),
322 Ald, AmyprocD, BprocR );
327 if( BmyprocR == BprocR )
331 TYPE->Cgerv2d( ctxt, M, N, buf, M, AprocR, BmyprocD );
333 TYPE->Cgerv2d( ctxt, M, N, buf, M, BmyprocD, AprocR );
334 add( &M, &N, ALPHA, buf, &M, BETA,
Mptr( B, Bii, Bjj, Bld,
336 if( buf ) free( buf );
346 else add =
TYPE->Fmmtadd;
349 for( p = 0; p < BnprocsD; p++ )
351 if( ( AprocR == p ) && ( BprocR == iroca ) )
353 if( ( AmyprocR == p ) && ( AmyprocD == iroca ) )
355 add( &M, &N, ALPHA,
Mptr( A, Aii, Ajj, Ald, size ), &Ald,
356 BETA,
Mptr( B, Bii, Bjj, Bld, size ), &Bld );
361 if( ( AmyprocR == AprocR ) && ( AmyprocD == iroca ) )
364 TYPE->Cgesd2d( ctxt, M, N,
Mptr( A, Aii, Ajj, Ald,
365 size ), Ald, p, BprocR );
367 TYPE->Cgesd2d( ctxt, M, N,
Mptr( A, Aii, Ajj, Ald,
368 size ), Ald, BprocR, p );
370 if( ( BmyprocR == BprocR ) && ( BmyprocD == p ) )
374 TYPE->Cgerv2d( ctxt, M, N, buf, M, AprocR, iroca );
376 TYPE->Cgerv2d( ctxt, M, N, buf, M, iroca, AprocR );
377 add( &M, &N, ALPHA, buf, &M, BETA,
Mptr( B, Bii, Bjj, Bld,
379 if( buf ) free( buf );
382 iroca =
MModAdd1( iroca, AnprocsD );
393 if( AmyprocR == AprocR )
398 TYPE->Fmmcadd( &M, &N, ALPHA,
Mptr( A, Aii, Ajj, Ald, size ),
399 &Ald, BETA,
Mptr( B, Bii, Bjj, Bld, size ),
402 TYPE->Fmmadd( &M, &N, ALPHA,
Mptr( A, Aii, Ajj, Ald, size ),
403 &Ald, BETA,
Mptr( B, Bii, Bjj, Bld, size ),
409 TYPE->Fmmtcadd( &M, &N, ALPHA,
Mptr( A, Aii, Ajj, Ald, size ),
410 &Ald, BETA,
Mptr( B, Bii, Bjj, Bld, size ),
413 TYPE->Fmmtadd( &M, &N, ALPHA,
Mptr( A, Aii, Ajj, Ald, size ),
414 &Ald, BETA,
Mptr( B, Bii, Bjj, Bld, size ),
417 if( AisRow ) { scope =
CCOLUMN; }
else { scope =
CROW; }
420 TYPE->Cgebs2d( ctxt, &scope, top, M, N,
Mptr( B, Bii, Bjj, Bld,
423 TYPE->Cgebs2d( ctxt, &scope, top, N, M,
Mptr( B, Bii, Bjj, Bld,
428 if( AisRow ) { scope =
CCOLUMN; rsrc = AprocR; csrc = AmyprocD; }
429 else { scope =
CROW; rsrc = AmyprocD; csrc = AprocR; }
432 TYPE->Cgebr2d( ctxt, &scope, top, M, N,
Mptr( B, Bii, Bjj, Bld,
433 size ), Bld, rsrc, csrc );
435 TYPE->Cgebr2d( ctxt, &scope, top, N, M,
Mptr( B, Bii, Bjj, Bld,
436 size ), Bld, rsrc, csrc );
445 if( BisR || ( BmyprocR == BprocR ) )
454 TYPE->Fmmcadd( &M, &N, ALPHA,
Mptr( A, Aii, Ajj, Ald, size ),
455 &Ald, BETA,
Mptr( B, Bii, Bjj, Bld, size ),
458 TYPE->Fmmadd( &M, &N, ALPHA,
Mptr( A, Aii, Ajj, Ald, size ),
459 &Ald, BETA,
Mptr( B, Bii, Bjj, Bld, size ), &Bld );
464 TYPE->Fmmtcadd( &M, &N, ALPHA,
Mptr( A, Aii, Ajj, Ald, size ),
465 &Ald, BETA,
Mptr( B, Bii, Bjj, Bld, size ),
468 TYPE->Fmmtadd( &M, &N, ALPHA,
Mptr( A, Aii, Ajj, Ald, size ),
469 &Ald, BETA,
Mptr( B, Bii, Bjj, Bld, size ),