10000 numpy.fft doesn't works. · Issue #8639 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

numpy.fft doesn't works. #8639

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

Closed
elwlwlwk opened this issue Feb 19, 2017 · 10 comments
Closed

numpy.fft doesn't works. #8639

elwlwlwk opened this issue Feb 19, 2017 · 10 comments

Comments

@elwlwlwk
Copy link
elwlwlwk commented Feb 19, 2017

I'm using numpy 1.12.0 version.

>>> a= np.load('a.npy')
>>> len(a)
1030703
>>> np.fft.fft(a[0:len(a)-3])
array([-18765.00000000    +0.j        ,  11107.65388924+14875.98484147j,
        -1335.17295525 +4724.62925166j, ...,
         -386.13524067  +590.33225249j,  -1335.17295525 -4724.62925166j,
        11107.65388924-14875.98484147j])
>>> np.fft.fft(a)

I've interrupted cause np.fft.fft(a) doesn't return while 1hours.

Data I used
http://home.wisewolf.org/static/a.npy

@seberg
Copy link
Member
seberg commented Feb 19, 2017

1030703 is a prime number, which is probably the reason. Some other fft implementations are probably faster with that, but there is also the typical method of padding the array with zeros to avoid these inefficient FFT cases.

@jason-s
Copy link
jason-s commented Nov 13, 2018

I ran into this today; an array of length 1000000 has almost instant fft calculation, 986656 (=32112803) takes a few seconds, and 986626 (=2*493313) takes longer than I have patience for.

The content doesn't seem to matter; I can use np.fft.fft(np.arange(986626)) and it will hang.

What does padding do to the FFT results?

Is there any way to accomplish an equivalent fft to what I want, but faster, by specifying some parameter to np.fft.fft?

@jason-s
Copy link
jason-s commented Nov 13, 2018

hmm... looks like a duplicate of #1104

@charris
Copy link
Member
charris commented Nov 13, 2018

Should be fixed when 1.17 is release next year.

@jason-s
Copy link
jason-s commented Nov 13, 2018

Is that going to be Python 3.0 only? or 2.7 also?

@charris
Copy link
Member
charris commented Nov 13, 2018
8000

Python 3. It can probably be compiled for Python 2.7 as long as you avoid Windows, it needs Python compiled with a C99 compliant compiler.

@charris
Copy link
Member
charris commented Nov 13, 2018

Anaconda may be using the MKL fft for their distro, I don't know if it works with large prime sizes.

@seberg
Copy link
Member
seberg commented Nov 14, 2018

You can also install pyfftw. Though I think the pip install expects an existing FFTW install on the system (don't quite remember). But, maybe it is fast to install and it should solve these extreme cases.

@seberg
Copy link
Member
seberg commented Nov 14, 2018

A, but yes, padding should be a pretty good solution. I am not quite sure how much padding changes things, but it is a pretty standard method.

@seberg
Copy link
Member
seberg commented Nov 5, 2021

Solved for a long time with the new pocketfft supporting bluestein's algorithm

@seberg seberg closed this as completed Nov 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants
0