34.12 TriangulizeMat

TriangulizeMat( mat )

TriangulizeMat brings the matrix mat into upper triangular form. Note that mat is changed and that nothing is returned. A matrix is in upper triangular form when the first nonzero entry in each row is one and lies further to the right than the first nonzero entry in the previous row. Furthermore, above the first nonzero entry in each row all entries are zero. Note that the matrix will have trailing zero rows if the rank of mat is not maximal. The rows of the resulting matrix span the same vectorspace than the rows of the original matrix mat.

    gap> m := [ [ 0, -3, -1 ], [ -3, 0, -1 ], [ 2, -2, 0 ] ];;
    gap> TriangulizeMat( m ); m;
    [ [ 1, 0, 1/3 ], [ 0, 1, 1/3 ], [ 0, 0, 0 ] ] 

Note that for large rational matrices TriangulizeMat may take very long, because the entries may become very large during the Gaussian elimination, even if the final result contains only small integers.

Previous Up Top Next
Index

GAP 3.4.4
April 1997