ifft

paddle.fft. ifft ( x, n=None, axis=- 1, norm='backward', name=None ) [source]

Compute the 1-D inverse discrete Fourier Transform.

This function computes the inverse of the 1-D n-point discrete Fourier transform computed by fft. In other words, ifft(fft(x)) == x to within numerical accuracy.

The input should be ordered in the same way as is returned by fft, i.e.,

  • x[0] should contain the zero frequency term,

  • x[1:n//2] should contain the positive-frequency terms,

  • x[n//2 + 1:] should contain the negative-frequency terms, in increasing order starting from the most negative frequency.

For an even number of input points, x[n//2] represents the sum of the values at the positive and negative Nyquist frequencies, as the two are aliased together.

Parameters
  • x (Tensor) – The input data. It’s a Tensor type. It’s a complex.

  • n (int, optional) – The length of the output transform axis. If n is less than the length input, the input will be cropped. If larger, the input is filled with zeros. If n is not given, the input length along the axis specified by axis is used.

  • axis (int, optional) – Axis used to calculate FFT. If not specified, the last axis is used by default.

  • norm (str, optional) – Indicates which direction to scale the forward or backward transform pair and what normalization factor to use. The parameter value must be one of “forward” or “backward” or “ortho”. Default is “backward”, meaning no normalization on the forward transforms and scaling by 1/n on the ifft. “forward” instead applies the 1/n factor on the forward tranform. For norm="ortho", both directions are scaled by 1/sqrt(n).

  • name (str, optional) – The default value is None. Normally there is no need for user to set this property. For more information, please refer to Name.

Returns

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

Examples

>>> import numpy as np
>>> import paddle

>>> x = np.exp(3j * np.pi * np.arange(7) / 7)
>>> xp = paddle.to_tensor(x)
>>> ifft_xp = paddle.fft.ifft(xp).numpy().round(3)
>>> print(ifft_xp)
[0.143+0.179j 0.143+0.069j 0.143+0.j 0.143-0.069j 0.143-0.179j 0.143-0.626j 0.143+0.626j]