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 a case where Coefficients(B,v) returned a list instead of fail although the vector v did not lie in the underlying vector space V of B #5335

Merged
merged 1 commit into from
Jan 19, 2023
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
8 changes: 5 additions & 3 deletions lib/vspcrow.gi
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,7 @@ COEFFS_SEMI_ECH_BASIS:=function( B, v )
local vectors, # basis vectors of `B'
heads, # heads info of `B'
len, # length of `v'
F, # allowed coefficients
coeff, # coefficients list, result
i, # loop over `v'
pos; # heads position
Expand All @@ -351,6 +352,7 @@ COEFFS_SEMI_ECH_BASIS:=function( B, v )
if len <> Length( heads ) then
return fail;
fi;
F:= LeftActingDomain( UnderlyingLeftModule( B ) );

# Preset the coefficients list with zeroes.
coeff:= ListWithIdenticalEntries( Length( vectors ), Zero( v[1] ) );
Expand All @@ -360,11 +362,11 @@ COEFFS_SEMI_ECH_BASIS:=function( B, v )
i:= PositionNonZero( v );
while i <= len do
pos:= heads[i];
if pos <> 0 then
if pos = 0 or not v[i] in F then
return fail;
else
coeff[ pos ]:= v[i];
AddRowVector( v, vectors[ pos ], - v[i] );
else
return fail;
fi;
i:= PositionNonZero( v );
od;
Expand Down
6 changes: 6 additions & 0 deletions tst/testinstall/vspcrow.tst
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,12 @@ gap> BaseDomain( b[1] );
GF(2^2)
gap> b[1] = vecs[1];
true
gap> v:= GF(2)^1;;
gap> b:= Basis( v, [ [ Z(2) ] ] );;
gap> Coefficients( b, [ Z(4) ] );
fail
gap> SiftedVector( b, [ Z(4) ] );
fail

#############################################################################
##
Expand Down