# 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
|
b
|
|
4101 | 4101 | %(str(aut_B_aug.__interface[gap]),str(H)))) |
4102 | 4102 | # print 'rt_transversal:', rt_transversal |
4103 | 4103 | rt_transversal = [PermutationGroupElement(g) for g in rt_transversal if str(g) != '()'] |
4104 | | rt_transversal = [[a-1 for a in g.list()] for g in rt_transversal] |
| 4104 | rt_transversal = [[a-1 for a in g.domain()] for g in rt_transversal] |
4105 | 4105 | rt_transversal = [g + range(len(g), n) for g in rt_transversal] |
4106 | 4106 | rt_transversal.append(range(n)) |
4107 | 4107 | # print 'rt_transversal:', rt_transversal |
diff --git a/sage/combinat/permutation.py b/sage/combinat/permutation.py
a
|
b
|
|
352 | 352 | [2, 5, 3, 4, 1] |
353 | 353 | sage: type(p) |
354 | 354 | <class 'sage.combinat.permutation.Permutation_class'> |
355 | | |
| 355 | |
356 | 356 | Construction from a string in cycle notation |
357 | | |
| 357 | |
358 | 358 | :: |
359 | | |
| 359 | |
360 | 360 | sage: p = Permutation( '(4,5)' ); p |
361 | 361 | [1, 2, 3, 5, 4] |
362 | | |
| 362 | |
363 | 363 | The size of the permutation is the maximum integer appearing; add |
364 | 364 | a 1-cycle to increase this:: |
365 | | |
| 365 | |
366 | 366 | sage: p2 = Permutation( '(4,5)(10)' ); p2 |
367 | 367 | [1, 2, 3, 5, 4, 6, 7, 8, 9, 10] |
368 | 368 | sage: len(p); len(p2) |
369 | 369 | 5 |
370 | 370 | 10 |
371 | | |
| 371 | |
372 | 372 | We construct a Permutation from a PermutationGroupElement:: |
373 | | |
| 373 | |
374 | 374 | sage: g = PermutationGroupElement([2,1,3]) |
375 | 375 | sage: Permutation(g) |
376 | 376 | [2, 1, 3] |
377 | | |
| 377 | |
378 | 378 | From a pair of tableaux of the same shape. This uses the inverse |
379 | 379 | of Robinson Schensted algorithm:: |
380 | 380 | |
… |
… |
|
411 | 411 | if isinstance(l, Permutation_class): |
412 | 412 | return l |
413 | 413 | elif isinstance(l, PermutationGroupElement): |
414 | | l = l.list() |
| 414 | l = l.domain() |
415 | 415 | |
416 | 416 | #if l is a string, then assume it is in cycle notation |
417 | 417 | elif isinstance(l, str): |
… |
… |
|
3863 | 3863 | if not isinstance(pge, PermutationGroupElement): |
3864 | 3864 | raise TypeError, "pge (= %s) must be a PermutationGroupElement"%pge |
3865 | 3865 | |
3866 | | return Permutation(pge.list()) |
| 3866 | return Permutation(pge.domain()) |
3867 | 3867 | |
3868 | 3868 | def from_rank(n, rank): |
3869 | 3869 | r""" |
diff --git a/sage/combinat/species/permutation_species.py b/sage/combinat/species/permutation_species.py
a
|
b
|
|
45 | 45 | def permutation_group_element(self): |
46 | 46 | """ |
47 | 47 | Returns self as a permutation group element. |
48 | | |
| 48 | |
49 | 49 | EXAMPLES:: |
50 | | |
| 50 | |
51 | 51 | sage: p = PermutationGroupElement((2,3,4)) |
52 | 52 | sage: P = species.PermutationSpecies() |
53 | 53 | sage: a = P.structures(["a", "b", "c", "d"]).random_element(); a |
… |
… |
|
62 | 62 | """ |
63 | 63 | Returns the transport of this structure along the permutation |
64 | 64 | perm. |
65 | | |
| 65 | |
66 | 66 | EXAMPLES:: |
67 | | |
| 67 | |
68 | 68 | sage: p = PermutationGroupElement((2,3,4)) |
69 | 69 | sage: P = species.PermutationSpecies() |
70 | 70 | sage: a = P.structures(["a", "b", "c", "d"]).random_element(); a |
… |
… |
|
74 | 74 | """ |
75 | 75 | p = self.permutation_group_element() |
76 | 76 | p = perm*p*~perm |
77 | | return self.__class__(self.parent(), self._labels, p.list()) |
| 77 | return self.__class__(self.parent(), self._labels, p.domain()) |
78 | 78 | |
79 | 79 | def automorphism_group(self): |
80 | 80 | """ |
81 | 81 | Returns the group of permutations whose action on this structure |
82 | 82 | leave it fixed. |
83 | | |
| 83 | |
84 | 84 | EXAMPLES:: |
85 | | |
| 85 | |
86 | 86 | sage: p = PermutationGroupElement((2,3,4)) |
87 | 87 | sage: P = species.PermutationSpecies() |
88 | 88 | sage: a = P.structures(["a", "b", "c", "d"]).random_element(); a |
89 | 89 | ['a', 'c', 'b', 'd'] |
90 | 90 | sage: a.automorphism_group() |
91 | 91 | Permutation Group with generators [(2,3), (1,4)] |
92 | | |
| 92 | |
93 | 93 | :: |
94 | | |
| 94 | |
95 | 95 | sage: [a.transport(perm) for perm in a.automorphism_group()] |
96 | 96 | [['a', 'c', 'b', 'd'], |
97 | 97 | ['a', 'c', 'b', 'd'], |
diff --git a/sage/combinat/tableau.py b/sage/combinat/tableau.py
a
|
b
|
|
1639 | 1639 | sage: rs = Tableau([[1, 2],[3]]).row_stabilizer() |
1640 | 1640 | sage: PermutationGroupElement([(1,2),(3,)]) in rs |
1641 | 1641 | True |
1642 | | sage: rs.one().list() |
| 1642 | sage: rs.one().domain() |
1643 | 1643 | [1, 2, 3] |
1644 | 1644 | sage: rs = Tableau([[1],[2],[3]]).row_stabilizer() |
1645 | 1645 | sage: rs.order() |
diff --git a/sage/combinat/tableau_tuple.py b/sage/combinat/tableau_tuple.py
a
|
b
|
|
939 | 939 | True |
940 | 940 | sage: PermutationGroupElement([(1,4)]) in rs |
941 | 941 | False |
942 | | sage: rs.one().list() |
| 942 | sage: rs.one().domain() |
943 | 943 | [1, 2, 3, 4, 5, 6, 7, 8, 9] |
944 | 944 | """ |
945 | 945 | |
diff --git a/sage/combinat/words/finite_word.py b/sage/combinat/words/finite_word.py
a
|
b
|
|
6142 | 6142 | from sage.groups.perm_gps.permgroup_element import PermutationGroupElement |
6143 | 6143 | if not isinstance(permutation, Permutation_class): |
6144 | 6144 | if isinstance(permutation, PermutationGroupElement): |
6145 | | permutation = Permutation(permutation.list()) |
| 6145 | permutation = Permutation(permutation.domain()) |
6146 | 6146 | else: |
6147 | 6147 | permutation = Permutation(permutation) |
6148 | 6148 | return self.parent()(permutation.action(self)) |
… |
… |
|
6170 | 6170 | from sage.groups.perm_gps.permgroup_element import PermutationGroupElement |
6171 | 6171 | if not isinstance(permutation, Permutation_class): |
6172 | 6172 | if isinstance(permutation, PermutationGroupElement): |
6173 | | permutation = Permutation(permutation.list()) |
| 6173 | permutation = Permutation(permutation.domain()) |
6174 | 6174 | else: |
6175 | 6175 | permutation = Permutation(permutation) |
6176 | 6176 | alphabet = self.parent().alphabet() |
diff --git a/sage/crypto/classical.py b/sage/crypto/classical.py
a
|
b
|
|
3139 | 3139 | sage: d(e(A(M))) == A(M) |
3140 | 3140 | True |
3141 | 3141 | """ |
| 3142 | from sage.combinat.permutation import Permutations |
3142 | 3143 | S = self.cipher_domain() |
3143 | 3144 | n = S.ngens() |
3144 | | I = SymmetricGroup(n).random_element().list() |
| 3145 | I = Permutations(n).random_element() |
3145 | 3146 | return S([ i-1 for i in I ]) |
3146 | 3147 | |
3147 | 3148 | def inverse_key(self, K): |
diff --git a/sage/graphs/generic_graph.py b/sage/graphs/generic_graph.py
a
|
b
|
|
16194 | 16194 | sage: for u,v in g.edges(labels = False): |
16195 | 16195 | ... if len(ag.orbit((u,v),action="OnPairs")) != 30: |
16196 | 16196 | ... print "ARggggggggggggg !!!" |
| 16197 | |
| 16198 | Empty group, correct domain:: |
| 16199 | |
| 16200 | sage: Graph({'a':['a'], 'b':[]}).automorphism_group() |
| 16201 | Permutation Group with generators [()] |
| 16202 | sage: Graph({'a':['a'], 'b':[]}).automorphism_group().domain() |
| 16203 | {'a', 'b'} |
16197 | 16204 | """ |
16198 | 16205 | from sage.groups.perm_gps.partn_ref.refinement_graphs import search_tree |
16199 | 16206 | from sage.groups.perm_gps.permgroup import PermutationGroup |
… |
… |
|
16292 | 16299 | gens = [ [ tuple([int_to_vertex[i] for i in cycle]) for cycle in gen] for gen in gens] |
16293 | 16300 | output.append(PermutationGroup(gens = gens, domain = int_to_vertex.values())) |
16294 | 16301 | else: |
16295 | | output.append(PermutationGroup([[]])) |
| 16302 | output.append(PermutationGroup([[]], domain = self.vertices())) |
16296 | 16303 | if order: |
16297 | 16304 | output.append(c) |
16298 | 16305 | if orbits: |
diff --git a/sage/homology/simplicial_complex.py b/sage/homology/simplicial_complex.py
a
|
b
|
|
3142 | 3142 | sage: P.automorphism_group().is_isomorphic(AlternatingGroup(5)) |
3143 | 3143 | True |
3144 | 3144 | |
3145 | | sage: Z = SimplicialComplex([[1,2],[2,3,'a']]) |
| 3145 | sage: Z = SimplicialComplex([['1','2'],['2','3','a']]) |
3146 | 3146 | sage: Z.automorphism_group().is_isomorphic(CyclicPermutationGroup(2)) |
3147 | 3147 | True |
3148 | 3148 | sage: group = Z.automorphism_group() |
3149 | 3149 | sage: group.domain() |
3150 | | {1, 2, 3, 'a'} |
| 3150 | {'1', '2', '3', 'a'} |
3151 | 3151 | """ |
3152 | 3152 | from sage.groups.perm_gps.permgroup import PermutationGroup |
3153 | 3153 | |
diff --git a/sage/modular/arithgroup/arithgroup_perm.py b/sage/modular/arithgroup/arithgroup_perm.py
a
|
b
|
|
459 | 459 | if not G.is_transitive(): |
460 | 460 | raise ValueError, "Permutations do not generate a transitive group" |
461 | 461 | |
462 | | s2 = [i-1 for i in S2.list()] |
463 | | s3 = [i-1 for i in S3.list()] |
464 | | l = [i-1 for i in L.list()] |
465 | | r = [i-1 for i in R.list()] |
| 462 | s2 = [i-1 for i in S2.domain()] |
| 463 | s3 = [i-1 for i in S3.domain()] |
| 464 | l = [i-1 for i in L.domain()] |
| 465 | r = [i-1 for i in R.domain()] |
466 | 466 | _equalize_perms((s2,s3,l,r)) |
467 | 467 | |
468 | 468 | if inv.is_one(): # the group is even |
diff --git a/sage/rings/number_field/galois_group.py b/sage/rings/number_field/galois_group.py
a
|
b
|
|
589 | 589 | if self.order() == 1: |
590 | 590 | return self._galois_closure # work around a silly error |
591 | 591 | |
592 | | vecs = [pari(g.list()).Vecsmall() for g in self._elts] |
| 592 | vecs = [pari(g.domain()).Vecsmall() for g in self._elts] |
593 | 593 | v = self._ambient._pari_data.galoisfixedfield(vecs) |
594 | 594 | x = self._galois_closure(v[1]) |
595 | 595 | return self._galois_closure.subfield(x) |
… |
… |
|
644 | 644 | Defn: w |--> -w |
645 | 645 | """ |
646 | 646 | L = self.parent().splitting_field() |
647 | | a = L(self.parent()._pari_data.galoispermtopol(pari(self.list()).Vecsmall())) |
| 647 | a = L(self.parent()._pari_data.galoispermtopol(pari(self.domain()).Vecsmall())) |
648 | 648 | return L.hom(a, L) |
649 | 649 | |
650 | 650 | def __call__(self, x): |