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

◆ SL_Cgridreshape()

Int SL_Cgridreshape ( Int  ctxt,
Int  pstart,
Int  row_major_in,
Int  row_major_out,
Int  P,
Int  Q 
)

Definition at line 8 of file SL_gridreshape.c.

9{
11 Int nctxt, P0, Q0, Np, i, *g;
12
13 Cblacs_gridinfo(ctxt, &P0, &Q0, &i, &Np);
14 Np = P * Q;
15 if (Np+pstart > P0*Q0)
16 {
17 fprintf(stderr, "Illegal reshape command in %s\n",__FILE__);
18 Cblacs_abort(ctxt, -22);
19 }
20 g = (Int *) malloc(Np * sizeof(Int));
21 if (!g)
22 {
23 fprintf(stderr, "Cannot allocate memory in %s\n",__FILE__);
24 Cblacs_abort(ctxt, -23);
25 }
26 if (row_major_in) /* Read in in row-major order */
27 {
28 if (row_major_out)
29 for (i=0; i != Np; i++)
30 g[(i%Q)*P+i/Q] = Cblacs_pnum(ctxt, (pstart+i)/Q0, (pstart+i)%Q0);
31 else
32 for (i=0; i != Np; i++)
33 g[i] = Cblacs_pnum(ctxt, (pstart+i)/Q0, (pstart+i)%Q0);
34 }
35 else /* read in in column-major order */
36 {
37 if (row_major_out)
38 for (i=0; i != Np; i++)
39 g[(i%Q)*P+i/Q] = Cblacs_pnum(ctxt, (pstart+i)%P0, (pstart+i)/P0);
40 else
41 for (i=0; i != Np; i++)
42 g[i] = Cblacs_pnum(ctxt, (pstart+i)%P0, (pstart+i)/P0);
43 }
44 Cblacs_get(ctxt, 10, &nctxt);
45 Cblacs_gridmap(&nctxt, g, P, P, Q);
46 free(g);
47
48 return(nctxt);
49}
void Cblacs_gridmap()
void Cblacs_abort()
Int Cblacs_pnum()
void Cblacs_get()
void Cblacs_gridinfo()
#define Int
Here is the call graph for this function:
Here is the caller graph for this function: