14 #include "../PBpblas.h"
15 #include "../PBtools.h"
16 #include "../PBblacs.h"
17 #include "../PBblas.h"
22 char * Y,
int IY,
int JY,
int * DESCY,
char * YROC,
23 char * * TBETA,
char * * YAPTR,
int * DYA,
24 int * YAFREE,
int * YASUM,
int * YAPBY )
27 BETA, Y, IY, JY, DESCY, YROC,
28 TBETA, YAPTR, DYA, YAFREE, YASUM, YAPBY )
32 char * BETA, * ROWCOL, * * TBETA, * YROC;
33 int * YAPBY, * YAFREE, IY, JY, K, M, N, * YASUM;
38 int * DESCA, * DESCY, * DYA;
228 int Acol, Aimb, Ainb, AisD, AisR, Amb, Amp, Anb, Anq, Arow, Ycol,
229 Yii, Yimb, Yimb1, Yinb, Yinb1, YisD, YisR, YisRow, Yjj, Yld,
230 Ymb, Ymp, Ynb, Ynq, Yrow, ctxt, izero=0, nprow, myrow, npcol,
247 if( ( M <= 0 ) || ( N <= 0 ) || ( K <= 0 ) )
268 Minfog2l( IY, JY, DESCY, nprow, npcol, myrow, mycol, Yii, Yjj, Yrow, Ycol );
272 if( ( YisRow = (
Mupcase( YROC[0] ) ==
CROW ) ) != 0 )
274 YisD = ( ( Ycol >= 0 ) && ( npcol > 1 ) );
275 YisR = ( ( Yrow == -1 ) || ( nprow == 1 ) );
279 YisD = ( ( Yrow >= 0 ) && ( nprow > 1 ) );
280 YisR = ( ( Ycol == -1 ) || ( npcol == 1 ) );
283 Aimb = DESCA[
IMB_ ]; Ainb = DESCA[
INB_ ];
284 Amb = DESCA[
MB_ ]; Anb = DESCA[
NB_ ];
292 AisR = ( ( Arow < 0 ) || ( nprow == 1 ) );
299 AisD = ( ( Acol >= 0 ) && ( npcol > 1 ) );
301 Yinb = DESCY[
INB_]; Ynb = DESCY[
NB_];
302 Mfirstnb( Yinb1, N, JY, Yinb, Ynb );
309 if( ( !AisD && !YisD ) ||
310 ( ( AisD && YisD ) &&
311 ( ( Acol == Ycol ) &&
312 ( ( ( Ainb >= N ) && ( Yinb1 >= N ) ) ||
313 ( ( Ainb == Yinb1 ) && ( Anb == Ynb ) ) ) ) ) )
315 Mnumroc( Ynq, N, 0, Yinb1, Ynb, mycol, Ycol, npcol );
316 Ymp = ( YisR ? K : ( ( myrow == Yrow ) ? K : 0 ) );
327 *YAPTR =
Mptr( Y, Yii, Yjj, Yld,
TYPE->size );
344 *TBETA = ( ( myrow == Arow ) ? BETA :
TYPE->zero );
345 *YASUM = ( nprow > 1 );
350 Mnumroc( Amp, M, 0, Aimb, Amb, myrow, Arow, nprow );
372 DESCA[
RSRC_ ] = Yrow;
373 if( ( Ynq > 0 ) && ( Ymp > 0 ) )
374 *YAPTR =
Mptr( Y, Yii, Yjj, Yld,
TYPE->size );
378 if(
Mspan( M, 0, Aimb, Amb, Arow, nprow ) )
384 *YASUM = ( nprow > 1 );
397 *YAPTR =
Mptr( Y, Yii, Yjj, Yld,
TYPE->size );
398 Mnumroc( Amp, M, 0, Aimb, Amb, myrow, Arow, nprow );
401 *TBETA, *YAPTR, &Yld );
416 &K, &Ynq, &izero, *TBETA, *TBETA,
435 if( ( myrow == Yrow ) && ( Ynq > 0 ) )
436 *YAPTR =
Mptr( Y, Yii, Yjj, Yld,
TYPE->size );
458 &izero, *TBETA, *TBETA, *YAPTR,
471 MDescSet( DYA, K, N, K, Yinb1, 1, Ynb, Yrow, Ycol, ctxt, Yld );
481 Mnumroc( Anq, N, 0, Ainb, Anb, mycol, Acol, npcol );
492 *YASUM = ( AisR ? 0 : ( nprow > 1 ) );
499 &izero, *TBETA, *TBETA, *YAPTR, &Yld );
526 DESCA[
RSRC_] = Arow = 0;
528 if( ( myrow == Arow ) && ( Anq > 0 ) )
533 &izero, *TBETA, *TBETA, *YAPTR, &Yld );
538 if(
Mspan( M, 0, Aimb, Amb, Arow, nprow ) )
544 *YASUM = ( nprow > 1 );
550 &izero, *TBETA, *TBETA, *YAPTR, &K );
560 if( ( myrow == Arow ) && ( Anq > 0 ) )
565 &izero, *TBETA, *TBETA, *YAPTR, &K );
575 MDescSet( DYA, K, N, K, Ainb, 1, Anb, Arow, Acol, ctxt, Yld );
582 AisR = ( ( Acol < 0 ) || ( npcol == 1 ) );
589 AisD = ( ( Arow >= 0 ) && ( nprow > 1 ) );
591 Yimb = DESCY[
IMB_]; Ymb = DESCY[
MB_];
592 Mfirstnb( Yimb1, M, IY, Yimb, Ymb );
599 if( ( !AisD && !YisD ) ||
600 ( ( AisD && YisD ) &&
601 ( ( Arow == Yrow ) &&
602 ( ( ( Aimb >= M ) && ( Yimb1 >= M ) ) ||
603 ( ( Aimb == Yimb1 ) && ( Amb == Ymb ) ) ) ) ) )
605 Mnumroc( Ymp, M, 0, Yimb1, Ymb, myrow, Yrow, nprow );
606 Ynq = ( YisR ? K : ( ( mycol == Ycol ) ? K : 0 ) );
617 *YAPTR =
Mptr( Y, Yii, Yjj, Yld,
TYPE->size );
634 *TBETA = ( ( mycol == Acol ) ? BETA :
TYPE->zero );
635 *YASUM = ( npcol > 1 );
640 Mnumroc( Anq, N, 0, Ainb, Anb, mycol, Acol, npcol );
662 DESCA[
CSRC_ ] = Ycol;
663 if( ( Ymp > 0 ) && ( Ynq > 0 ) )
664 *YAPTR =
Mptr( Y, Yii, Yjj, Yld,
TYPE->size );
668 if(
Mspan( N, 0, Ainb, Anb, Acol, npcol ) )
674 *YASUM = ( npcol > 1 );
687 *YAPTR =
Mptr( Y, Yii, Yjj, Yld,
TYPE->size );
688 Mnumroc( Anq, N, 0, Ainb, Anb, mycol, Acol, npcol );
691 *TBETA, *YAPTR, &Yld );
706 &Ymp, &K, &izero, *TBETA, *TBETA,
725 if( ( mycol == Ycol ) && ( Ymp > 0 ) )
726 *YAPTR =
Mptr( Y, Yii, Yjj, Yld,
TYPE->size );
739 Yld =
MAX( 1, Ymp ) ;
748 &izero, *TBETA, *TBETA, *YAPTR,
761 MDescSet( DYA, M, K, Yimb1, K, Ymb, 1, Yrow, Ycol, ctxt, Yld );
771 Mnumroc( Amp, M, 0, Aimb, Amb, myrow, Arow, nprow );
782 *YASUM = ( AisR ? 0 : ( npcol > 1 ) );
789 &izero, *TBETA, *TBETA, *YAPTR, &Yld );
808 DESCA[
CSRC_ ] = Acol = 0;
818 if( ( mycol == Acol ) && ( Amp > 0 ) )
823 &izero, *TBETA, *TBETA, *YAPTR, &Yld );
828 if(
Mspan( N, 0, Ainb, Anb, Acol, npcol ) )
834 *YASUM = ( npcol > 1 );
840 &izero, *TBETA, *TBETA, *YAPTR, &Yld );
850 if( ( mycol == Acol ) && ( Amp > 0 ) )
855 &izero, *TBETA, *TBETA, *YAPTR, &Yld );
865 MDescSet( DYA, M, K, Aimb, K, Amb, 1, Arow, Acol, ctxt, Yld );