SCALAPACK 2.2.2
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches

◆ PB_Cplaprn2()

void PB_Cplaprn2 ( PBTYP_T TYPE,
Int  M,
Int  N,
char *  A,
Int  IA,
Int  JA,
Int DESCA,
Int  IRPRNT,
Int  ICPRNT,
char *  CMATNM,
Int  PROW,
Int  PCOL 
)

Definition at line 246 of file PB_Cplaprnt.c.

259{
260/*
261* .. Local Scalars ..
262*/
263 char type;
264 Int Acol, Aii, AisColRep, AisRowRep, Ajj, Ald, Arow, ctxt, h, i,
265 ib, icurcol, icurrow, ii, in, j, jb, jj, jn, ldw, mycol,
266 myrow, npcol, nprow, size, usiz;
267/*
268* .. Local Arrays ..
269*/
270 char * buf = NULL;
271/* ..
272* .. Executable Statements ..
273*
274*/
275/*
276* Retrieve process grid information
277*/
278 Cblacs_gridinfo( ( ctxt = DESCA[CTXT_] ), &nprow, &npcol, &myrow, &mycol );
279/*
280* Retrieve sub( A )'s local information: Aii, Ajj, Arow, Acol ...
281*/
282 Ald = DESCA[LLD_];
283 PB_Cinfog2l( IA, JA, DESCA, nprow, npcol, myrow, mycol, &Aii, &Ajj, &Arow,
284 &Acol );
285/*
286* Save the local first index of each row and column sub( A )
287*/
288 ii = Aii;
289 jj = Ajj;
290/*
291* When sub( A ) is row-replicated, print the copy in process row PROW.
292* Otherwise, print the distributed matrix rows starting in process row Arow.
293*/
294 if( Arow < 0 ) { AisRowRep = 1; icurrow = Arow = PROW; }
295 else { AisRowRep = 0; icurrow = Arow; }
296/*
297* When sub( A ) is column-replicated, print the copy in process column PCOL.
298* Otherwise, print the distributed matrix columns starting in process column
299* Acol.
300*/
301 if( Acol < 0 ) { AisColRep = 1; icurcol = Acol = PCOL; }
302 else { AisColRep = 0; icurcol = Acol; }
303
304 type = TYPE->type; usiz = TYPE->usiz; size = TYPE->size;
305/*
306* Allocate buffer in printing process
307*/
308 ldw = MAX( DESCA[ IMB_ ], DESCA[ MB_ ] );
309 if( ( myrow == IRPRNT ) && ( mycol == ICPRNT ) )
310 buf = PB_Cmalloc( ldw * size );
311/*
312* Handle the first block of column separately
313*/
314 jb = PB_Cfirstnb( N, JA, DESCA[INB_], DESCA[NB_] );
315 jn = JA + jb - 1;
316
317 for( h = 0; h < jb; h++ )
318 {
319 ib = PB_Cfirstnb( M, IA, DESCA[IMB_], DESCA[MB_] );
320 in = IA + ib - 1;
321
322 if( ( icurrow == IRPRNT ) && ( icurcol == ICPRNT ) )
323 {
324 if( ( myrow == IRPRNT ) && ( mycol == ICPRNT ) )
325 {
326 PB_Cprnt( type, size, usiz, ib, Mptr( A, ii, jj+h, Ald, size ),
327 IA+1, JA+h+1, CMATNM );
328 }
329 }
330 else
331 {
332 if( ( myrow == icurrow ) && ( mycol == icurcol ) )
333 {
334 TYPE->Cgesd2d( ctxt, ib, 1, Mptr( A, ii, jj+h, Ald, size ), Ald,
335 IRPRNT, ICPRNT );
336 }
337 else if( ( myrow == IRPRNT ) && ( mycol == ICPRNT ) )
338 {
339 TYPE->Cgerv2d( ctxt, ib, 1, buf, ldw, icurrow, icurcol );
340 PB_Cprnt( type, size, usiz, ib, buf, IA+1, JA+h+1, CMATNM );
341 }
342 }
343/*
344* Go to next block of rows
345*/
346 if( myrow == icurrow ) ii += ib;
347 if( !( AisRowRep ) ) icurrow = MModAdd1( icurrow, nprow );
348
349 Cblacs_barrier( ctxt, ALL );
350/*
351* Loop over remaining block of rows
352*/
353 for( i = in+1; i <= IA+M-1; i += DESCA[MB_] )
354 {
355 ib = MIN( DESCA[MB_], IA+M-i );
356 if( ( icurrow == IRPRNT ) && ( icurcol == ICPRNT ) )
357 {
358 if( ( myrow == IRPRNT ) && ( mycol == ICPRNT ) )
359 {
360 PB_Cprnt( type, size, usiz, ib, Mptr( A, ii, jj+h, Ald, size ),
361 i+1, JA+h+1, CMATNM );
362 }
363 }
364 else
365 {
366 if( ( myrow == icurrow ) && ( mycol == icurcol ) )
367 {
368 TYPE->Cgesd2d( ctxt, ib, 1, Mptr( A, ii, jj+h, Ald, size ), Ald,
369 IRPRNT, ICPRNT );
370 }
371 else if( ( myrow == IRPRNT ) && ( mycol == ICPRNT ) )
372 {
373 TYPE->Cgerv2d( ctxt, ib, 1, buf, ldw, icurrow, icurcol );
374 PB_Cprnt( type, size, usiz, ib, buf, i+1, JA+h+1, CMATNM);
375 }
376 }
377/*
378* Go to next block of rows
379*/
380 if( myrow == icurrow ) ii += ib;
381 if( !( AisRowRep ) ) icurrow = MModAdd1( icurrow, nprow );
382
383 Cblacs_barrier( ctxt, ALL );
384 }
385/*
386* Restart at the first row to be printed
387*/
388 ii = Aii;
389 icurrow = Arow;
390 }
391/*
392* Go to next block of columns
393*/
394 if( mycol == icurcol ) jj += jb;
395 if( !( AisColRep ) ) icurcol = MModAdd1( icurcol, npcol );
396
397 Cblacs_barrier( ctxt, ALL );
398/*
399* Loop over remaining column blocks
400*/
401 for( j = jn+1; j <= JA+N-1; j += DESCA[NB_] )
402 {
403 jb = MIN( DESCA[NB_], JA+N-j );
404 for( h = 0; h < jb; h++ )
405 {
406 ib = PB_Cfirstnb( M, IA, DESCA[IMB_], DESCA[MB_] );
407 in = IA + ib - 1;
408
409 if( ( icurrow == IRPRNT ) && ( icurcol == ICPRNT ) )
410 {
411 if( ( myrow == IRPRNT ) && ( mycol == ICPRNT ) )
412 {
413 PB_Cprnt( type, size, usiz, ib, Mptr( A, ii, jj+h, Ald, size ),
414 IA+1, j+h+1, CMATNM );
415 }
416 }
417 else
418 {
419 if( ( myrow == icurrow ) && ( mycol == icurcol ) )
420 {
421 TYPE->Cgesd2d( ctxt, ib, 1, Mptr( A, ii, jj+h, Ald, size ), Ald,
422 IRPRNT, ICPRNT );
423 }
424 else if( ( myrow == IRPRNT ) && ( mycol == ICPRNT ) )
425 {
426 TYPE->Cgerv2d( ctxt, ib, 1, buf, ldw, icurrow, icurcol );
427 PB_Cprnt( type, size, usiz, ib, buf, IA+1, j+h+1, CMATNM );
428 }
429 }
430/*
431* Go to next block of rows
432*/
433 if( myrow == icurrow ) ii += ib;
434 if( !( AisRowRep ) ) icurrow = MModAdd1( icurrow, nprow );
435
436 Cblacs_barrier( ctxt, ALL );
437/*
438* Loop over remaining block of rows
439*/
440 for( i = in+1; i <= IA+M-1; i += DESCA[MB_] )
441 {
442 ib = MIN( DESCA[MB_], IA+M-i );
443 if( ( icurrow == IRPRNT ) && ( icurcol == ICPRNT ) )
444 {
445 if( ( myrow == IRPRNT ) && ( mycol == ICPRNT ) )
446 {
447 PB_Cprnt( type, size, usiz, ib, Mptr( A, ii, jj+h, Ald,
448 size ), i+1, j+h+1, CMATNM );
449 }
450 }
451 else
452 {
453 if( ( myrow == icurrow ) && ( mycol == icurcol ) )
454 {
455 TYPE->Cgesd2d( ctxt, ib, 1, Mptr( A, ii, jj+h, Ald, size ),
456 Ald, IRPRNT, ICPRNT );
457 }
458 else if( ( myrow == IRPRNT ) && ( mycol == ICPRNT ) )
459 {
460 TYPE->Cgerv2d( ctxt, ib, 1, buf, ldw, icurrow, icurcol );
461 PB_Cprnt( type, size, usiz, ib, buf, i+1, j+h+1, CMATNM );
462 }
463 }
464/*
465* Go to next block of rows
466*/
467 if( myrow == icurrow ) ii += ib;
468 if( !( AisRowRep ) ) icurrow = MModAdd1( icurrow, nprow );
469
470 Cblacs_barrier( ctxt, ALL );
471 }
472/*
473* Restart at the first row to be printed
474*/
475 ii = Aii;
476 icurrow = Arow;
477 }
478/*
479* Go to next block of columns
480*/
481 if( mycol == icurcol ) jj += jb;
482 if( !( AisColRep ) ) icurcol = MModAdd1( icurcol, npcol );
483
484 Cblacs_barrier( ctxt, ALL );
485 }
486
487 if( ( myrow == IRPRNT ) && ( mycol == ICPRNT ) && ( buf ) ) free( buf );
488/*
489* End of PB_Cplaprn2
490*/
491}
#define Int
Definition Bconfig.h:22
void Cblacs_barrier()
void Cblacs_gridinfo()
#define ALL
Definition PBblas.h:50
#define CTXT_
Definition PBtools.h:38
Int PB_Cfirstnb()
#define MAX(a_, b_)
Definition PBtools.h:77
#define MB_
Definition PBtools.h:43
char * PB_Cmalloc()
void PB_Cinfog2l()
#define MIN(a_, b_)
Definition PBtools.h:76
#define Mptr(a_, i_, j_, lda_, siz_)
Definition PBtools.h:132
#define LLD_
Definition PBtools.h:47
#define MModAdd1(I, d)
Definition PBtools.h:100
#define INB_
Definition PBtools.h:42
#define IMB_
Definition PBtools.h:41
#define NB_
Definition PBtools.h:44
void PB_Cprnt()
#define TYPE
Definition clamov.c:7
Here is the call graph for this function: