From 28fce7745bf588050dd2080260292ef0df628ad2 Mon Sep 17 00:00:00 2001 From: James Mitchell Date: Thu, 14 Jun 2018 14:55:14 +0100 Subject: [PATCH] Fix bug in PartialPerm if length of img and dom differ Resolve issue #2301. --- lib/pperm.gi | 5 +++-- tst/testinstall/pperm.tst | 6 ++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/pperm.gi b/lib/pperm.gi index 6a652b55f53..40c2cea1ca6 100644 --- a/lib/pperm.gi +++ b/lib/pperm.gi @@ -545,12 +545,13 @@ function(arg) fi; elif Length(arg)=2 then if IsSSortedList(arg[1]) and ForAll(arg[1], IsPosInt) and - IsDuplicateFreeList(arg[2]) and ForAll(arg[2], IsPosInt) then + IsDuplicateFreeList(arg[2]) and ForAll(arg[2], IsPosInt) and + Length(arg[1]) = Length(arg[2]) then return SparsePartialPermNC(arg[1], arg[2]); else ErrorNoReturn("usage: the 1st argument must be a set of positive integers ", "and the 2nd argument must be a duplicate-free list of positive ", - "integers"); + "integers of equal length to the first"); fi; fi; diff --git a/tst/testinstall/pperm.tst b/tst/testinstall/pperm.tst index 309ca6315a0..6d0a0990afb 100644 --- a/tst/testinstall/pperm.tst +++ b/tst/testinstall/pperm.tst @@ -2440,6 +2440,12 @@ gap> MultiplicativeZeroOp(x); gap> MultiplicativeZero(x); +# Test PartialPerm (for sparse incorrect arg) +gap> PartialPerm([1,2,8],[3,4,1,2]); +Error, usage: the 1st argument must be a set of positive integers and the 2nd \ +argument must be a duplicate-free list of positive integers of equal length to\ + the first + # gap> SetUserPreference("PartialPermDisplayLimit", display);; gap> SetUserPreference("NotationForPartialPerm", notationpp);;