def fft_convolve(data, h, res_g = None,
                 plan = None, inplace = False,
                 kernel_is_fft = False,
                 kernel_is_fftshifted = False):
    
    """ convolves data with kernel h via FFTs

    
    data should be either a numpy array or a OCLArray (see doc for fft)
    both data and h should be same shape

    if data/h are OCLArrays, then:
        - type should be complex64
        - shape should be equal and power of two
        - h is assumed to be already fftshifted
         (otherwise set kernel_is_fftshifted  to true)
    
    """

    
    if isinstance(data,np.ndarray):
        return _fft_convolve_numpy(data, h,
                                   plan = plan,
                                   kernel_is_fft = kernel_is_fft,
                                   kernel_is_fftshifted = kernel_is_fftshifted)
    elif isinstance(data,OCLArray):
        return _fft_convolve_gpu(data,h, res_g = res_g,
                                 plan = plan, inplace = inplace,
                                 kernel_is_fft = kernel_is_fft)
    else:
        raise TypeError("array argument (1) has bad type: %s"%type(data))
convolves data with kernel h via FFTs

    
    data should be either a numpy array or a OCLArray (see doc for fft)
    both data and h should be same shape

    if data/h are OCLArrays, then:
        - type should be complex64
        - shape should be equal and power of two
        - h is assumed to be already fftshifted
         (otherwise set kernel_is_fftshifted  to true)