[GAP Forum] Intersection and compliment of a vector space

Max Horn max at quendi.de
Fri Aug 12 13:06:21 BST 2011


Am 12.08.2011 um 12:00 schrieb Cameo Cosmetics BG:

> Dear forum members,
> 
> I am working with subspaces of GF(2)^72 and I need to find the
> subspace which is the intersection of two such subspaces V, W
> and the compliment of V with regard of that intersection. I have
> checked the manual but cannot find direct functions.

For the intersection you can use the "Intersection" command. Example:

gap> spc:=GF(2)^72;;
gap> V:=Subspace(spc, List([1..50], i->Random(spc)));; Dimension(V);
50
gap> W:=Subspace(spc, List([1..50], i->Random(spc)));; Dimension(W);
50
gap> U:=Intersection(V,W);
<vector space of dimension 28 over GF(2)>

(Of course this last dimension will vary, as W and U are random).


For the complement: There are in general of course many complements to the intersection U of V and W inside V. Here is one way to get one of them, using basic linear algebra (continuing the example from above); it's main merit being that the code is short.

gap> B:=SemiEchelonBasis(U);;
gap> Ucomp:=Subspace(spc,List(Basis(V), v->SiftedVector(B,v)));
<vector space over GF(2), with 50 generators>
gap> Dimension(Ucomp);
22
gap> Dimension(U);
28


Cheers,
Max


More information about the Forum mailing list