Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ExtendedVectors for trivial vector spaces #2582

Merged
merged 1 commit into from
Jul 2, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 ) )