58.5 Operations for Vector Space Bases

  • BasisVectors( B ) A

    For a vector space basis B, BasisVectors returns the list of basis vectors of B. The lists B and BasisVectors( B ) are equal; the main purpose of BasisVectors is to provide access to a list of vectors that does not know about an underlying vector space.

    gap> V:= VectorSpace( Rationals, [ [ 1, 2, 7 ], [ 1/2, 1/3, 5 ] ] );;
    gap> B:= Basis( V, [ [ 1, 2, 7 ], [ 0, 1, -9/4 ] ] );;
    gap> BasisVectors( B );
    [ [ 1, 2, 7 ], [ 0, 1, -9/4 ] ]
    

  • UnderlyingLeftModule( B ) A

    For a basis B of a free left module V, say, UnderlyingLeftModule returns V.

    The reason why a basis stores a free left module is that otherwise one would have to store the basis vectors and the coefficient domain separately. Storing the module allows one for example to deal with bases whose basis vectors have not yet been computed yet (see Basis); furthermore, in some cases it is convenient to test membership of a vector in the module before computing coefficients w.r.t. a basis.

    gap> B:= Basis( GF(2)^6 );;  UnderlyingLeftModule( B );
    ( GF(2)^6 )
    

  • Coefficients( B, v ) O

    Let V be the underlying left module of the basis B, and v a vector such that the family of v is the elements family of the family of V. Then Coefficients( B, v ) is the list of coefficients of v w.r.t. B if v lies in V, and fail otherwise.

    gap> V:= VectorSpace( Rationals, [ [ 1, 2, 7 ], [ 1/2, 1/3, 5 ] ] );;
    gap> B:= Basis( V, [ [ 1, 2, 7 ], [ 0, 1, -9/4 ] ] );;
    gap> Coefficients( B, [ 1/2, 1/3, 5 ] );
    [ 1/2, -2/3 ]
    gap> Coefficients( B, [ 1, 0, 0 ] );
    fail
    

  • LinearCombination( B, coeff ) O
  • LinearCombination( vectors, coeff ) O

    If B is a basis of length n, say, and coeff is a row vector of the same length as B, LinearCombination returns the vector åi = 1n coeff [i] \* B [i].

    If vectors and coeff are homogeneous lists of the same length n, say, LinearCombination returns åi = 1n coeff [i]\*vectors [i]. Perhaps the most important case is that vectors is a basis B.

    gap> V:= VectorSpace( Rationals, [ [ 1, 2, 7 ], [ 1/2, 1/3, 5 ] ] );;
    gap> B:= Basis( V, [ [ 1, 2, 7 ], [ 0, 1, -9/4 ] ] );;
    gap> LinearCombination( B, [ 1/2, -2/3 ] );
    [ 1/2, 1/3, 5 ]
    

  • EnumeratorByBasis( B ) A

    For a basis B of the free left F-module V of dimension n, say, EnumeratorByBasis returns an enumerator that loops over the elements of V as linear combinations of the vectors of B with coefficients the row vectors in the full row space (see FullRowSpace) of dimension n over F, in the succession given by the default enumerator of this row space.

    gap> V:= GF(2)^3;;
    gap> enum:= EnumeratorByBasis( CanonicalBasis( V ) );;
    gap> Print( enum{ [ 1 .. 4 ] }, "\n" );
    [ [ 0*Z(2), 0*Z(2), 0*Z(2) ], [ 0*Z(2), 0*Z(2), Z(2)^0 ], 
      [ 0*Z(2), Z(2)^0, 0*Z(2) ], [ 0*Z(2), Z(2)^0, Z(2)^0 ] ]
    gap> B:= Basis( V, [ [ 1, 1, 1 ], [ 1, 1, 0 ], [ 1, 0, 0 ] ] * Z(2) );;
    gap> enum:= EnumeratorByBasis( B );;
    gap> Print( enum{ [ 1 .. 4 ] }, "\n" );
    [ [ 0*Z(2), 0*Z(2), 0*Z(2) ], [ Z(2)^0, 0*Z(2), 0*Z(2) ], 
      [ Z(2)^0, Z(2)^0, 0*Z(2) ], [ 0*Z(2), Z(2)^0, 0*Z(2) ] ]
    

  • IteratorByBasis( B ) O

    For a basis B of the free left F-module V of dimension n, say, IteratorByBasis returns an iterator that loops over the elements of V as linear combinations of the vectors of B with coefficients the row vectors in the full row space (see FullRowSpace) of dimension n over F, in the succession given by the default enumerator of this row space.

    gap> V:= GF(2)^3;;
    gap> iter:= IteratorByBasis( CanonicalBasis( V ) );;
    gap> for i in [ 1 .. 4 ] do Print( NextIterator( iter ), "\n" ); od;
    [ 0*Z(2), 0*Z(2), 0*Z(2) ]
    [ 0*Z(2), 0*Z(2), Z(2)^0 ]
    [ 0*Z(2), Z(2)^0, 0*Z(2) ]
    [ 0*Z(2), Z(2)^0, Z(2)^0 ]
    gap> B:= Basis( V, [ [ 1, 1, 1 ], [ 1, 1, 0 ], [ 1, 0, 0 ] ] * Z(2) );;
    gap> iter:= IteratorByBasis( B );;
    gap> for i in [ 1 .. 4 ] do Print( NextIterator( iter ), "\n" ); od;
    [ 0*Z(2), 0*Z(2), 0*Z(2) ]
    [ Z(2)^0, 0*Z(2), 0*Z(2) ]
    [ Z(2)^0, Z(2)^0, 0*Z(2) ]
    [ 0*Z(2), Z(2)^0, 0*Z(2) ]
    

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

    GAP 4 manual
    February 2000