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.

Reply via email to