ScaLAPACK 2.1  2.1
ScaLAPACK: Scalable Linear Algebra PACKage
blacs_init_.c
Go to the documentation of this file.
1 #include "Bdef.h"
2 
3 #if (INTFACE == C_CALL)
4 void Cblacs_gridinit(int *ConTxt, char *order, int nprow, int npcol)
5 #else
6 F_VOID_FUNC blacs_gridinit_(int *ConTxt, F_CHAR order, int *nprow, int *npcol)
7 #endif
8 {
9  int *tmpgrid, *iptr;
10  int i, j;
11 
12 /*
13  * Grid can be row- or column-major natural ordering when blacs_gridinit is
14  * called. Define a tmpgrid to reflect this, and call blacs_gridmap to
15  * set it up
16  */
17  iptr = tmpgrid = (int*) malloc( Mpval(nprow)*Mpval(npcol)*sizeof(*tmpgrid) );
18  if (Mlowcase(F2C_CharTrans(order)) == 'c')
19  {
20  i = Mpval(npcol) * Mpval(nprow);
21  for (j=0; j < i; j++) iptr[j] = j;
22  }
23  else
24  {
25  for (j=0; j < Mpval(npcol); j++)
26  {
27  for (i=0; i < Mpval(nprow); i++) iptr[i] = i * Mpval(npcol) + j;
28  iptr += Mpval(nprow);
29  }
30  }
31 #if (INTFACE == C_CALL)
32  Cblacs_gridmap(ConTxt, tmpgrid, nprow, nprow, npcol);
33 #else
34  blacs_gridmap_(ConTxt, tmpgrid, nprow, nprow, npcol);
35 #endif
36  free(tmpgrid);
37 }
blacs_gridinit_
F_VOID_FUNC blacs_gridinit_(int *ConTxt, F_CHAR order, int *nprow, int *npcol)
Definition: blacs_init_.c:6
F_CHAR
char * F_CHAR
Definition: pblas.h:109
F2C_CharTrans
#define F2C_CharTrans(c)
Definition: Bdef.h:246
Mpval
#define Mpval(para)
Definition: Bdef.h:261
Mlowcase
#define Mlowcase(C)
Definition: Bdef.h:145
Cblacs_gridmap
void Cblacs_gridmap()
F_VOID_FUNC
#define F_VOID_FUNC
Definition: Bdef.h:232
Bdef.h
blacs_gridmap_
F_VOID_FUNC blacs_gridmap_(int *ConTxt, int *usermap, int *ldup, int *nprow0, int *npcol0)
Definition: blacs_map_.c:6
Cblacs_gridinit
void Cblacs_gridinit()