Ticket #8610: trac_8610.patch

File trac_8610.patch, 3.0 KB (added by was, 3 years ago)

rebased against 4.3.4

  • sage/modular/modsym/ambient.py

    # HG changeset patch
    # User William Stein <wstein@gmail.com>
    # Date 1269571788 25200
    # Node ID 5cdca91b73b6c279400e0b6578ae669888f2a777
    # Parent  db7143738e1dbcb0c5415884ebaeee4500da1520
    trac 8610 -- fix caching bug in modular/modsym/element.pyx
    
    diff --git a/sage/modular/modsym/ambient.py b/sage/modular/modsym/ambient.py
    a b  
    11191119         
    11201120        .. note:: 
    11211121 
    1122            Users will instead use the simpler interface defined, for 
    1123            example, by ``hecke_matrix()`` (see examples). 
     1122           Users will usually instead use the simpler interface 
     1123           defined, for example, by ``hecke_matrix()`` (see examples), 
     1124           though this function allows one to compute much more 
     1125           general operators. 
    11241126 
    11251127        INPUT: 
    11261128         
    11271129        -  ``codomain`` - space of modular symbols 
    11281130         
    1129         -  ``R`` (list) -- a list of lists `[a,b,c,d]` of length 4, which 
    1130           we view as elements of `GL_2(`QQ)`. 
     1131        - ``R`` (list) -- a list of lists `[a,b,c,d]` of length 4, 
     1132          which we view as elements of `GL_2(`QQ)`. 
    11311133         
    11321134         
    11331135        OUTPUT: 
    11341136 
    1135         (matrix) The matrix of the operator 
     1137         -- (matrix) The matrix of the operator 
    11361138         
    11371139        .. math:: 
    11381140         
  • sage/modular/modsym/element.py

    diff --git a/sage/modular/modsym/element.py b/sage/modular/modsym/element.py
    a b  
    294294        """ 
    295295        Returns a representation of self as a formal sum of Manin symbols. 
    296296         
    297         (The result is cached for future use.) 
    298  
    299297        EXAMPLE:: 
    300298 
    301             sage: ModularSymbols(37, 4).0.manin_symbol_rep() 
     299            sage: x = ModularSymbols(37, 4).0 
     300            sage: x.manin_symbol_rep() 
    302301            [X^2,(0,1)] 
     302 
     303        The result is cached:: 
     304 
     305            sage: x.manin_symbol_rep() is x.manin_symbol_rep() 
     306            True 
    303307        """ 
    304308        try: 
    305309            return self.__manin_symbols 
     
    312316                  range(v.degree()) if v[i] != 0], check=False, reduce=False) 
    313317            self.__manin_symbols = ms 
    314318        return self.__manin_symbols 
    315      
     319 
    316320    def modular_symbol_rep(self): 
    317321        """ 
    318322        Returns a representation of self as a formal sum of modular 
    319323        symbols. 
    320324         
    321         (The result is cached for future use.) 
    322          
    323325        EXAMPLE:: 
    324326 
    325             sage: ModularSymbols(37, 4).0.modular_symbol_rep() 
     327            sage: x = ModularSymbols(37, 4).0 
     328            sage: x.modular_symbol_rep() 
    326329            X^2*{0, Infinity} 
     330 
     331        The result is cached:: 
     332 
     333            sage: x.modular_symbol_rep() is x.modular_symbol_rep() 
     334            True 
    327335        """ 
    328336        try: 
    329337            return self.__modular_symbols 
     
    333341            if v == 0: 
    334342                return v 
    335343            w = [c * x.modular_symbol_rep() for c, x in v] 
    336             return sum(w) 
    337         return self.__modular_symbols 
     344            self.__modular_symbols = sum(w) 
     345            return self.__modular_symbols 
    338346 
    339347