#NEWLINE# def fft( x_gpu , y_gpu , plan , scale = False ) : #NEWLINE# #INDENT# '\n    Fast Fourier Transform.\n\n    Compute the FFT of some data in device memory using the\n    specified plan.\n\n    Parameters\n    ----------\n    x_gpu : pycuda.gpuarray.GPUArray\n        Input array.\n    y_gpu : pycuda.gpuarray.GPUArray\n        FFT of input array.\n    plan : Plan\n        FFT plan.\n    scale : bool, optional\n        If True, scale the computed FFT by the number of elements in\n        the input array.\n\n    Examples\n    --------\n    >>> import pycuda.autoinit\n    >>> import pycuda.gpuarray as gpuarray\n    >>> import numpy as np\n    >>> N = 128\n    >>> x = np.asarray(np.random.rand(N), np.float32)\n    >>> xf = np.fft.fft(x)\n    >>> x_gpu = gpuarray.to_gpu(x)\n    >>> xf_gpu = gpuarray.empty(N/2+1, np.complex64)\n    >>> plan = Plan(x.shape, np.float32, np.complex64)\n    >>> fft(x_gpu, xf_gpu, plan)\n    >>> np.allclose(xf[0:N/2+1], xf_gpu.get(), atol=1e-6)\n    True\n\n    Returns\n    -------\n    y_gpu : pycuda.gpuarray.GPUArray\n        Computed FFT.\n\n    Notes\n    -----\n    For real to complex transformations, this function computes\n    N/2+1 non-redundant coefficients of a length-N input signal.\n\n    ' #NEWLINE# if ( scale == True ) : #NEWLINE# #INDENT# return _fft ( x_gpu , y_gpu , plan , cufft . CUFFT_FORWARD , ( x_gpu . size / plan . batch ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# return _fft ( x_gpu , y_gpu , plan , cufft . CUFFT_FORWARD )