# Changes between Initial Version and Version 1 of Ticket #25477, comment 47

Ignore:
Timestamp:
06/06/18 08:34:24 (4 years ago)
Comment:

Unmodified
Removed
Modified
• ## Ticket #25477, comment 47

 initial Beside this, I arrived at the following, and wonder if this is okay doing: Given I have * a PermutationGroupElement "sample" and * a list "new_perm" representing a permutation in one-line notation in the *same permutation group* as "sample" * a {{{PermutationGroupElement}}} "sample" and * a {{{list}}} "new_perm" representing a permutation in one-line notation in the *same permutation group* as "sample" It seems that, oddly, we do not have a fast way of generating new permutations from these lists, despite the fact that we can multiply permutations very fast. I thus provide a new {{{PermutationGroupElement}}} method {{{_generate_new}}} that basically takes a copy from the given {{{PermutationGroupElement}}} and only overwrites its underlying c list. The code is basically copied from {{{_mul_}}}. An example would be sage: sample = Permutation([2,3,4,1]) {{{ sage: S = PermutationGroup(SymmetricGroup(4).gens()) sage: sample = S([2,3,4,1]) sage: lst1 = [] sage: lst2 = [2,1] sage: lst3 = [4,3,2,1] It seems that, oddly, we do not have a fast way of generating new permutations from these lists, despite the fact that we can multiply permutations very fast. I thus provide a new {{{PermutationGroupElement}}} method {{{_generate_new}}} that basically takes a copy from the given {{{PermutationGroupElement}}} and only overwrites its underlying c list. The code is basically copied from {{{_mul_}}}. I thus provide the following new method: Constructing one from "new_perm" in the parent of "sample" is too slow, so I tried to mimic the "_mul_" function which is really fast. sage: pi1 = sample._generate_new(lst1); pi1 () sage: pi2 = sample._generate_new(lst2); pi2 (1,2) sage: pi3 = sample._generate_new(lst3); pi3 (1,4)(2,3) }}}