Hi: The following function is useful for me and maybe for others. What is amusing is that I wrote it for vectors by it works equally well for matrices (and maybe other structures) unchanged. I'm happy to make a patch for it, if others are interested, but am not sure where it should go. Comments or criticisms?
def perm_action_on_matrix(g,v): """ Returns permutation of rows g*v; also works on vectors (permuting coordinates). EXAMPLES: sage: V = VectorSpace(GF(3),5) sage: v = V([0,1,2,0,1]) sage: G = SymmetricGroup(5) sage: g = G([(1,2,3)]) sage: perm_action_on_vector(g,v) (1, 2, 0, 0, 1) sage: MS = MatrixSpace(GF(3),3,7) sage: G = MS([[1,0,0,0,1,1,0],[0,1,0,1,0,1,0],[0,0,0,0,0,0,1]]) sage: S5 = SymmetricGroup(5) sage: g = S5([(1,2,3)]) sage: G; perm_action_on_vector(g,G) <BLANKLINE> [1 0 0 0 1 1 0] [0 1 0 1 0 1 0] [0 0 0 0 0 0 1] <BLANKLINE> [0 1 0 1 0 1 0] [0 0 0 0 0 0 1] [1 0 0 0 1 1 0] AUTHOR: David Joyner, licensed under the GPL v2 or greater. """ V = v.parent() n = len(list(v)) gv = [] for i in range(n): gv.append(v[g(i+1)-1]) return V(gv) --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-devel@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---