diff --git a/lib/dicthf.gi b/lib/dicthf.gi index 5ee7341589..819431548a 100644 --- a/lib/dicthf.gi +++ b/lib/dicthf.gi @@ -152,16 +152,20 @@ end); ## InstallMethod(SparseIntKey,"for bounded tuples",true, [ IsList,IsList and IsCyclotomicCollection ], 0, -function(m,v) -local c; - if Length(m)<>3 or m[1]<>"BoundedTuples" then +function(m, v) + if Length(m) <> 3 or m[1] <> "BoundedTuples" then TryNextMethod(); fi; - c:=[1,Maximum(m[2])+1]; - return function(a) - return a*c; + # Due to the way BoundedTuples are presently implemented we expect the input + # to the hash function to always be a list of positive immediate integers. This means + # that using HashKeyWholeBag should be safe. + return function(x) + Assert(1, IsPositionsList(x)); + if not IsPlistRep(x) then + x := AsPlist(x); + fi; + return HashKeyWholeBag(x, 1); end; - end); BindGlobal( "SparseIntKeyVecListAndMatrix", function(d,m) diff --git a/tst/teststandard/hash2.tst b/tst/teststandard/hash2.tst index 6bfa4d3967..d47452e5c7 100644 --- a/tst/teststandard/hash2.tst +++ b/tst/teststandard/hash2.tst @@ -32,4 +32,8 @@ gap> Length(Orbit(h,h.1[1],OnRight)); 2079 gap> Length(Orbit(h,h.2^5,OnPoints)); 693 +gap> Length(Orbit(SymmetricGroup(14), [1 .. 7], OnSets)); +3432 +gap> Length(Orbit(SymmetricGroup(16), [1 .. 8], OnSets)); +12870 gap> STOP_TEST( "hash2.tst", 1);