diff --git a/doc/ref/pperm.xml b/doc/ref/pperm.xml index 2df61b7ae9..5c98f61f51 100644 --- a/doc/ref/pperm.xml +++ b/doc/ref/pperm.xml @@ -1068,7 +1068,6 @@ gap> AsPartialPerm(f, [ 1, 2, 3 ] ); set of positive integer"/> - A partial permutation or fail. A transformation f defines a partial permutation when it is @@ -1095,33 +1094,19 @@ gap> AsPartialPerm(f, [ 1, 2, 3 ] ); integer and this set satisfies the conditions given above. - for a transformation - - Let n denote the degree of f. If - n^f=n and f is injective on those i such - that i^f<>n, then AsPartialPerm returns - the partial permutation obtained by restricting f to those - i such that i^f<>n. - - AsPartialPerm returns fail if the arguments do not describe a - partial permutation.

- The operation can also be used to convert transformations into partial permutations. gap> f:=Transformation( [ 8, 3, 5, 9, 6, 2, 9, 7, 9 ] );; -gap> AsPartialPerm(f); -[1,8,7](2,3,5,6) +gap> AsPartialPerm(f, [1, 2, 3, 5, 8]); +[1,8,7][2,3,5,6] gap> AsPartialPerm(f, 3); [1,8][2,3,5] gap> AsPartialPerm(f, [ 2 .. 4 ] ); -[2,3,5][4,9] -gap> f:=Transformation( [ 2, 10, 2, 4, 4, 7, 6, 9, 10, 1 ] );; -gap> AsPartialPerm(f); -fail +[2,3,5][4,9] diff --git a/lib/pperm.gi b/lib/pperm.gi index 667f22cd80..6dfeea57d7 100644 --- a/lib/pperm.gi +++ b/lib/pperm.gi @@ -229,14 +229,12 @@ InstallMethod(AsPartialPerm, "for a transformation and list", [IsTransformation, IsList], function(f, list) - if not IsSSortedList(list) or not ForAll(list, IsPosInt) - or not ForAll(list, i-> i<=DegreeOfTransformation(f)) then - Error("usage: the second argument must be a set of positive integers ", - "not greater than the degree of the first argument,"); - return; + if not IsSSortedList(list) or not ForAll(list, IsPosInt) then + ErrorNoReturn("usage: the second argument must be a set of positive ", + "integers,"); elif not IsInjectiveListTrans(list, f) then - Error("usage: the first argument must be injective on the second,"); - return fail; + ErrorNoReturn("usage: the first argument must be injective on the ", + "second,"); fi; return PartialPermNC(list, OnTuples(list, f)); end); @@ -249,27 +247,6 @@ function(f, n) return AsPartialPerm(f, [1..n]); end); -# c method? JDM - -InstallMethod(AsPartialPerm, "for a transformation", -[IsTransformation], -function(f) - local img, n; - n:=DegreeOfTransformation(f); - if not n^f=n then - return fail; - fi; - return PartialPerm(List([1..n], function(i) - local j; - j:=i^f; - if j=n then - return 0; - else - return j; - fi; - end)); -end); - # n is image of undefined points InstallMethod(AsTransformation, "for a partial perm and positive integer", [IsPartialPerm, IsPosInt], diff --git a/tst/testinstall/pperm.tst b/tst/testinstall/pperm.tst index 5c7ab1cb6c..9338ebd69f 100644 --- a/tst/testinstall/pperm.tst +++ b/tst/testinstall/pperm.tst @@ -2286,8 +2286,6 @@ gap> AsTransformation(f); gap> AsTransformation(f, 12); -gap> AsPartialPerm(last); -[1,6,7,8,9][3,5,4](2)(10) gap> f; [1,6,7,8,9][3,5,4](2)(10) gap> f:=PartialPermNC([ 1, 3, 4, 5, 6, 9 ], [ 9, 10, 5, 7, 2, 8 ]);; @@ -2295,8 +2293,6 @@ gap> AsTransformation(f); gap> AsTransformation(f); -gap> AsPartialPerm(last)=f; -true gap> OnTuples([1..DegreeOfPartialPerm(f)], f); [ 9, 10, 5, 7, 2, 8 ] gap> g:=PartialPermNC([ 1, 2, 3, 4, 5, 6, 7, 8, 10, 11, 12, 13, 19 ],