AddBase( V, base )
AddBase
attaches a user-supplied base for the vector space V to the
record that represents V.
Most of the functions for vector spaces make use of a base (see
LinearCombination, Coefficients). These functions get access to a
base using the function Base
, which normally computes a base for the
vector space using an appropriate algorithm. Once a base is computed it
will always be reused, no matter whether there is a more interesting base
available or not.
AddBase
installs a given base for V by overwriting any other base
of the vector space that has been installed before. So after AddBase
has successfully been used, base will be used whenever Base
is called
with V as argument.
Calling AddBase
with a base which is not a base for V might produce
unpredictable results in following computations.
gap> f := GF(3); GF(3) gap> m1 := [[ f.one, f.one, f.zero, f.zero ]]; [ [ Z(3)^0, Z(3)^0, 0*Z(3), 0*Z(3) ] ] gap> m2 := [[ f.one, f.one, f.one, f.zero ]]; [ [ Z(3)^0, Z(3)^0, Z(3)^0, 0*Z(3) ] ] gap> V := VectorSpace( [ m1, m2, m1+m2 ], GF(3) ); VectorSpace( [ [ [ Z(3)^0, Z(3)^0, 0*Z(3), 0*Z(3) ] ], [ [ Z(3)^0, Z(3)^0, Z(3)^0, 0*Z(3) ] ], [ [ Z(3), Z(3), Z(3)^0, 0*Z(3) ] ] ], GF(3) ) gap> Base( V ); [ [ [ Z(3)^0, Z(3)^0, 0*Z(3), 0*Z(3) ] ], [ [ Z(3)^0, Z(3)^0, Z(3)^0, 0*Z(3) ] ] ] gap> AddBase( V, [ m1, m1+m2 ] ); gap> Base( V ); [ [ [ Z(3)^0, Z(3)^0, 0*Z(3), 0*Z(3) ] ], [ [ Z(3), Z(3), Z(3)^0, 0*Z(3) ] ] ]
GAP 3.4.4