title: MPI gather returns results in wrong order
body: <p>I'm trying to multiply matrix by matrix (A*B) with an MPI. I'm splitting matrix B into columns B = [b1, ... bn] and do series of multiplications ci = A*bi. The problem is, then I'm gathering the resulting columns they order sometimes appears to be wrong. So, instead of 
  [c1, ... cn] I'm getting, for example, [c2,c1,c4, ..].</p>
  
  <pre><code>MPI_Scatter(matrix,MM,MPI_INT,part_of_matrix,MM,MPI_INT,0,MPI_COMM_WORLD);
  
  for (i=0; i&lt;n; i++)  {
      get_block_of_matrix(block,part_of_matrix,M,n,i);
      matvect(tmp,val,I,J,M,nnz,block);
      for (j=0; j&lt;M; j++)
          result[M*i+j]=tmp[j];
  }
  
  
  MPI_Gather(result, MM, MPI_INT, res, MM, MPI_INT, 0, MPI_COMM_WORLD);
  </code></pre>