def fftn(a, s=None, axes=None, norm=None): """Compute the N-dimensional FFT. Args: a (cupy.ndarray): Array to be transform. s (None or tuple of ints): Shape of the transformed axes of the output. If ``s`` is not given, the lengths of the input along the axes specified by ``axes`` are used. axes (tuple of ints): Axes over which to compute the FFT. norm (None or ``"ortho"``): Keyword to specify the normalization mode. Returns: cupy.ndarray: The transformed array which shape is specified by ``s`` and type will convert to complex if the input is other. .. seealso:: :func:`numpy.fft.fftn` """ return cufft.fft(a, s, axes, norm, cupy.cuda.cufft.CUFFT_FORWARD)
def fft(a, n=None, axis=-1, norm=None): """Compute the one-dimensional FFT. Args: a (cupy.ndarray): Array to be transform. n (None or int): Length of the transformed axis of the output. If ``n`` is not given, the length of the input along the axis specified by ``axis`` is used. axis (int): Axis over which to compute the FFT. norm (None or ``"ortho"``): Keyword to specify the normalization mode. Returns: cupy.ndarray: The transformed array which shape is specified by ``n`` and type will convert to complex if the input is other. .. seealso:: :func:`numpy.fft.fft` """ return cufft.fft(a, (n, ), (axis, ), norm, cupy.cuda.cufft.CUFFT_FORWARD)
def rfft2(a, s=None, axes=(-2, -1), norm=None): """Compute the two-dimensional FFT for real input. Args: a (cupy.ndarray): Array to be transform. s (None or tuple of ints): Shape to use from the input. If ``s`` is not given, the lengths of the input along the axes specified by ``axes`` are used. axes (tuple of ints): Axes over which to compute the FFT. norm (None or ``"ortho"``): Keyword to specify the normalization mode. Returns: cupy.ndarray: The transformed array which shape is specified by ``s`` and type will convert to complex if the input is other. The length of the last axis transformed will be ``s[-1]//2+1``. .. seealso:: :func:`numpy.fft.rfft2` """ return cufft.fft(a, s, axes, norm, cupy.cuda.cufft.CUFFT_FORWARD, 'R2C')
def irfftn(a, s=None, axes=None, norm=None): """Compute the N-dimensional inverse FFT for real input. Args: a (cupy.ndarray): Array to be transform. s (None or tuple of ints): Shape of the output. If ``s`` is not given, they are determined from the lengths of the input along the axes specified by ``axes``. axes (tuple of ints): Axes over which to compute the FFT. norm (None or ``"ortho"``): Keyword to specify the normalization mode. Returns: cupy.ndarray: The transformed array which shape is specified by ``s`` and type will convert to complex if the input is other. If ``s`` is not given, the length of final transformed axis of output will be ``2*(m-1)`` where `m` is the length of the final transformed axis of the input. .. seealso:: :func:`numpy.fft.irfftn` """ return cufft.fft(a, s, axes, norm, cupy.cuda.cufft.CUFFT_INVERSE, 'C2R')
def irfft(a, n=None, axis=-1, norm=None): """Compute the one-dimensional inverse FFT for real input. Args: a (cupy.ndarray): Array to be transform. n (None or int): Length of the transformed axis of the output. For ``n`` output points, ``n//2+1`` input points are necessary. If ``n`` is not given, it is determined from the length of the input along the axis specified by ``axis``. axis (int): Axis over which to compute the FFT. norm (None or ``"ortho"``): Keyword to specify the normalization mode. Returns: cupy.ndarray: The transformed array which shape is specified by ``n`` and type will convert to complex if the input is other. If ``n`` is not given, the length of the transformed axis is`2*(m-1)` where `m` is the length of the transformed axis of the input. .. seealso:: :func:`numpy.fft.irfft` """ return cufft.fft(a, (n, ), (axis, ), norm, cupy.cuda.cufft.CUFFT_INVERSE, 'C2R')