# Ticket #14319: trac_14319-empty.patch

File trac_14319-empty.patch, 10.3 KB (added by ncohen, 8 years ago)
• ## sage/coding/binary_code.pyx

```# HG changeset patch
# User Nathann Cohen <nathann.cohen@gmail.com>
# Date 1364857481 -7200
# Node ID 901aa6aa4ba75bca8fcd3e73d64e574a7debe63f
# Parent  1958c09a201dfb4cf95b46cc2dd32d1114efe84e
Correct domain for empty automorphism groups

diff --git a/sage/coding/binary_code.pyx b/sage/coding/binary_code.pyx```
 a %(str(aut_B_aug.__interface[gap]),str(H)))) #                        print 'rt_transversal:', rt_transversal rt_transversal = [PermutationGroupElement(g) for g in rt_transversal if str(g) != '()'] rt_transversal = [[a-1 for a in g.list()] for g in rt_transversal] rt_transversal = [[a-1 for a in g.domain()] for g in rt_transversal] rt_transversal = [g + range(len(g), n) for g in rt_transversal] rt_transversal.append(range(n)) #                        print 'rt_transversal:', rt_transversal
• ## sage/combinat/permutation.py

`diff --git a/sage/combinat/permutation.py b/sage/combinat/permutation.py`
 a [2, 5, 3, 4, 1] sage: type(p) Construction from a string in cycle notation :: sage: p = Permutation( '(4,5)' ); p [1, 2, 3, 5, 4] The size of the permutation is the maximum integer appearing; add a 1-cycle to increase this:: sage: p2 = Permutation( '(4,5)(10)' ); p2 [1, 2, 3, 5, 4, 6, 7, 8, 9, 10] sage: len(p); len(p2) 5 10 We construct a Permutation from a PermutationGroupElement:: sage: g = PermutationGroupElement([2,1,3]) sage: Permutation(g) [2, 1, 3] From a pair of tableaux of the same shape. This uses the inverse of Robinson Schensted algorithm:: if isinstance(l, Permutation_class): return l elif isinstance(l, PermutationGroupElement): l = l.list() l = l.domain() #if l is a string, then assume it is in cycle notation elif isinstance(l, str): if not isinstance(pge, PermutationGroupElement): raise TypeError, "pge (= %s) must be a PermutationGroupElement"%pge return Permutation(pge.list()) return Permutation(pge.domain()) def from_rank(n, rank): r"""
• ## sage/combinat/species/permutation_species.py

`diff --git a/sage/combinat/species/permutation_species.py b/sage/combinat/species/permutation_species.py`
 a def permutation_group_element(self): """ Returns self as a permutation group element. EXAMPLES:: sage: p = PermutationGroupElement((2,3,4)) sage: P = species.PermutationSpecies() sage: a = P.structures(["a", "b", "c", "d"]).random_element(); a """ Returns the transport of this structure along the permutation perm. EXAMPLES:: sage: p = PermutationGroupElement((2,3,4)) sage: P = species.PermutationSpecies() sage: a = P.structures(["a", "b", "c", "d"]).random_element(); a """ p = self.permutation_group_element() p = perm*p*~perm return self.__class__(self.parent(), self._labels, p.list()) return self.__class__(self.parent(), self._labels, p.domain()) def automorphism_group(self): """ Returns the group of permutations whose action on this structure leave it fixed. EXAMPLES:: sage: p = PermutationGroupElement((2,3,4)) sage: P = species.PermutationSpecies() sage: a = P.structures(["a", "b", "c", "d"]).random_element(); a ['a', 'c', 'b', 'd'] sage: a.automorphism_group() Permutation Group with generators [(2,3), (1,4)] :: sage: [a.transport(perm) for perm in a.automorphism_group()] [['a', 'c', 'b', 'd'], ['a', 'c', 'b', 'd'],
• ## sage/combinat/tableau.py

`diff --git a/sage/combinat/tableau.py b/sage/combinat/tableau.py`
 a sage: rs = Tableau([[1, 2],[3]]).row_stabilizer() sage: PermutationGroupElement([(1,2),(3,)]) in rs True sage: rs.one().list() sage: rs.one().domain() [1, 2, 3] sage: rs = Tableau([[1],[2],[3]]).row_stabilizer() sage: rs.order()
• ## sage/combinat/tableau_tuple.py

`diff --git a/sage/combinat/tableau_tuple.py b/sage/combinat/tableau_tuple.py`
 a True sage: PermutationGroupElement([(1,4)]) in rs False sage: rs.one().list() sage: rs.one().domain() [1, 2, 3, 4, 5, 6, 7, 8, 9] """
• ## sage/combinat/words/finite_word.py

`diff --git a/sage/combinat/words/finite_word.py b/sage/combinat/words/finite_word.py`
 a from sage.groups.perm_gps.permgroup_element import PermutationGroupElement if not isinstance(permutation, Permutation_class): if isinstance(permutation, PermutationGroupElement): permutation = Permutation(permutation.list()) permutation = Permutation(permutation.domain()) else: permutation = Permutation(permutation) return self.parent()(permutation.action(self)) from sage.groups.perm_gps.permgroup_element import PermutationGroupElement if not isinstance(permutation, Permutation_class): if isinstance(permutation, PermutationGroupElement): permutation = Permutation(permutation.list()) permutation = Permutation(permutation.domain()) else: permutation = Permutation(permutation) alphabet = self.parent().alphabet()
• ## sage/crypto/classical.py

`diff --git a/sage/crypto/classical.py b/sage/crypto/classical.py`
 a sage: d(e(A(M))) == A(M) True """ from sage.combinat.permutation import Permutations S = self.cipher_domain() n = S.ngens() I = SymmetricGroup(n).random_element().list() I = Permutations(n).random_element() return S([ i-1 for i in I ]) def inverse_key(self, K):
• ## sage/graphs/generic_graph.py

`diff --git a/sage/graphs/generic_graph.py b/sage/graphs/generic_graph.py`
 a sage: for u,v in g.edges(labels = False): ...       if len(ag.orbit((u,v),action="OnPairs")) != 30: ...           print "ARggggggggggggg !!!" Empty group, correct domain:: sage: Graph({'a':['a'], 'b':[]}).automorphism_group() Permutation Group with generators [()] sage: Graph({'a':['a'], 'b':[]}).automorphism_group().domain() {'a', 'b'} """ from sage.groups.perm_gps.partn_ref.refinement_graphs import search_tree from sage.groups.perm_gps.permgroup import PermutationGroup gens = [ [ tuple([int_to_vertex[i] for i in cycle]) for cycle in gen] for gen in gens] output.append(PermutationGroup(gens = gens, domain = int_to_vertex.values())) else: output.append(PermutationGroup([[]])) output.append(PermutationGroup([[]], domain = self.vertices())) if order: output.append(c) if orbits:
• ## sage/homology/simplicial_complex.py

`diff --git a/sage/homology/simplicial_complex.py b/sage/homology/simplicial_complex.py`
 a sage: P.automorphism_group().is_isomorphic(AlternatingGroup(5)) True sage: Z = SimplicialComplex([[1,2],[2,3,'a']]) sage: Z = SimplicialComplex([['1','2'],['2','3','a']]) sage: Z.automorphism_group().is_isomorphic(CyclicPermutationGroup(2)) True sage: group = Z.automorphism_group() sage: group.domain() {1, 2, 3, 'a'} {'1', '2', '3', 'a'} """ from sage.groups.perm_gps.permgroup import PermutationGroup
• ## sage/modular/arithgroup/arithgroup_perm.py

`diff --git a/sage/modular/arithgroup/arithgroup_perm.py b/sage/modular/arithgroup/arithgroup_perm.py`
 a if not G.is_transitive(): raise ValueError, "Permutations do not generate a transitive group" s2 = [i-1 for i in S2.list()] s3 = [i-1 for i in S3.list()] l = [i-1 for i in L.list()] r = [i-1 for i in R.list()] s2 = [i-1 for i in S2.domain()] s3 = [i-1 for i in S3.domain()] l = [i-1 for i in L.domain()] r = [i-1 for i in R.domain()] _equalize_perms((s2,s3,l,r)) if inv.is_one(): # the group is even
• ## sage/rings/number_field/galois_group.py

`diff --git a/sage/rings/number_field/galois_group.py b/sage/rings/number_field/galois_group.py`
 a if self.order() == 1: return self._galois_closure # work around a silly error vecs = [pari(g.list()).Vecsmall() for g in self._elts] vecs = [pari(g.domain()).Vecsmall() for g in self._elts] v = self._ambient._pari_data.galoisfixedfield(vecs) x = self._galois_closure(v[1]) return self._galois_closure.subfield(x) Defn: w |--> -w """ L = self.parent().splitting_field() a = L(self.parent()._pari_data.galoispermtopol(pari(self.list()).Vecsmall())) a = L(self.parent()._pari_data.galoispermtopol(pari(self.domain()).Vecsmall())) return L.hom(a, L) def __call__(self, x):