9.9 LinearCombination

LinearCombination( V, cf )

LinearCombination computes the linear combination of the base elements of the vector space V with coefficients cf.

cf has to be a list of elements of V.field, the field over which the vector space is written. Its length must be equal to the dimension of V to make sure that one coefficient is specified for each element of the base.

LinearCombination will use that base of V which is returned when applying the function Base to V (see Base). To perform linear combinations of different bases use AddBase to specify which base should be used (see AddBase).

    gap> f := GF( 3^4 );
    GF(3^4)
    gap> f.base;
    [ Z(3)^0, Z(3^4), Z(3^4)^2, Z(3^4)^3 ]
    gap> V := VectorSpace( f.base, GF( 3 ) );
    VectorSpace( [ Z(3)^0, Z(3^4), Z(3^4)^2, Z(3^4)^3 ], GF(3) )
    gap> LinearCombination( V, [ Z(3), Z(3)^0, Z(3), 0*Z(3) ] );
    Z(3^4)^16
    gap> Coefficients( V, f.root ^ 16 );
    [ Z(3), Z(3)^0, Z(3), 0*Z(3) ] 

Previous Up Top Next
Index

GAP 3.4.4
April 1997