title: Numpy/Scipy irfft strange behaviour
body: <p>I am resampling a real signal, and since I have at my disposal its fft from <code>rfft</code>, I want to use <code>irfft(signal, new_length)</code>. But I can't seem to get it working.</p>
  
  <p>This is a working code snippet that resamples a signal of length 4 using complex fft:</p>
  
  <pre><code>from numpy.fft import fft,ifft
  p=array([1.,2.2,4.,1.])
  pk=fft(p)
  pnew=ifft(pk,8)*(8./4.)
  </code></pre>
  
  <p>where the factor <code>(8./4.)</code> rescales from the original to the new length. You can check that <code>pnew[::2]==p</code>.</p>
  
  <p>Now, when I try to apply the same strategy with real Fourier transform, I get the wrong result at the original points:</p>
  
  <pre><code>from numpy.fft import rfft,irfft
  p=array([1.,2.2,4.,1.])
  pk=rfft(p)
  pnew=irfft(pk,8)*(8./4.)
  </code></pre>
  
  <p>and I have <code>pnew[::2]=[ 1.45,  1.75,  4.45,  0.55]!=p</code>.</p>
  
  <p>Does anybody have a clue of what is going on? I have tried using the routines from scipy, with the same result. The documentation itself discusses briefly how to do this, see <a href="http://docs.scipy.org/doc/numpy-1.6.0/reference/generated/numpy.fft.irfft.html#numpy.fft.irfft" rel="nofollow">here</a>, bottom of the page</p>