Changes between Initial Version and Version 1 of Ticket #25477, comment 47
 Timestamp:
 06/06/18 08:34:24 (4 years ago)
Legend:
 Unmodified
 Added
 Removed
 Modified

Ticket #25477, comment 47
initial v1 3 3 Beside this, I arrived at the following, and wonder if this is okay doing: Given I have 4 4 5 * a PermutationGroupElement "sample" and 6 * a list "new_perm" representing a permutation in oneline notation in the *same permutation group* as "sample" 5 * a {{{PermutationGroupElement}}} "sample" and 6 * a {{{list}}} "new_perm" representing a permutation in oneline notation in the *same permutation group* as "sample" 7 8 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_}}}. 7 9 8 10 An example would be 9 10 sage: sample = Permutation([2,3,4,1]) 11 {{{ 12 sage: S = PermutationGroup(SymmetricGroup(4).gens()) 13 sage: sample = S([2,3,4,1]) 11 14 sage: lst1 = [] 12 15 sage: lst2 = [2,1] 13 16 sage: lst3 = [4,3,2,1] 14 15 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_}}}. 16 17 I thus provide the following new method: 18 19 20 21 22 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. 17 sage: pi1 = sample._generate_new(lst1); pi1 18 () 19 sage: pi2 = sample._generate_new(lst2); pi2 20 (1,2) 21 sage: pi3 = sample._generate_new(lst3); pi3 22 (1,4)(2,3) 23 }}}