#8890: map_support modifies the zero element of a free module!
------------------------+---------------------------------------------------
   Reporter:  jbandlow  |       Owner:  AlexGhitza
       Type:  defect    |      Status:  new       
   Priority:  major     |   Milestone:            
  Component:  algebra   |    Keywords:            
     Author:            |    Upstream:  N/A       
   Reviewer:            |      Merged:            
Work_issues:            |  
------------------------+---------------------------------------------------
 {{{
 sage: B = CombinatorialFreeModule(ZZ, ['a','b'])
 sage: B.an_element().map_support(lambda i: i)
 2*B['a'] + 2*B['b']
 sage: B.zero()
 2*B['a'] + 2*B['b']
 }}}

 Looking at the code exposes the problem:
 {{{
         res = self.parent()(0)
         z_elt = {}
         for m,c in self.monomial_coefficients().iteritems():
             z_elt[f(m)] = c
         res._monomial_coefficients = z_elt
         return res
 }}}

 We should not change the dictionary of zero!

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/8890>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sage-trac?hl=en.

Reply via email to