title: How to gather matrix in root 0, only its original rows and cols size that is MyNoofRows and MyNoofcols
body: <p>How to gather blocks of matrix in root process. I tried using gather with the data type blocktype declared below but it didn't work.</p>
  
  <pre><code>    int sqr=sqrt(p);
      modval = n % sqr;
      divval = n/sqr;
      //partition into rows and columns
      MyNoofRows = (me/sqr&lt; modval ? divval + 1 : divval);
      MyNoofcols = (me%sqr &lt; modval ? divval + 1 : divval);
      // surrounding rows with additional values required for computation  
      int rows_with_halo=MyNoofRows+(2*d);
      int cols_with_halo=MyNoofcols+(2*d);
      int istart= (cols_with_halo*d)+d;
      MPI_Type_vector(rows_with_halo,d,cols_with_halo,MPI_DOUBLE,&amp;columntype);
      MPI_Type_commit(&amp;columntype);
      MPI_Type_vector(MyNoofRows,MyNoofcols,cols_with_halo,MPI_DOUBLE,&amp;blocktype);
      MPI_Type_commit(&amp;blocktype);
      MPI_Type_vector(MyNoofRows,MyNoofcols,n,MPI_DOUBLE,&amp;blocktype_recv);
      MPI_Type_commit(&amp;blocktype_recv);
      double *chunk_array=(double *)calloc((rows_with_halo*cols_with_halo),sizeof(double));
      double *result_array=(double *)calloc((n*n),sizeof(double));
      // now after computation I want matrix in each process must be collected in root              process 
  </code></pre>