dpnp.fft.fft

dpnp.fft.fft(a, n=None, axis=-1, norm=None, out=None)[source]

Compute the one-dimensional discrete Fourier Transform.

This function computes the one-dimensional n-point discrete Fourier Transform (DFT) with the efficient Fast Fourier Transform (FFT) algorithm.

For full documentation refer to numpy.fft.fft.

Parameters:
  • a ({dpnp.ndarray, usm_ndarray}) -- Input array, can be complex.

  • n ({None, int}, optional) -- Length of the transformed axis of the output. If n is smaller than the length of the input, the input is cropped. If it is larger, the input is padded with zeros. If n is not given, the length of the input along the axis specified by axis is used. Default: None.

  • axis (int, optional) -- Axis over which to compute the FFT. If not given, the last axis is used. Default: -1.

  • norm ({None, "backward", "ortho", "forward"}, optional) -- Normalization mode (see dpnp.fft). Indicates which direction of the forward/backward pair of transforms is scaled and with what normalization factor. None is an alias of the default option "backward". Default: "backward".

  • out ({None, dpnp.ndarray or usm_ndarray of complex dtype}, optional) -- If provided, the result will be placed in this array. It should be of the appropriate shape (consistent with the choice of n) and dtype. Default: None.

Returns:

out -- The truncated or zero-padded input, transformed along the axis indicated by axis, or the last one if axis is not specified.

Return type:

dpnp.ndarray of complex dtype

See also

dpnp.fft

For definition of the DFT and conventions used.

dpnp.fft.ifft

The inverse of dpnp.fft.fft.

dpnp.fft.fft2

The two-dimensional FFT.

dpnp.fft.fftn

The N-dimensional FFT.

dpnp.fft.rfftn

The N-dimensional FFT of real input.

dpnp.fft.fftfreq

Frequency bins for given FFT parameters.

Notes

FFT (Fast Fourier Transform) refers to a way the discrete Fourier Transform (DFT) can be calculated efficiently, by using symmetries in the calculated terms. The symmetry is highest when n is a power of 2, and the transform is therefore most efficient for these sizes.

The DFT is defined, with the conventions used in this implementation, in the documentation for the dpnp.fft module.

Examples

>>> import dpnp as np
>>> a = np.exp(2j * np.pi * np.arange(8) / 8)
>>> np.fft.fft(a)
array([-3.44509285e-16+1.14423775e-17j,  8.00000000e+00-8.52069395e-16j,
        2.33486982e-16+1.22464680e-16j,  0.00000000e+00+1.22464680e-16j,
        9.95799250e-17+2.33486982e-16j, -8.88178420e-16+1.17281316e-16j,
        1.14423775e-17+1.22464680e-16j,  0.00000000e+00+1.22464680e-16j])