24.6 Matrices Representing Linear Equations and the Gaussian Algorithm

  • RankMat( mat ) A

    If mat is a matrix whose rows span a free module over the ring generated by the matrix entries and their inverses then RankMat returns the dimension of this free module. Otherwise fail is returned.

    Note that RankMat may perform a Gaussian elimination. For large rational matrices this may take very long, because the entries may become very large.

    gap> mat:=[[1,2,3],[4,5,6],[7,8,9]];;
    gap> RankMat(mat); 
    2
    
  • TriangulizeMat( mat ) O

    applies the Gaussian Algorithm to the mutable matrix mat and changes mat such that it is in upper triangular normal form (sometimes called ``Hermite normal form'').

    gap> m:=MutableTransposedMat(mat);
    [ [ 1, 4, 7 ], [ 2, 5, 8 ], [ 3, 6, 9 ] ]
    gap> TriangulizeMat(m);m;
    [ [ 1, 0, -1 ], [ 0, 1, 2 ], [ 0, 0, 0 ] ]
    
  • NullspaceMat( mat ) A
  • TriangulizedNullspaceMat( mat ) A

    returns a list of row vectors that form a basis of the vector space of solutions to the equation vec*mat=0. The result is an immutable matrix. This basis is not guaranteed to be in any specific form.

    The variant TriangulizedNullspaceMat returns a basis of the nullspace in triangulized form as is often needed for algorithms.

  • NullspaceMatDestructive( mat ) O
  • TriangulizedNullspaceMatDestructive( mat ) O

    This function does the same as NullspaceMat. However, the latter function makes a copy of mat to avoid having to change it. This function does not do that; it returns the null space and may destroy mat; this saves a lot of memory in case mat is big. The matrix mat must be mutable.

    The variant TriangulizedNullspaceMatDestructive returns a basis of the nullspace in triangulized form. It may destroy the matrix mat.

    gap> mat:=[[1,2,3],[4,5,6],[7,8,9]];;
    gap> NullspaceMat(mat);
    [ [ 1, -2, 1 ] ]
    gap> mm:=[[1,2,3],[4,5,6],[7,8,9]];; 
    gap> NullspaceMatDestructive( mm ); 
    [ [ 1, -2, 1 ] ]
    gap> mm;
    [ [ 1, 2, 3 ], [ 0, -3, -6 ], [ 0, 0, 0 ] ]
    
  • SolutionMat( mat, vec ) O

    returns a rwo vector x that is a solution of the equation x * mat = vec. It returns fail if no such vector exists.

  • SolutionMatDestructive( mat, vec ) O

    Does the same as SolutionMat( mat, vec ) except that it may destroy the matrix mat. The matrix mat must be mutable.

    gap> mat:=[[1,2,3],[4,5,6],[7,8,9]];;
    gap> SolutionMat(mat,[3,5,7]); 
    [ 5/3, 1/3, 0 ]
    gap> mm:=[[1,2,3],[4,5,6],[7,8,9]];; 
    gap> SolutionMatDestructive( mm, [3,5,7] );
    [ 5/3, 1/3, 0 ]
    gap> mm;
    [ [ 1, 0, -1 ], [ 0, 1, 2 ], [ 0, 0, 0 ] ]
    
  • BaseFixedSpace( mats ) F

    BaseFixedSpace returns a list of row vectors that form a base of the vector space V such that v M = v for all v in V and all matrices M in the list mats. (This is the common eigenspace of all matrices in mats for the eigenvalue 1.)

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

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

    GAP 4 manual
    February 2000