[Numpy-discussion] Re: [SciPy-user] numpy.dft.real+fft problem?

Travis Oliphant oliphant.travis at ieee.org
Mon Jan 16 13:57:04 CST 2006

Andrew Jaffe wrote:

>Hi All,
>[This has already appeared on python-scientific-devel; apologies to
>those of you seeing it twice...]
>There seems to be a problem with the real_fft routine; starting with a
>length n array, it should give a length n/2+1 array with real numbers
>in the first and last positions (for n even). However, note that the
>last entry on the first row has a real part, as opposed to the
>complex routine fft, which has it correct.
>The weirdness of the real part seems to imply  it's due to uninitialized

Thanks for the catch.  Yes it was due to uninitalized memory. 

PyArray_FromDims  always initializes the memory to zero (but it uses int 
* arguments).  The new routine was using PyArray_SimpleNew (using intp* 
arguments) which does not initialize the memory to zero.   Changing 
PyArray_SimpleNew to PyArray_Zeros fixed the problem.


More information about the Numpy-discussion mailing list