Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fft is unusable of moderately large arrays with a size which is a prime number (Trac #506) #1104

Closed
numpy-gitbot opened this issue Oct 19, 2012 · 7 comments

Comments

@numpy-gitbot
Copy link

commented Oct 19, 2012

Original ticket http://projects.scipy.org/numpy/ticket/506 on 2007-04-27 by @cournape, assigned to unknown.

Currently, using fft on arrays of size which has a prime number is extremely slow (up to 15 minutes for eg an array of size 100003). The major problem though is that the code being uninterruptible, this effectively kills the current python session. My understanding is that the fft in numpy is using fftpack converted in C, which uses a O(N^2) algorithm for prime numbers ? Would it be possible at least to make the code interruptible ?

{{

!python

import numpy as N
from scipy import fftpack

prime is a prime number

prime = 100003

a = N.random.randn(prime)

print 'scipy computing...'
fftpack.fft(a)

print 'numpy computing...'
N.fft.fft(a)
}}

@numpy-gitbot

This comment has been minimized.

Copy link
Author

commented Oct 19, 2012

Attachment added by @cournape on 2007-04-27: interruptible_fft.patch

@numpy-gitbot

This comment has been minimized.

Copy link
Author

commented Oct 19, 2012

@cournape wrote on 2007-04-27

I attached a patch which solves the interruptible part.

@numpy-gitbot

This comment has been minimized.

Copy link
Author

commented Oct 19, 2012

@alberts wrote on 2007-05-12

Looks like the interruptible patch at least can be applied for 1.0.3. After that the milestone should probably be updated to address the rest of the issue in a next release.

@numpy-gitbot

This comment has been minimized.

Copy link
Author

commented Oct 19, 2012

Milestone changed to 1.0.3 Release by @alberts on 2007-05-12

@numpy-gitbot

This comment has been minimized.

Copy link
Author

commented Oct 19, 2012

@charris wrote on 2007-05-12

As far as I know, there is no fast algorithm for the prime numbers other than fast convolution, i.e., http://en.wikipedia.org/wiki/Bluestein's_FFT_algorithm. As Bluestein's algorithm also works for the chirp-z transform we might prefer to implement the latter, or maybe put it in scipy.

@numpy-gitbot

This comment has been minimized.

Copy link
Author

commented Oct 19, 2012

@charris wrote on 2007-05-13

Davids patch works for me, so I am going to commit the patch and close the bug. Making a fast transform for a prime number of elements is an enhancement. We probably need a chirp-z transform, either in numpy or in scipy, but its current lack is not a bug.

@numpy-gitbot

This comment has been minimized.

Copy link
Author

commented Oct 19, 2012

@stefanv wrote on 2007-05-13

According to

http://www.fftw.org/fftw-paper-ieee.pdf

FFTW implements Bluestein's algorithm. A python implementation is available at

http://www.mail-archive.com/numpy-discussion@scipy.org/msg01812.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.