FFT in sage.

238 views
Skip to first unread message

ancienthart

unread,
Oct 2, 2010, 12:34:56 AM10/2/10
to sage-devel
I get the following:

a = FFT(4)
a[1] = 2
a.forward_transform()

Everything works fine up to here. Then, when I do this:

a.backward_transform()
a

I get:
NameError: name 'a' is not defined

Any ideas?

Joal Heagney

Tom Boothby

unread,
Oct 2, 2010, 6:39:38 AM10/2/10
to sage-...@googlegroups.com
Was this on sagenb.org? Frequently, the server will kill your process
at the most inopportune times...

> --
> To post to this group, send an email to sage-...@googlegroups.com
> To unsubscribe from this group, send an email to
> sage-devel+...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/sage-devel
> URL: http://www.sagemath.org
>

Mitesh Patel

unread,
Oct 2, 2010, 6:57:07 AM10/2/10
to sage-...@googlegroups.com
On 10/02/2010 05:39 AM, Tom Boothby wrote:
> Was this on sagenb.org? Frequently, the server will kill your process
> at the most inopportune times...
>
> On 10/1/10, ancienthart <joalh...@gmail.com> wrote:
>> I get the following:
>>
>> a = FFT(4)
>> a[1] = 2
>> a.forward_transform()
>>
>> Everything works fine up to here. Then, when I do this:
>>
>> a.backward_transform()
>> a
>>
>> I get:
>> NameError: name 'a' is not defined
>>
>> Any ideas?
>>
>> Joal Heagney

I get

sage: a.backward_transform()


------------------------------------------------------------
Unhandled SIGSEGV: A segmentation fault occurred in Sage.
This probably occurred because a *compiled* component
of Sage has a bug in it (typically accessing invalid memory)
or is not properly wrapped with _sig_on, _sig_off.
You might want to run Sage under gdb with 'sage -gdb' to debug this.
Sage will now terminate (sorry).
------------------------------------------------------------

if the number of points is a power of two.

From near the end of sage/gsl/fft.pyx:

def backward_transform(self):
cdef gsl_fft_complex_wavetable * wt
cdef gsl_fft_complex_workspace * mem
N = Integer(self.n)
e = N.exact_log(2)
if N==2**e:
gsl_fft_complex_backward(self.data, self.stride, self.n, wt,
mem)

Should this be

gsl_fft_complex_radix2_backward(self.data, self.stride, self.n)

(and similarly for inverse_transform)?

if N!=2**e:
mem = gsl_fft_complex_workspace_alloc(self.n)
wt = gsl_fft_complex_wavetable_alloc(self.n)
gsl_fft_complex_backward(self.data, self.stride, self.n, wt,
mem)
gsl_fft_complex_workspace_free(mem)
gsl_fft_complex_wavetable_free(wt)

That the notebook sometimes doesn't show the SIGSEGV message may be a
different problem.

Tom Boothby

unread,
Oct 2, 2010, 2:00:17 PM10/2/10
to sage-...@googlegroups.com
> That the notebook sometimes doesn't show the SIGSEGV message may be a
> different problem.

Yes, this is a fun interplay between two bugs.

Mitesh Patel

unread,
Oct 2, 2010, 5:17:11 PM10/2/10
to sage-...@googlegroups.com
On 10/02/2010 05:57 AM, Mitesh Patel wrote:
>> On 10/1/10, ancienthart <joalh...@gmail.com> wrote:
>>> I get the following:
>>>
>>> a = FFT(4)
>>> a[1] = 2
>>> a.forward_transform()
>>>
>>> Everything works fine up to here. Then, when I do this:
>>>
>>> a.backward_transform()
>>> a
>>>
>>> I get:
>>> NameError: name 'a' is not defined
>>>
>>> Any ideas?
>>>
>>> Joal Heagney
>
> I get
>
> sage: a.backward_transform()
>
>
> ------------------------------------------------------------
> Unhandled SIGSEGV: A segmentation fault occurred in Sage.
> This probably occurred because a *compiled* component
> of Sage has a bug in it (typically accessing invalid memory)
> or is not properly wrapped with _sig_on, _sig_off.
> You might want to run Sage under gdb with 'sage -gdb' to debug this.
> Sage will now terminate (sorry).
> ------------------------------------------------------------
>
> if the number of points is a power of two.

I've opened

http://trac.sagemath.org/sage_trac/ticket/10058

for this.

Reply all
Reply to author
Forward
0 new messages