Skip to content

Commit

Permalink
Fixed bug with Cycles((),[])
Browse files Browse the repository at this point in the history
  • Loading branch information
laurentbartholdi authored and fingolfin committed Mar 2, 2020
1 parent 9f22a72 commit 27e9334
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
10 changes: 6 additions & 4 deletions lib/oprt.gi
Original file line number Diff line number Diff line change
Expand Up @@ -2188,8 +2188,12 @@ InstallMethod( CyclesOp, true, [ IsObject, IsList, IsFunction ], 1,
IsSSortedList(D);
blist := BlistList( [ 1 .. Length( D ) ], [ ] );
orbs := [ ];
next := 1;
while next <> fail do
next := 0;
while true do
next := Position( blist, false, next );
if next = fail then
return Immutable( orbs );
fi;
pnt := D[ next ];
orb := CycleOp( g, D[ next ], act );
Add( orbs, orb );
Expand All @@ -2199,9 +2203,7 @@ InstallMethod( CyclesOp, true, [ IsObject, IsList, IsFunction ], 1,
blist[ pos ] := true;
fi;
od;
next := Position( blist, false, next );
od;
return Immutable( orbs );
end );

#############################################################################
Expand Down
4 changes: 4 additions & 0 deletions tst/testinstall/perm.tst
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,10 @@ l')
#
# CycleLengthPermInt, CyclePermInt
#
gap> Cycles((),[]);
[ ]
gap> Cycles((),[1]);
[ [ 1 ] ]
gap> Cycles((1,2,3)(4,5)(6,70),[4..7]);
[ [ 4, 5 ], [ 6, 70 ], [ 7 ] ]
gap> CycleLengths((1,2,3)(4,5)(6,70),[4..7]);
Expand Down

0 comments on commit 27e9334

Please sign in to comment.