I think most of the problems here come from the fact that we're using the
wrong objects to do things. For many things, it makes much more sense to
use permutations as a product of cylces and store them this way etc. Maybe
the one that should be used here is more a "PermutationGroupElement" (I
never use this class so I don't really know how handy it is).

But the permutation object Permutation is more like a combinatorial object
that basically is a word with some extra properties. For example, I never
use the cycle notation... And for everything I do with permutations, the
list notation (and the list structure) is what I want. For me, the
list(perm), the perm[i], and the perm(i) all make sense and are useful.
Many algorithms on the Permutation object actually use this kind of
structure, especially all the "combinatorial maps" that send permutations
to other combinatorial objects like Dyck paths, binary trees, tableaux or
whatever.

Also, you have to keep in mind that this object has already been
implemented in a certain way, which is the "list way". I'm not saying it's
the good way but many people actually use this and rely on this on their
code (especially the perm[i] and perm(i), I myself have tons of code using
this).

Best

Viviane

2014-09-11 14:14 GMT+02:00 Pierre <pierre.guil...@gmail.com>:

> sorry some keyboard shortcut has sent the post. I was saying:
>
> def C(*args): #C for "cycle"
>     return Permutation([ args ])
>
> and then for (1, 2, 3)(4, 5) I type C(1, 2, 3) * C(4, 5). I got very used
> to it.
>
> cheers
> Pierre
>
>
> On Thursday, September 11, 2014 2:12:21 PM UTC+2, Pierre wrote:
>>
>> Hi all,
>>
>> Here are a few suggestions:
>>
>> (1) permutations have a to_matrix() method; permuting the rows of M
>> according to the permutation sigma can be done by
>>
>> M= M * sigma.to_matrix()
>>
>> and for the rows:
>>
>> M= sigma.to_matrix().transpose() * M
>>
>> Of course there is a debate about the behaviour of to_matrix() ; however
>> i think the code for matrices should rely on to_matrix(), and then at least
>> the conversation would be strictly one about the code for permutations.
>> This answers a complain above.
>>
>> (2) if sigma is a permutation, i don't think sigma[i] should make sense
>> at all. This requires the user to appreciate that sigma is implemented as a
>> list, which i think is not a good idea. Of course some people (including
>> me) want the permutation as a word; why not have a as_word() method, which
>> could take a bunch of parameters for shifting (starting from 0 instead of 1
>> for example...) ?
>>
>> Also, permutations should always print in cycle notation, just like in
>> GAP ! It's much easier to read, and drives the user away from the idea that
>> the permutation "is" a list.
>>
>> [By the way, i also don't think sigma(i) should be implemented. The
>> permutations in Sage act on the right, so i^sigma, just like in GAP, is
>> more logical. This is not a very useful comment as changing the behaviour
>> of standard ints is complicated (if possible at all?), and backward
>> compatibility is needed.]
>>
>> (3) in fact i agree that permutations should not be implemented as lists,
>> and should be thought of as acting on all integers from 0, as was
>> suggested. Would the multiplication be as fast if they were stored as lists
>> of cycles? I'm thinking that an implementation as a dictionnary, much like
>> a sparse matrix, would be reasonable.
>>
>> (4) Here's a notation I use when I have a lot of permutation to input
>> interactively:
>>
>> def C(*args) :  # C for "cycle"
>>
>>
>>
>>
>>
>>
>>
>>  --
> You received this message because you are subscribed to the Google Groups
> "sage-devel" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sage-devel+unsubscr...@googlegroups.com.
> To post to this group, send email to sage-devel@googlegroups.com.
> Visit this group at http://groups.google.com/group/sage-devel.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to