Skip to content

Commit

Permalink
Fixed error in the FFT.__setitem__ function. The function was assumin…
Browse files Browse the repository at this point in the history
…g that the pair of values was uninitalized when

assigning values to it.
  • Loading branch information
Noel Roemmele committed Feb 2, 2025
1 parent dc99dc8 commit 2b22f25
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/sage/calculus/transforms/fft.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,16 @@ cdef class FastFourierTransform_complex(FastFourierTransform_base):
Traceback (most recent call last):
...
TypeError: unable to convert 1.0*I to float; use abs() or real_part() as desired
TESTS:
Assigning a value to a pair no longer assumes that the values are uninitialized. ::
sage: F = FFT(1)
sage: F[0] = (1,1)
sage: F[0] = 1
sage: F[0]
(1.0, 0.0)
"""
# just set real for now
if i < 0 or i >= self.n:
Expand All @@ -172,6 +182,7 @@ cdef class FastFourierTransform_complex(FastFourierTransform_base):
self.data[2*i+1] = xy[1]
else:
self.data[2*i] = xy
self.data[2*i+1] = 0

def __getitem__(self, i):
"""
Expand Down

0 comments on commit 2b22f25

Please sign in to comment.