ScaLAPACK 2.1  2.1
ScaLAPACK: Scalable Linear Algebra PACKage
PB_Cindxg2p.c
Go to the documentation of this file.
1 /* ---------------------------------------------------------------------
2 *
3 * -- PBLAS auxiliary routine (version 2.0) --
4 * University of Tennessee, Knoxville, Oak Ridge National Laboratory,
5 * and University of California, Berkeley.
6 * April 1, 1998
7 *
8 * ---------------------------------------------------------------------
9 */
10 /*
11 * Include files
12 */
13 #include "../pblas.h"
14 #include "../PBpblas.h"
15 #include "../PBtools.h"
16 #include "../PBblacs.h"
17 #include "../PBblas.h"
18 
19 #ifdef __STDC__
20 int PB_Cindxg2p( int IG, int INB, int NB, int PROC, int SRCPROC, int NPROCS )
21 #else
22 int PB_Cindxg2p( IG, INB, NB, PROC, SRCPROC, NPROCS )
23 /*
24 * .. Scalar Arguments ..
25 */
26  int IG, INB, NB, NPROCS, PROC, SRCPROC;
27 #endif
28 {
29 /*
30 * Purpose
31 * =======
32 *
33 * PB_Cindxg2p computes the process coordinate which posseses the entry
34 * of a matrix specified by a global index IG.
35 *
36 * Arguments
37 * =========
38 *
39 * IG (global input) INTEGER
40 * On entry, IG specifies the global index of the matrix entry.
41 * IG must be at least zero.
42 *
43 * INB (global input) INTEGER
44 * On entry, INB specifies the size of the first block of the
45 * global matrix. INB must be at least one.
46 *
47 * NB (global input) INTEGER
48 * On entry, NB specifies the size of the blocks used to parti-
49 * tion the matrix. NB must be at least one.
50 *
51 * PROC (local dummy) INTEGER
52 * On entry, PROC is a dummy argument in this case in order to
53 * unify the calling sequence of the tool-routines.
54 *
55 * SRCPROC (global input) INTEGER
56 * On entry, SRCPROC specifies the coordinate of the process
57 * that possesses the first row or column of the matrix. When
58 * SRCPROC = -1, the data is not distributed but replicated,
59 * otherwise SRCPROC must be at least zero and strictly less
60 * than NPROCS.
61 *
62 * NPROCS (global input) INTEGER
63 * On entry, NPROCS specifies the total number of process rows
64 * or columns over which the matrix is distributed. NPROCS must
65 * be at least one.
66 *
67 * -- Written on April 1, 1998 by
68 * Antoine Petitet, University of Tennessee, Knoxville 37996, USA.
69 *
70 * ---------------------------------------------------------------------
71 */
72 /* ..
73 * .. Executable Statements ..
74 *
75 */
76  if( ( IG < INB ) || ( SRCPROC == -1 ) || ( NPROCS == 1 ) )
77 /*
78 * IG belongs to the first block, or the data is not distributed, or there is
79 * just one process in this dimension of the grid.
80 */
81  return( SRCPROC );
82 /*
83 * Otherwise, IG is in block 1 + ( IG - INB ) / NB. Add this to SRCPROC and
84 * take the NPROCS modulo (definition of the block-cyclic data distribution).
85 */
86  PROC = SRCPROC + 1 + ( IG - INB ) / NB;
87  return( MPosMod( PROC, NPROCS ) );
88 /*
89 * End of PB_Cindxg2p
90 */
91 }
MPosMod
#define MPosMod(I, d)
Definition: PBtools.h:95
PB_Cindxg2p
int PB_Cindxg2p(int IG, int INB, int NB, int PROC, int SRCPROC, int NPROCS)
Definition: PB_Cindxg2p.c:22