24.11 Triangular Matrices

  • DiagonalOfMat( mat ) O

    returns the diagonal of mat as a list.

    gap> DiagonalOfMat([[1,2],[3,4]]);
    [ 1, 4 ]
    
  • UpperSubdiagonal( mat, pos ) O

    returns a mutable list containing the entries of the posth upper subdiagonal of mat.

    gap> UpperSubdiagonal(mat,1);
    [ 2, 6 ]
    
  • DepthOfUpperTriangularMatrix( mat ) A

    If mat is an upper triangular matrix this attribute returns the index of the first nonzero diagonal.

    gap> DepthOfUpperTriangularMatrix([[0,1,2],[0,0,1],[0,0,0]]);
    1
    gap> DepthOfUpperTriangularMatrix([[0,0,2],[0,0,0],[0,0,0]]);  
    2
    

    [Top] [Previous] [Up] [Next] [Index]

    GAP 4 manual
    February 2000