24.3 Properties and Attibutes of Matrices

  • DimensionsMat( mat ) A

    is a list of length 2, the first being the number of rows, the second being the number of columns of the matrix mat.

    gap> DimensionsMat([[1,2,3],[4,5,6]]);
    [ 2, 3 ]
    
  • DefaultFieldOfMatrix( mat ) A

    For a matrix mat, DefaultFieldOfMatrix returns either a field (not necessarily the smallest one) containing all entries of mat, or fail.

    If mat is a matrix of finite field elements or a matrix of cyclotomics, DefaultFieldOfMatrix returns the default field generated by the matrix entries (see Creating Finite Fields and Operations for Cyclotomics).

    gap> DefaultFieldOfMatrix([[Z(4),Z(8)]]); 
    GF(2^6)
    

  • TraceMat( mat ) F
  • Trace( mat ) F

    The trace of a square matrix is the sum of its diagonal entries.

    gap> TraceMat([[1,2,3],[4,5,6],[7,8,9]]);
    15
    
  • DeterminantMat( mat ) A
  • Determinant( mat ) F

    returns the determinant of the square matrix mat

  • DeterminantMatDestructive( mat ) O

    Does the same as DeterminantMat, with the difference that it may destroy its argument. The matrix mat must be mutable.

    gap> DeterminantMat([[1,2],[2,1]]);
    -3
    gap> mm:= [[1,2],[2,1]];;
    gap> DeterminantMatDestructive( mm );
    -3
    gap> mm;
    [ [ 1, 2 ], [ 0, -3 ] ]
    

  • IsMonomialMatrix( mat ) P

    A matrix is monomial if and only if it has exactly one nonzero entry in every row and every column.

    gap> IsMonomialMatrix([[0,1],[1,0]]);
    true
    

  • IsDiagonalMat( mat ) O

    returns true if mat has only zero entries off the main diagonal, false otherwise.

  • IsUpperTriangularMat( mat ) O

    returns true if mat has only zero entries below the main diagonal, false otherwise.

  • IsLowerTriangularMat( mat ) O

    returns true if mat has only zero entries below the main diagonal, false otherwise.

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

    GAP 4 manual
    February 2000