Skip to content

Commit

Permalink
fix a bug in Coefficients
Browse files Browse the repository at this point in the history
resolves #5334
  • Loading branch information
ThomasBreuer authored and fingolfin committed Jan 19, 2023
1 parent 0adf6d1 commit 1f90b51
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
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

0 comments on commit 1f90b51

Please sign in to comment.