ScaLAPACK 2.1  2.1 ScaLAPACK: Scalable Linear Algebra PACKage
BI_TransDist.c
Go to the documentation of this file.
1 #include "Bdef.h"
2
3 void BI_TransDist(BLACSCONTEXT *ctxt, char scope, int m, int n, int *rA,
4  int *cA, int ldrc, BI_DistType *dist, int rdest, int cdest)
5 /*
6  * This routine translates distances (offsets from the destination node),
7  * stored in location dist, into row and column coordinates.
8  */
9 {
10  int i, j, k, dest;
11  int Ng, nprow, npcol, myrow, mycol;
12
13  Mgridinfo(ctxt, Ng, nprow, npcol, myrow, mycol);
14  if (rdest == -1) rdest = cdest = 0;
15
16  switch (scope)
17  {
18  case 'r':
19  for (j=0; j < n; j++)
20  {
21  for (i=0; i < m; i++)
22  {
23  rA[i] = myrow;
24  cA[i] = (int) (cdest + dist[i]) % npcol;
25  }
26  rA += ldrc;
27  cA += ldrc;
28  dist += m;
29  }
30  break;
31  case 'c':
32  for (j=0; j < n; j++)
33  {
34  for (i=0; i < m; i++)
35  {
36  rA[i] = (int) (rdest + dist[i]) % nprow;
37  cA[i] = mycol;
38  }
39  rA += ldrc;
40  cA += ldrc;
41  dist += m;
42  }
43  break;
44  case 'a':
45  dest = Mvkpnum(ctxt, rdest, cdest);
46  for (j=0; j < n; j++)
47  {
48  for (i=0; i < m; i++)
49  {
50  k = (int) (dest + dist[i]) % Ng; /* figure node number */
51  Mvpcoord(ctxt, k, rA[i], cA[i]); /* figure node coordinates */
52  }
53  rA += ldrc;
54  cA += ldrc;
55  dist += m;
56  }
57  }
58 }
BI_TransDist
void BI_TransDist(BLACSCONTEXT *ctxt, char scope, int m, int n, int *rA, int *cA, int ldrc, BI_DistType *dist, int rdest, int cdest)
Definition: BI_TransDist.c:3
bLaCsCoNtExT
Definition: Bdef.h:23
Mgridinfo
#define Mgridinfo(ctxt, Ng0, nprow0, npcol0, myrow0, mycol0)
Definition: Bdef.h:150
Bdef.h
BI_DistType
#define BI_DistType
Definition: Bdef.h:72
Mvkpnum
#define Mvkpnum(ctxt, prow, pcol)
Definition: Bdef.h:174
Mvpcoord
#define Mvpcoord(ctxt, node, prow, pcol)
Definition: Bdef.h:170