8                    Int first_proc, 
Int nprow_new, 
Int npcol_new )
 
   22   Int nprow_in, npcol_in, myrow_in, mycol_in;
 
   24   Int myrow_old, mycol_old, myrow_new, mycol_new;
 
   30   nprocs_new = nprow_new * npcol_new;
 
   32   Cblacs_gridinfo( context_in, &nprow_in, &npcol_in, &myrow_in, &mycol_in );
 
   35   if( ( nprow_in == nprow_new ) && ( npcol_in == npcol_new ) &&
 
   36       ( first_proc == 0 ) && ( major_in == major_out ) )
 
   38      *context_out = context_in;
 
   43   grid_new = (
Int *) malloc( nprocs_new * 
sizeof( 
Int ) );
 
   46   myrow_old = 0; mycol_old = 0;
 
   49      myrow_old = first_proc / nprow_in;
 
   50      mycol_old = first_proc % nprow_in;
 
   54      myrow_old = first_proc % nprow_in;
 
   55      mycol_old = first_proc / nprow_in;
 
   58   myrow_new = 0; mycol_new = 0;
 
   61   for (i=0; i< nprocs_new; i++ )
 
   63      pnum = 
Cblacs_pnum( context_in, myrow_old, mycol_old );
 
   64      grid_new[ (mycol_new * nprow_new) + myrow_new ] = pnum;
 
   65      proc_inc( &myrow_old, &mycol_old, nprow_in, npcol_in, major_in );
 
   66      proc_inc( &myrow_new, &mycol_new, nprow_new, npcol_new, major_out );
 
   73   Cblacs_gridmap( context_out, grid_new, nprow_new, nprow_new, npcol_new );
 
 
void RESHAPE(Int *context_in, Int *major_in, Int *context_out, Int *major_out, Int *first_proc, Int *nprow_new, Int *npcol_new)
void reshape(Int *context_in, Int *major_in, Int *context_out, Int *major_out, Int *first_proc, Int *nprow_new, Int *npcol_new)
void Creshape(Int context_in, Int major_in, Int *context_out, Int major_out, Int first_proc, Int nprow_new, Int npcol_new)
void reshape_(Int *context_in, Int *major_in, Int *context_out, Int *major_out, Int *first_proc, Int *nprow_new, Int *npcol_new)