14 #include "../PBpblas.h"
15 #include "../PBtools.h"
16 #include "../PBblacs.h"
17 #include "../PBblas.h"
21 int N,
int * DESCA,
int K,
char * X,
int IX,
int JX,
22 int * DESCX,
char * XROC,
char * XAPTR,
int IJXA,
25 void PB_CInV2(
TYPE, CONJUG, ROWCOL, M, N, DESCA, K, X, IX, JX, DESCX,
26 XROC, XAPTR, IJXA, DXA )
30 char * CONJUG, * ROWCOL, * XROC;
31 int IJXA, IX, JX, K, M, N;
36 int * DESCA, * DESCX, * DXA;
197 char * Xptr = NULL, * top;
198 int AColSpan, ARowSpan, Acol, Aimb, Ainb, AisD, Amb, Amp, Anb,
199 Anq, Arow, XAld, Xcol, Xii, Ximb1, Xinb1, XisD, XisR, XisRow,
200 Xjj, Xld=1, Xmb, Xnb, Xrow, ctxt, mycol, myrow, npcol, nprow,
209 if( ( M <= 0 ) || ( N <= 0 ) || ( K <= 0 ) )
return;
217 Minfog2l( IX, JX, DESCX, nprow, npcol, myrow, mycol, Xii, Xjj, Xrow, Xcol );
221 if( ( XisRow = (
Mupcase( XROC[0] ) ==
CROW ) ) != 0 )
223 XisD = ( ( Xcol >= 0 ) && ( npcol > 1 ) );
224 XisR = ( ( Xrow == -1 ) || ( nprow == 1 ) );
228 XisD = ( ( Xrow >= 0 ) && ( nprow > 1 ) );
229 XisR = ( ( Xcol == -1 ) || ( npcol == 1 ) );
242 AisD = ( ( Acol >= 0 ) && ( npcol > 1 ) );
243 Ainb = DESCA[
INB_]; Anb = DESCA[
NB_]; Xnb = DESCX[
NB_];
251 if( ( !AisD && !XisD ) ||
252 ( ( AisD && XisD ) &&
253 ( ( Acol == Xcol ) &&
254 ( ( ( Ainb >= N ) && ( Xinb1 >= N ) ) ||
255 ( ( Ainb == Xinb1 ) && ( Anb == Xnb ) ) ) ) ) )
261 ARowSpan = ( Arow < 0 ) ||
264 Mnumroc( Anq, N, 0, Ainb, Anb, mycol, Acol, npcol );
266 if( XisR || ( !ARowSpan && ( Arow == Xrow ) ) )
273 if( ( Anq > 0 ) && ( ARowSpan || ( myrow == Arow ) ) )
275 size =
TYPE->size; Xld = DESCX[
LLD_ ]; XAld = DXA[
LLD_];
276 TYPE->Fmmadd( &K, &Anq,
TYPE->one,
Mptr( X, Xii, Xjj, Xld,
277 size ), &Xld,
TYPE->zero,
Mptr( XAPTR, IJXA,
278 0, XAld, size ), &XAld );
294 Xptr =
Mptr( XAPTR, IJXA, 0, XAld, size );
295 TYPE->Fmmadd( &K, &Anq,
TYPE->one,
Mptr( X, Xii, Xjj, Xld,
296 size ), &Xld,
TYPE->zero, Xptr, &XAld );
297 TYPE->Cgebs2d( ctxt,
COLUMN, top, K, Anq, Xptr, XAld );
307 IJXA, 0, XAld,
TYPE->size ), XAld, Xrow,
323 TYPE->Cgesd2d( ctxt, K, Anq,
Mptr( X, Xii, Xjj, Xld,
324 TYPE->size ), Xld, Arow, mycol );
327 else if( myrow == Arow )
332 TYPE->Cgerv2d( ctxt, K, Anq,
Mptr( XAPTR, IJXA, 0, XAld,
333 TYPE->size ), XAld, Xrow, mycol );
345 PB_Cpaxpby(
TYPE, CONJUG, K, N,
TYPE->one, X, IX, JX, DESCX, XROC,
346 TYPE->zero, XAPTR, IJXA, 0, DXA,
ROW );
350 PB_Cpaxpby(
TYPE, CONJUG, N, K,
TYPE->one, X, IX, JX, DESCX, XROC,
351 TYPE->zero, XAPTR, IJXA, 0, DXA,
ROW );
362 AisD = ( ( Arow >= 0 ) && ( nprow > 1 ) );
363 Aimb = DESCA[
IMB_]; Amb = DESCA[
MB_]; Xmb = DESCX[
MB_];
371 if( ( !AisD && !XisD ) ||
372 ( ( AisD && XisD ) &&
373 ( ( Arow == Xrow ) &&
374 ( ( ( Aimb >= M ) && ( Ximb1 >= M ) ) ||
375 ( ( Aimb == Ximb1 ) && ( Amb == Xmb ) ) ) ) ) )
381 AColSpan = ( Acol < 0 ) ||
384 Mnumroc( Amp, M, 0, Aimb, Amb, myrow, Arow, nprow );
386 if( XisR || ( !AColSpan && ( Acol == Xcol ) ) )
393 if( ( Amp > 0 ) && ( AColSpan || ( mycol == Acol ) ) )
395 size =
TYPE->size; Xld = DESCX[
LLD_ ]; XAld = DXA[
LLD_];
396 TYPE->Fmmadd( &Amp, &K,
TYPE->one,
Mptr( X, Xii, Xjj, Xld,
397 size ), &Xld,
TYPE->zero,
Mptr( XAPTR, 0, IJXA,
398 XAld, size ), &XAld );
414 Xptr =
Mptr( XAPTR, 0, IJXA, XAld, size );
415 TYPE->Fmmadd( &Amp, &K,
TYPE->one,
Mptr( X, Xii, Xjj, Xld,
416 size ), &Xld,
TYPE->zero, Xptr, &XAld );
417 TYPE->Cgebs2d( ctxt,
ROW, top, Amp, K, Xptr, XAld );
426 TYPE->Cgebr2d( ctxt,
ROW, top, Amp, K,
Mptr( XAPTR, 0,
427 IJXA, XAld,
TYPE->size ), XAld, myrow,
443 TYPE->Cgesd2d( ctxt, Amp, K,
Mptr( X, Xii, Xjj, Xld,
444 TYPE->size ), Xld, myrow, Acol );
447 else if( mycol == Acol )
452 TYPE->Cgerv2d( ctxt, Amp, K,
Mptr( XAPTR, 0, IJXA, XAld,
453 TYPE->size ), XAld, myrow, Xcol );
465 PB_Cpaxpby(
TYPE, CONJUG, K, M,
TYPE->one, X, IX, JX, DESCX, XROC,
470 PB_Cpaxpby(
TYPE, CONJUG, M, K,
TYPE->one, X, IX, JX, DESCX, XROC,