The input is a huge $n \times n$ matrix. I know that, without changing the basis as a set, but only the order of its elements, this matrix is divided in certain blocks.
To clarify, this $5 \times 5$ matrix \begin{pmatrix} 1 & 0 & 0 & 0 & 0 \\ 0 & 1 & 0 & 1 & 0 \\ 0 & 0 & 1 & 0 & 0 \\ 0 & 2 & 0 & 1 & 0 \\ 4 & 0 & 1 & 0 & 3 \end{pmatrix} should become \begin{pmatrix} 1 & 2 & 0 & 0 & 0 \\ 1 & 1 & 0 & 0 & 0 \\ 0 & 0 & 3 & 1 & 4 \\ 0 & 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 0 & 1 \end{pmatrix}
Is there any utility or software available to do this easily? I do not care about the specific permutation, I just need to look at such blocks without crossing my eyes.
To clarify more: this corresponds to finding a "correct" ordering of the elements of the basis, i.e., permutation matrix $A$ (i.e. a matrix with only one $1$ in each column, and the rest $0$) such that $AMA^{-1}$ has the required form.
You can implement something to do this in MatLab, or any other software.
You will just take the first row/column, and put $P_{1}$ to be an arbitrary permutation (matrix) that moves all of the $1 \leq j \leq n$ such that either $A_{1,j}$ or $A_{j,1} \neq 0$ to positions $1,2,3,\ldots,k_{1}$.
Then take the second row/column, and put $P_{2}$ to be an arbitrary permutation (matrix) that leave $1$ fixed and moves all of the $2 \leq j \leq n$ with $A_{2,j}$ or $A_{j,2} \neq 0$ to positions $2,3, \ldots, k_{2}$.
Continue this process for $1 \leq i \leq n$, so at step $i$, you put $P_{i}$ to be a permutation that leaves $1,2, \ldots, i-1$ fixed and moves all of the $i \leq j \leq n$ with $A_{i,j}$ or $A_{j,i} \neq 0$ to positions $i,i+1,\ldots,k_{i}$.
Then you will have $P = P_{n}P_{n-1}\ldots P_{1}$.