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'], ['a', 'c', 'b', 'd'], ['a', 'c', 'b', 'd']] """ from sage.groups.all import SymmetricGroup, PermutationGroup S = SymmetricGroup(len(self._labels)) p = self.permutation_group_element() return PermutationGroup(S.centralizer(p).gens())
def automorphism_group(self): """ Returns the group of permutations whose action on this structure leave it fixed. EXAMPLES:: sage: P = species.CycleSpecies() sage: a = P.structures([1, 2, 3, 4]).random_element(); a (1, 2, 3, 4) sage: a.automorphism_group() Permutation Group with generators [(1,2,3,4)] :: sage: [a.transport(perm) for perm in a.automorphism_group()] [(1, 2, 3, 4), (1, 2, 3, 4), (1, 2, 3, 4), (1, 2, 3, 4)] """ from sage.groups.all import SymmetricGroup, PermutationGroup S = SymmetricGroup(len(self._labels)) p = self.permutation_group_element() return PermutationGroup(S.centralizer(p).gens())