Algorithm for matrix permutation into block triangular form
