Discrete Fourier transforms (cupyx.scipy.fft)#

Fast Fourier Transforms (FFTs)#

fft(x[, n, axis, norm, overwrite_x, plan])

Compute the one-dimensional FFT.

ifft(x[, n, axis, norm, overwrite_x, plan])

Compute the one-dimensional inverse FFT.

fft2(x[, s, axes, norm, overwrite_x, plan])

Compute the two-dimensional FFT.

ifft2(x[, s, axes, norm, overwrite_x, plan])

Compute the two-dimensional inverse FFT.

fftn(x[, s, axes, norm, overwrite_x, plan])

Compute the N-dimensional FFT.

ifftn(x[, s, axes, norm, overwrite_x, plan])

Compute the N-dimensional inverse FFT.

rfft(x[, n, axis, norm, overwrite_x, plan])

Compute the one-dimensional FFT for real input.

irfft(x[, n, axis, norm, overwrite_x, plan])

Compute the one-dimensional inverse FFT for real input.

rfft2(x[, s, axes, norm, overwrite_x, plan])

Compute the two-dimensional FFT for real input.

irfft2(x[, s, axes, norm, overwrite_x, plan])

Compute the two-dimensional inverse FFT for real input.

rfftn(x[, s, axes, norm, overwrite_x, plan])

Compute the N-dimensional FFT for real input.

irfftn(x[, s, axes, norm, overwrite_x, plan])

Compute the N-dimensional inverse FFT for real input.

hfft(x[, n, axis, norm, overwrite_x, plan])

Compute the FFT of a signal that has Hermitian symmetry.

ihfft(x[, n, axis, norm, overwrite_x, plan])

Compute the FFT of a signal that has Hermitian symmetry.

hfft2(x[, s, axes, norm, overwrite_x, plan])

Compute the FFT of a two-dimensional signal that has Hermitian symmetry.

ihfft2(x[, s, axes, norm, overwrite_x, plan])

Compute the Inverse FFT of a two-dimensional signal that has Hermitian symmetry.

hfftn(x[, s, axes, norm, overwrite_x, plan])

Compute the FFT of a N-dimensional signal that has Hermitian symmetry.

ihfftn(x[, s, axes, norm, overwrite_x, plan])

Compute the Inverse FFT of a N-dimensional signal that has Hermitian symmetry.

Discrete Cosine and Sine Transforms (DST and DCT)#

dct(x[, type, n, axis, norm, overwrite_x])

Return the Discrete Cosine Transform of an array, x.

idct(x[, type, n, axis, norm, overwrite_x])

Return the Inverse Discrete Cosine Transform of an array, x.

dctn(x[, type, s, axes, norm, overwrite_x])

Compute a multidimensional Discrete Cosine Transform.

idctn(x[, type, s, axes, norm, overwrite_x])

Compute a multidimensional Discrete Cosine Transform.

dst(x[, type, n, axis, norm, overwrite_x])

Return the Discrete Sine Transform of an array, x.

idst(x[, type, n, axis, norm, overwrite_x])

Return the Inverse Discrete Sine Transform of an array, x.

dstn(x[, type, s, axes, norm, overwrite_x])

Compute a multidimensional Discrete Sine Transform.

idstn(x[, type, s, axes, norm, overwrite_x])

Compute a multidimensional Discrete Sine Transform.

Fast Hankel Transforms#

fht(a, dln, mu[, offset, bias])

Compute the fast Hankel transform.

ifht(A, dln, mu[, offset, bias])

Compute the inverse fast Hankel transform.

Helper functions#

fftshift(x[, axes])

Shift the zero-frequency component to the center of the spectrum.

ifftshift(x[, axes])

The inverse of fftshift().

fftfreq(n[, d])

Return the FFT sample frequencies.

rfftfreq(n[, d])

Return the FFT sample frequencies for real input.

next_fast_len(target[, real])

Find the next fast size to fft.

Code compatibility features#

  1. As with other FFT modules in CuPy, FFT functions in this module can take advantage of an existing cuFFT plan (returned by get_fft_plan()) to accelerate the computation. The plan can be either passed in explicitly via the keyword-only plan argument or used as a context manager. One exception to this are the DCT and DST transforms, which do not currently support a plan argument.

  2. The boolean switch cupy.fft.config.enable_nd_planning also affects the FFT functions in this module, see Discrete Fourier Transform (cupy.fft). This switch is neglected when planning manually using get_fft_plan().

  3. Like in scipy.fft, all FFT functions in this module have an optional argument overwrite_x (default is False), which has the same semantics as in scipy.fft: when it is set to True, the input array x can (not will) be overwritten arbitrarily. For this reason, when an in-place FFT is desired, the user should always reassign the input in the following manner: x = cupyx.scipy.fftpack.fft(x, ..., overwrite_x=True, ...).

  4. The cupyx.scipy.fft module can also be used as a backend for scipy.fft e.g. by installing with scipy.fft.set_backend(cupyx.scipy.fft). This can allow scipy.fft to work with both numpy and cupy arrays. For more information, see SciPy FFT backend.

  5. The boolean switch cupy.fft.config.use_multi_gpus also affects the FFT functions in this module, see Discrete Fourier Transform (cupy.fft). Moreover, this switch is honored when planning manually using get_fft_plan().

  6. Both type II and III DCT and DST transforms are implemented. Type I and IV transforms are currently unavailable.