[Numpy-discussion] fourier with single precision

Warren Focke focke at slac.stanford.edu
Thu Aug 2 15:51:57 EDT 2007



On Thu, 2 Aug 2007, Lars Friedrich wrote:

> What I understood is that numpy uses FFTPACK's algorithms.

Sort of.  It appears to be a hand translation from F77 to C.

> From www.netlib.org/fftpack (is this the right address?) I took that 
> there is a single-precision and double-precision-version of the 
> algorithms. How hard would it be (for example for me...) to add the 
> single-precision versions to numpy? I am not a decent C-hacker, but if 
> someone tells me, that this task is not *too* hard, I would start 
> looking more closely at the code...

It shouldn't be hard.  fftpack.c will make a single-precision version if 
DOUBLE is not defined at compile time.

> Would it make sense, that if one passes an array of dtype =
> numpy.float32 to the fft function, a complex64 is returned, and if one
> passes an array of dtype = numpy.float64, a complex128 is returned?

Sounds like reasonable default behavior.  Might be useful if the caller 
could overrride it.


w




More information about the NumPy-Discussion mailing list