58.7 Mutable Bases

It is useful to have a mutable basis of a free module when successively closures with new vectors are formed, since one does not want to create a new module and a corresponding basis for each step.

Note that the situation here is different from the situation with stabilizer chains, which are (mutable or immutable) records that do not need to know about the groups they describe, whereas each (immutable) basis stores the underlying left module (see UnderlyingLeftModule).

So immutable bases and mutable bases are different categories of objects. The only thing they have in common is that one can ask both for their basis vectors and for the coefficients of a given vector.

Since Immutable produces an immutable copy of any GAP object, it would in principle be possible to construct a mutable basis that is in fact immutable. In the sequel, we will deal only with mutable bases that are in fact mutable GAP objects, hence these objects are unable to store attribute values.

Basic operations for immutable bases are NrBasisVectors (see NrBasisVectors), IsContainedInSpan (see IsContainedInSpan), CloseMutableBasis (see CloseMutableBasis), ImmutableBasis (see ImmutableBasis), Coefficients (see Coefficients), and BasisVectors (see BasisVectors). ShallowCopy (see ShallowCopy) for a mutable basis returns a mutable plain list containing the current basis vectors.

Since mutable bases do not admit arbitrary changes of their lists of basis vectors, a mutable basis is not a list. It is, however, a collection, more precisely its family (see Families) equals the family of its collection of basis vectors.

Mutable bases can be constructed with MutableBasis.

Similar to the situation with bases (cf. Bases of Vector Spaces), GAP supports the following three kinds of mutable bases.

The generic method of MutableBasis returns a mutable basis that simply stores an immutable basis; clearly one wants to avoid this whenever possible with reasonable effort.

There are mutable bases that store a mutable basis for a nicer module. Note that this is meaningful only if the mechanism of computing nice and ugly vectors (see Vector Spaces Handled By Nice Bases) is invariant under closures of the basis; this is the case for example if the vectors are matrices, Lie objects, or elements of structure constants algebras.

There are mutable bases that use special information to perform their tasks; examples are mutable bases of Gaussian row and matrix spaces.

  • IsMutableBasis( MB ) C

    Every mutable basis lies in the category IsMutableBasis.

  • MutableBasis( R, vectors[, zero] ) O

    MutableBasis returns a mutable basis for the R-free module generated by the vectors in the list vectors. The optional argument zero is the zero vector of the module; it must be given if vectors is empty.

    Note that vectors will in general not be the basis vectors of the mutable basis!

    gap> MB:= MutableBasis( Rationals, [ [ 1, 2, 3 ], [ 0, 1, 0 ] ] );
    <mutable basis over Rationals, 2 vectors>
    

  • NrBasisVectors( MB ) O

    For a mutable basis MB, NrBasisVectors returns the current number of basis vectors of MB. Note that this operation is not an attribute, as it makes no sense to store the value. NrBasisVectors is used mainly as an equivalent of Dimension for the underlying left module in the case of immutable bases.

    gap> MB:= MutableBasis( Rationals, [ [ 1, 1], [ 2, 2 ] ] );;
    gap> NrBasisVectors( MB );
    1
    

  • ImmutableBasis( MB[, V] ) O

    ImmutableBasis returns the immutable basis B, say, with the same basis vectors as in the mutable basis MB.

    If the second argument V is present then V is the value of UnderlyingLeftModule (see UnderlyingLeftModule) for B. The second variant is used mainly for the case that one knows the module for the desired basis in advance, and if it has a nicer structure than the module known to MB, for example if it is an algebra.

    gap> MB:= MutableBasis( Rationals, [ [ 1, 1 ], [ 2, 2 ] ] );;
    gap> B:= ImmutableBasis( MB );
    SemiEchelonBasis( <vector space of dimension 1 over Rationals>, [ [ 1, 1 ] ] )
    gap> UnderlyingLeftModule( B );
    <vector space of dimension 1 over Rationals>
    

  • IsContainedInSpan( MB, v ) O

    For a mutable basis MB over the coefficient ring R, say, and a vector v, IsContainedInSpan returns true is v lies in the R-span of the current basis vectors of MB, and false otherwise.

  • CloseMutableBasis( MB, v ) O

    For a mutable basis MB over the coefficient ring R, say, and a vector v, CloseMutableBasis changes MB such that afterwards it describes the R-span of the former basis vectors together with v.

    Note that if v enlarges the dimension then this does in general not mean that v is simply added to the basis vectors of MB. Usually a linear combination of v and the other basis vectors is added, and also the old basis vectors may be modified, for example in order to keep the list of basis vectors echelonized (see IsSemiEchelonized).

    gap> MB:= MutableBasis( Rationals, [ [ 1, 1, 3 ], [ 2, 2, 1 ] ] );
    <mutable basis over Rationals, 2 vectors>
    gap> IsContainedInSpan( MB, [ 1, 0, 0 ] );
    false
    gap> CloseMutableBasis( MB, [ 1, 0, 0 ] );
    gap> MB;
    <mutable basis over Rationals, 3 vectors>
    gap> IsContainedInSpan( MB, [ 1, 0, 0 ] );
    true
    

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

    GAP 4 manual
    February 2000