<p dir="auto">I'm using numpy 1.12.0 version.</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="&gt;&gt;&gt; a= np.load('a.npy')
&gt;&gt;&gt; len(a)
1030703
&gt;&gt;&gt; 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])
&gt;&gt;&gt; np.fft.fft(a)"><pre class="notranslate"><code class="notranslate">&gt;&gt;&gt; a= np.load('a.npy')
&gt;&gt;&gt; len(a)
1030703
&gt;&gt;&gt; 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])
&gt;&gt;&gt; np.fft.fft(a)
</code></pre></div>
<p dir="auto">I've interrupted cause np.fft.fft(a) doesn't return while 1hours.</p>
<p dir="auto">Data I used<br>
<a href="http://home.wisewolf.org/static/a.npy" rel="nofollow">http://home.wisewolf.org/static/a.npy</a></p>
<p dir="auto"><em>Original ticket <a href="http://projects.scipy.org/numpy/ticket/506" rel="nofollow">http://projects.scipy.org/numpy/ticket/506</a> on 2007-04-27 by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/cournape/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/cournape">@cournape</a>, assigned to unknown.</em></p>
<p dir="auto">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 ?</p>
<p dir="auto">{{</p>
<h1 dir="auto">!python</h1>
<p dir="auto">import numpy as N<br>
from scipy import fftpack</p>
<h1 dir="auto">prime is a prime number</h1>
<p dir="auto">prime   = 100003</p>
<p dir="auto">a       = N.random.randn(prime)</p>
<p dir="auto">print 'scipy computing...'<br>
fftpack.fft(a)</p>
<p dir="auto">print 'numpy computing...'<br>
N.fft.fft(a)<br>
}}</p>