scikits.cuda.fft.fft

scikits.cuda.fft.fft(x_gpu, y_gpu, plan, scale=False)[source]

Fast Fourier Transform.

Compute the FFT of some data in device memory using the specified plan.

Parameters:

x_gpu : pycuda.gpuarray.GPUArray

Input array.

y_gpu : pycuda.gpuarray.GPUArray

FFT of input array.

plan : Plan

FFT plan.

scale : bool, optional

If True, scale the computed FFT by the number of elements in the input array.

Returns:

y_gpu : pycuda.gpuarray.GPUArray

Computed FFT.

Notes

For real to complex transformations, this function computes N/2+1 non-redundant coefficients of a length-N input signal.

Examples

>>> import pycuda.autoinit
>>> import pycuda.gpuarray as gpuarray
>>> import numpy as np
>>> N = 128
>>> x = np.asarray(np.random.rand(N), np.float32)
>>> xf = np.fft.fft(x)
>>> x_gpu = gpuarray.to_gpu(x)
>>> xf_gpu = gpuarray.empty(N/2+1, np.complex64)
>>> plan = Plan(x.shape, np.float32, np.complex64)
>>> fft(x_gpu, xf_gpu, plan)
>>> np.allclose(xf[0:N/2+1], xf_gpu.get(), atol=1e-6)
True