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


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

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #25477, comment 47

    initial v1  
    33Beside this, I arrived at the following, and wonder if this is okay doing: Given I have
    44
    5 * a PermutationGroupElement "sample" and
    6 * a list "new_perm" representing a permutation in one-line notation in the *same permutation group* as "sample"
     5* a {{{PermutationGroupElement}}} "sample" and
     6* a {{{list}}} "new_perm" representing a permutation in one-line notation in the *same permutation group* as "sample"
     7
     8It 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_}}}.
    79
    810An example would be
    9 
    10 sage: sample = Permutation([2,3,4,1])
     11{{{
     12sage: S = PermutationGroup(SymmetricGroup(4).gens())
     13sage: sample = S([2,3,4,1])
    1114sage: lst1 = []
    1215sage: lst2 = [2,1]
    1316sage: 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.
     17sage: pi1 = sample._generate_new(lst1); pi1
     18()
     19sage: pi2 = sample._generate_new(lst2); pi2
     20(1,2)
     21sage: pi3 = sample._generate_new(lst3); pi3
     22(1,4)(2,3)
     23}}}