DiagonalizeMat( mat )
DiagonalizeMat
transforms the integer matrix mat by multiplication
with unimodular (i.e., determinant +1 or -1) integer matrices from the
left and from the right into diagonal form (i.e., only diagonal entries
are nonzero). Note that DiagonalizeMat
changes mat and returns
nothing. If there are several diagonal matrices to which mat is
equivalent, it is not specified which one is computed, except that all
zero entries on the diagonal are collected at the lower right end (see
ElementaryDivisorsMat).
gap> m := [ [ 0, -1, 1 ], [ -2, 0, -2 ], [ 2, -2, 4 ] ];; gap> DiagonalizeMat( m ); m; [ [ 1, 0, 0 ], [ 0, 2, 0 ], [ 0, 0, 0 ] ]
Note that for large integer matrices DiagonalizeMat
may take very long,
because the entries may become very large during the computation, even if
the final result only contains small integers.
GAP 3.4.4