SCALAPACK 2.2.2
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches
BI_TransDist.c
Go to the documentation of this file.
1#include "Bdef.h"
2
3void 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}
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
#define Int
Definition Bconfig.h:22
#define Mgridinfo(ctxt, Ng0, nprow0, npcol0, myrow0, mycol0)
Definition Bdef.h:150
#define Mvkpnum(ctxt, prow, pcol)
Definition Bdef.h:174
#define Mvpcoord(ctxt, node, prow, pcol)
Definition Bdef.h:170
#define BI_DistType
Definition Bdef.h:72