DecomposedMat( mat )
finds if the square matrix mat admits a block decomposition.
Define a graph G with vertices [1..Length(mat)]
and with an edge
between i
and j
if either mat[i][j]
or mat[j][i]
is non-zero.
DecomposedMat
return a list of lists l
such that l[1],l[2]
, etc..
are the vertices in each connected component of G
. In other words, the
matrices mat{l[1]}{l[1]},mat{l[2]}{l[2]}
, etc... are blocks of
the matrix mat.
gap> m := [ [ 0, 0, 0, 1 ], > [ 0, 0, 1, 0 ], > [ 0, 1, 0, 0 ], > [ 1, 0, 0, 0 ] ];; gap> DecomposedMat( m ); [ [ 1, 4 ], [ 2, 3 ] ] gap> PrintArray( m{[ 1, 4 ]}{[ 1, 4 ]}); [ [ 0, 1 ], [ 1, 0 ] ]
GAP 3.4.4