[Numpy-discussion] fourier with single precision

Charles R Harris charlesr.harris at gmail.com
Thu Aug 2 19:01:55 EDT 2007


On 8/2/07, Warren Focke <focke at slac.stanford.edu> wrote:
>
>
>
> 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.


On X86 machines the main virtue would be smaller and more cache friendly
arrays because double precision arithmetic is about the same speed as single
precision, sometimes even a bit faster. The PPC architecture does have
faster single than double precision, so there it could make a difference.

Chuck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20070802/70a4dd17/attachment.html>


More information about the NumPy-Discussion mailing list