14 #include "../PBpblas.h"
15 #include "../PBtools.h"
16 #include "../PBblacs.h"
17 #include "../PBblas.h"
21 int N,
char * ALPHA,
char * BETA,
char * A,
int IA,
24 void PB_Cplapad(
TYPE, UPLO, CONJUG, M, N, ALPHA, BETA, A, IA, JA,
29 char * CONJUG, * UPLO;
183 int Acol, Aii, Aimb1, Ainb1, Ajj, Akp, Akq, Ald, Amb, Amp, Amp0,
184 Anb, Anq, Anq0, Arow, ctxt, izero=0, k, kb, ktmp, mn, mycol,
185 myrow, nb, npcol, nprow, size;
199 if( ( M <= 0 ) || ( N <= 0 ) )
return;
207 PB_Cdescribe( M, N, IA, JA, DESCA, nprow, npcol, myrow, mycol, &Aii, &Ajj,
208 &Ald, &Aimb1, &Ainb1, &Amb, &Anb, &Arow, &Acol, Ad0 );
212 Amp =
PB_Cnumroc( M, 0, Aimb1, Amb, myrow, Arow, nprow );
213 Anq =
PB_Cnumroc( N, 0, Ainb1, Anb, mycol, Acol, npcol );
214 if( ( Amp <= 0 ) || ( Anq <= 0 ) )
return;
216 size =
TYPE->size; type =
TYPE->type; pad =
TYPE->Ftzpad;
217 Aptr =
Mptr( A, Aii, Ajj, Ald, size );
227 ( ( ( Arow < 0 ) || ( nprow == 1 ) ) &&
228 ( ( Acol < 0 ) || ( npcol == 1 ) ) ) )
235 else if( type ==
DREAL )
240 ( ( ( Arow < 0 ) || ( nprow == 1 ) ) &&
241 ( ( Acol < 0 ) || ( npcol == 1 ) ) ) )
248 else if( type ==
SCPLX )
255 ( ( ( Arow < 0 ) || ( nprow == 1 ) ) &&
256 ( ( Acol < 0 ) || ( npcol == 1 ) ) ) )
263 else if( type ==
DCPLX )
270 ( ( ( Arow < 0 ) || ( nprow == 1 ) ) &&
271 ( ( Acol < 0 ) || ( npcol == 1 ) ) ) )
284 PB_Clcm( ( Arow >= 0 ? nprow : 1 ), ( Acol >= 0 ? npcol : 1 ) );
295 for( k = 0; k < mn; k += nb )
297 kb = mn - k; ktmp = k + ( kb =
MIN( kb, nb ) );
298 PB_Cplapd2(
TYPE, UPLO, CONJUG, kb, kb, ALPHA, BETA, Aptr, k, k, Ad0 );
299 Akp =
PB_Cnumroc( ktmp, 0, Aimb1, Amb, myrow, Arow, nprow );
300 Akq =
PB_Cnumroc( k, 0, Ainb1, Anb, mycol, Acol, npcol );
301 Anq0 =
PB_Cnumroc( kb, k, Ainb1, Anb, mycol, Acol, npcol );
302 if( ( Amp0 = Amp - Akp ) > 0 )
304 ALPHA, ALPHA,
Mptr( Aptr, Akp, Akq, Ald, size ), &Ald );
315 for( k = 0; k < mn; k += nb )
317 kb = mn - k; kb =
MIN( kb, nb );
318 Akp =
PB_Cnumroc( k, 0, Aimb1, Amb, myrow, Arow, nprow );
319 Akq =
PB_Cnumroc( k, 0, Ainb1, Anb, mycol, Acol, npcol );
320 Anq0 =
PB_Cnumroc( kb, k, Ainb1, Anb, mycol, Acol, npcol );
323 ALPHA, ALPHA,
Mptr( Aptr, 0, Akq, Ald, size ), &Ald );
324 PB_Cplapd2(
TYPE, UPLO, CONJUG, kb, kb, ALPHA, BETA, Aptr, k, k, Ad0 );
326 if( ( Anq -= ( Akq += Anq0 ) ) > 0 )
328 ALPHA,
Mptr( Aptr, 0, Akq, Ald, size ), &Ald );
338 for( k = 0; k < mn; k += nb )
340 kb = mn - k; kb =
MIN( kb, nb );
341 Akp =
PB_Cnumroc( k, 0, Aimb1, Amb, myrow, Arow, nprow );
342 Akq =
PB_Cnumroc( k, 0, Ainb1, Anb, mycol, Acol, npcol );
343 Anq0 =
PB_Cnumroc( kb, k, Ainb1, Anb, mycol, Acol, npcol );
346 ALPHA, ALPHA,
Mptr( Aptr, 0, Akq, Ald, size ), &Ald );
347 PB_Cplapd2(
TYPE, UPLO,
NOCONJG, kb, kb, ALPHA, BETA, Aptr, k, k,
349 Akp =
PB_Cnumroc( k+kb, 0, Aimb1, Amb, myrow, Arow, nprow );
350 if( ( Amp0 = Amp - Akp ) > 0 )
352 ALPHA, ALPHA,
Mptr( Aptr, Akp, Akq, Ald, size ), &Ald );
354 if( ( Anq -= ( Akq += Anq0 ) ) > 0 )
356 ALPHA,
Mptr( Aptr, 0, Akq, Ald, size ), &Ald );