Ticket #4513: matrixgroupCallNew.patch

File matrixgroupCallNew.patch, 1.2 KB (added by SimonKing, 10 years ago)

Another version of left_matrix_action

  • sage/rings/polynomial/multi_polynomial.pyx

    # HG changeset patch
    # User Simon King <king@mathematik.uni-jena.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  
    388388        cdef int n = len(Rgens)
    389389        cdef int l = len(Coef)
    390390        cdef int i,k
    391        
     391        cdef tuple X
    392392        cdef list Y
    393393        q = R(0)
    394394        # The images of the ring variables under the action of self
    395395        cdef list Im = [sum([Y[i]*Rgens[i] for i in xrange(n)]) for Y in M.list()]
    396396        for i from 0<=i<l:
    397             X = Expo[i]
     397            X = tuple(Expo[i])
    398398            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
    400403        return q
    401404
    402405    def _mpoly_dict_recursive(self, vars=None, base_ring=None):