# HG changeset patch
# User Simon King <king@mathematik.unijena.de>
# Date 1226664836 3600
# Node ID 0cb18c96c09fdf35b542c4ec85478cf897810c85
# Parent 071adc46e263f4972eceed39c9152aec88c6aff3
Slight improvement of left_matrix_action by reversing the polynomial addition; extended functionality (in view of future applications)
diff r 071adc46e263 r 0cb18c96c09f sage/rings/polynomial/multi_polynomial.pyx
a

b


380  380  sage: p=x*y^2 
381  381  sage: p.left_matrix_action(g) 
382  382  x^3 + x^2*y  x*y^2  y^3 
 383  
 384  To speed up repeated action of one matrix group element g, 
 385  one can provide the list of images of the variables under 
 386  the action of g, rather than g itself. 
 387  
 388  EXAMPLE: 
 389  sage: L=[X.left_matrix_action(g) for X in R.gens()] 
 390  sage: p.left_matrix_action(L) 
 391  x^3 + x^2*y  x*y^2  y^3 
383  392  """ 
384  393  R = self.parent() 
385  394  cdef tuple Rgens = R.gens() 
… 
… 

392  401  cdef list Y 
393  402  q = R(0) 
394  403  # The images of the ring variables under the action of self 
395   cdef list Im = [sum([Y[i]*Rgens[i] for i in xrange(n)]) for Y in M.list()] 
396   for i from 0<=i<l: 
 404  cdef list Im 
 405  if isinstance(M,list): 
 406  Im = M 
 407  else: 
 408  Im = [sum([Y[i]*Rgens[i] for i in xrange(n)]) for Y in M.list()] 
 409  for i from l>i>=0: 
397  410  X = tuple(Expo[i]) 
398  411  c = Coef[i] 
399  412  for k from 0<=k<n: 