# Ticket #13742: general_dihedral_group_fix.patch

File general_dihedral_group_fix.patch, 1.7 KB (added by dimpase, 8 years ago)

fix to disallow permutations with cycles of form (x,x)

• ## sage/groups/perm_gps/permgroup_named.py

```# HG changeset patch
# User Dmitrii Pasechnik <dimpase@gmail.com>
# Date 1353749112 -28800
# Node ID dcc8a27af2fc32fa2df2cd71538cae2baeac3a6c
# Parent  c4ce3d430b7064e2d2b2353abbdf3c42c0c2e696
in some cases permutations with cycles of form (x,x) were created. This is now fixed

diff --git a/sage/groups/perm_gps/permgroup_named.py b/sage/groups/perm_gps/permgroup_named.py```
 a sage: GeneralDihedralGroup([3, 1.5]) Traceback (most recent call last): ... TypeError: the input list must contain all Integers TypeError: the input list must consist of Integers sage: GeneralDihedralGroup([4, -8]) Traceback (most recent call last): raise ValueError, 'there must be at least one direct factor in the abelian group being dihedralized' if not all(isinstance(x, Integer) for x in factors): raise TypeError, 'the input list must contain all Integers' raise TypeError, 'the input list must consist of Integers' if not all(x >= 2 for x in factors): s = 'all direct factors must be greater than 1' # make contribution to the generator that dihedralizes the # abelian group for i in range(1, (a//2)+1): genx.append(tuple((jumppoint+i, jumppoint+a-i))) if i != a-i: genx.append(tuple((jumppoint+i, jumppoint+a-i))) jumppoint = jumppoint + a # If all of the direct factors are C2, then the action turning # each element into its inverse is trivial, and the