# HG changeset patch
# User Simon King <king@mathematik.unijena.de>
# Date 1226655022 3600
# Node ID 071adc46e263f4972eceed39c9152aec88c6aff3
# Parent 545b25190c747c7e1d0a143e970c848e6c6483dc
Slightly improved version of left_matrix_action
diff r 545b25190c74 r 071adc46e263 sage/rings/polynomial/multi_polynomial.pyx
a

b


388  388  cdef int n = len(Rgens) 
389  389  cdef int l = len(Coef) 
390  390  cdef int i,k 
391   
 391  cdef tuple X 
392  392  cdef list Y 
393  393  q = R(0) 
394  394  # The images of the ring variables under the action of self 
395  395  cdef list Im = [sum([Y[i]*Rgens[i] for i in xrange(n)]) for Y in M.list()] 
396  396  for i from 0<=i<l: 
397   X = Expo[i] 
 397  X = tuple(Expo[i]) 
398  398  c = Coef[i] 
399   q += c*prod([Im[k]**X[k] for k in xrange(n)]) 
 399  for k from 0<=k<n: 
 400  if X[k]: 
 401  c *= Im[k]**X[k] 
 402  q += c 
400  403  return q 
401  404  
402  405  def _mpoly_dict_recursive(self, vars=None, base_ring=None): 