Fourier transform Functions

Array API specification for Fourier transform functions.

Extension name and usage

The name of the namespace providing the extension must be: fft.

If implemented, this fft extension must be retrievable via:

>>> xp = x.__array_namespace__()
>>> if hasattr(xp, 'fft'):
>>>    # Use `xp.fft`

Objects in API

A conforming implementation of this fft extension must provide and support the following functions.

fft(x, /, *, n=None, axis=-1, norm='backward')

Computes the one-dimensional discrete Fourier transform.

ifft(x, /, *, n=None, axis=-1, norm='backward')

Computes the one-dimensional inverse discrete Fourier transform.

fftn(x, /, *, s=None, axes=None, norm='backward')

Computes the n-dimensional discrete Fourier transform.

ifftn(x, /, *, s=None, axes=None, norm='backward')

Computes the n-dimensional inverse discrete Fourier transform.

rfft(x, /, *, n=None, axis=-1, norm='backward')

Computes the one-dimensional discrete Fourier transform for real-valued input.

irfft(x, /, *, n=None, axis=-1, norm='backward')

Computes the one-dimensional inverse of rfft for complex-valued input.

rfftn(x, /, *, s=None, axes=None, norm='backward')

Computes the n-dimensional discrete Fourier transform for real-valued input.

irfftn(x, /, *, s=None, axes=None, norm='backward')

Computes the n-dimensional inverse of rfftn for complex-valued input.

hfft(x, /, *, n=None, axis=-1, norm='backward')

Computes the one-dimensional discrete Fourier transform of a signal with Hermitian symmetry.

ihfft(x, /, *, n=None, axis=-1, norm='backward')

Computes the one-dimensional inverse discrete Fourier transform of a signal with Hermitian symmetry.

fftfreq(n, /, *, d=1.0, device=None)

Computes the discrete Fourier transform sample frequencies.

rfftfreq(n, /, *, d=1.0, device=None)

Computes the discrete Fourier transform sample frequencies (for rfft and irfft).

fftshift(x, /, *, axes=None)

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

ifftshift(x, /, *, axes=None)

Inverse of fftshift.