Skip to content

Commit

Permalink
Fix ExtendedVectors for trivial vector spaces
Browse files Browse the repository at this point in the history
... in case of different method ranking
  • Loading branch information
fingolfin committed Jul 2, 2018
1 parent 53ed89c commit b234e0f
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
7 changes: 3 additions & 4 deletions lib/vspcrow.gi
Original file line number Diff line number Diff line change
Expand Up @@ -1781,7 +1781,7 @@ end );
BindGlobal( "Length_ExtendedVectors", T -> Length( T!.spaceEnumerator ) );

BindGlobal( "PrintObj_ExtendedVectors", function( T )
Print( "A( ", UnderlyingCollection( T!.spaceEnumerator ), " )" );
Print( "A( ", T!.space, " )" );
end );

BindGlobal( "ExtendedVectors", function( V )
Expand All @@ -1794,18 +1794,17 @@ BindGlobal( "ExtendedVectors", function( V )
PrintObj := PrintObj_ExtendedVectors,

spaceEnumerator := Enumerator( V ),
space := V,
one := One( LeftActingDomain( V ) ),
len := Length( Zero( V ) ) + 1 ) );

enum!.q:= Size( LeftActingDomain( V ) );
if IsFinite( LeftActingDomain( V ) )
and IsPrimeInt( Size( LeftActingDomain( V ) ) )
and Size( LeftActingDomain( V ) ) < 256
and IsInternalRep( One( LeftActingDomain( V ) ) ) then
SetFilterObj( enum, IsQuickPositionList );
enum!.q:= enum!.spaceEnumerator!.q;
enum!.NumberElement:= NumberElement_ExtendedVectorsFF;
else
enum!.q:= Size( LeftActingDomain( V ) );
fi;

return enum;
Expand Down
19 changes: 19 additions & 0 deletions tst/testbugfix/2018-06-27-ExtendedVectors.tst
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# ExtendedVectors was relying on some specific internal behavior
# of vector space enumerators; but that was brittle, as a change in
# rank can lead to a different enumerator being installed. Make sure
# this is not the case anymore

# This is how you are "supposed" to call ExtendedVectors
gap> V:=GF(3)^0;;
gap> Enumerator(V);
<enumerator of ( GF(3)^0 )>
gap> ExtendedVectors(V);
A( ( GF(3)^0 ) )

# This is what happens if somehow a different enumerator gets installed
gap> V:=GF(3)^0;;
gap> SetEnumerator(V, Immutable( [ Zero( V ) ] ));
gap> Enumerator(V);
[ [ ] ]
gap> ExtendedVectors(V);
A( ( GF(3)^0 ) )

0 comments on commit b234e0f

Please sign in to comment.