Ticket #4383: trac_4383-order-trivial-permgp3-REBASE.patch

File trac_4383-order-trivial-permgp3-REBASE.patch, 1.9 KB (added by was, 12 years ago)
  • sage/groups/perm_gps/permgroup.py

    # HG changeset patch
    # User William Stein <wstein@gmail.com>
    # Date 1227923196 28800
    # Node ID b25320dac771b75966317a81295c4877223e9da8
    # Parent  d19e764b85ac1c10944acaaf15aa2fbd7c3c2091
    trac #4383 -- composition_series() returns no generators for trivial subgroup) (part 3)
    
    diff -r d19e764b85ac -r b25320dac771 sage/groups/perm_gps/permgroup.py
    a b  
    276276        gens = [PermutationGroupElement(x, check=False).list() for x in gens]
    277277        self._deg = max([1]+[max(g) for g in gens])
    278278        gens = [PermutationGroupElement(x, self, check=False) for x in gens]
     279        if not gens:  # length 0
     280             gens = [()]
    279281        if canonicalize:
    280282             gens = list(set(gens))
    281283             gens.sort()
     
    298300        except TypeError, s:
    299301            raise RuntimeError, "(It might be necessary to install the database_gap optional Sage package, if you haven't already.)\n%s"%s
    300302        gens = [PermutationGroupElement(gens[n],self, check=False)
    301                        for n in range(1, int(gens.Length())+1)] 
     303                       for n in range(1, int(gens.Length())+1)]
    302304        if gens == []:
    303             gens = [self.identity()]
    304 
     305            gens = [()]
    305306        return gens
    306307
    307308
     
    16841685            sage: G = PermutationGroup([[(1,2,3),(4,5)],[(3,4)]])
    16851686            sage: G.composition_series()  # random output
    16861687            [Permutation Group with generators [(1,2,3)(4,5), (3,4)], Permutation Group with generators [(1,5)(3,4), (1,5)(2,3), (1,5,4)], Permutation Group with generators [()]]
    1687 
     1688            sage: G = PermutationGroup([[(1,2,3),(4,5)], [(1,2)]])
     1689            sage: CS = G.composition_series()
     1690            sage: CS[3]
     1691            Permutation Group with generators [()]
    16881692        """
    16891693        current_randstate().set_seed_gap()
    16901694        ans = []