#10758: FFT.__setitem__ assumes values are uninitialized
-------------------------+--------------------------------------------------
   Reporter:  boothby    |       Owner:  jason, jkantor
       Type:  defect     |      Status:  new           
   Priority:  minor      |   Milestone:                
  Component:  numerical  |    Keywords:                
     Author:  boothby    |    Upstream:  N/A           
   Reviewer:             |      Merged:                
Work_issues:             |  
-------------------------+--------------------------------------------------
 Expected:
 {{{
 F = FFT(1)
 F[0] = (1,1)
 F[0] = 1
 print F[0]
 (1.0, 0.0)
 }}}

 Sage 4.6.1:
 {{{
 F = FFT(1)
 F[0] = (1,1)
 F[0] = 1
 print F[0]
 (1.0, 1.0)
 }}}

 Easy to fix:

 {{{
     def __setitem__(self, size_t i, xy):
         # just set real for now
         if i < 0 or i >= self.n:
             raise IndexError
         if isinstance(xy, (tuple, ComplexNumber)):
             self.data[2*i] = xy[0]
             self.data[2*i+1] = xy[1]
         else:
             self.data[2*i] = xy
 }}}

 by adding the line

 {{{
             self.data[2*i+1] = 0
 }}}

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/10758>
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