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 b  
    914914        sage: GeneralDihedralGroup([3, 1.5])
    915915        Traceback (most recent call last):
    916916        ...
    917         TypeError: the input list must contain all Integers
     917        TypeError: the input list must consist of Integers
    918918
    919919        sage: GeneralDihedralGroup([4, -8])
    920920        Traceback (most recent call last):
     
    951951            raise ValueError, 'there must be at least one direct factor in the abelian group being dihedralized'
    952952
    953953        if not all(isinstance(x, Integer) for x in factors):
    954             raise TypeError, 'the input list must contain all Integers'
     954            raise TypeError, 'the input list must consist of Integers'
    955955
    956956        if not all(x >= 2 for x in factors):
    957957            s = 'all direct factors must be greater than 1'
     
    976976            # make contribution to the generator that dihedralizes the
    977977            # abelian group
    978978            for i in range(1, (a//2)+1):
    979                 genx.append(tuple((jumppoint+i, jumppoint+a-i)))
     979                if i != a-i:
     980                   genx.append(tuple((jumppoint+i, jumppoint+a-i)))
    980981            jumppoint = jumppoint + a
    981982        # If all of the direct factors are C2, then the action turning
    982983        # each element into its inverse is trivial, and the