dpnp.fft.irfft2

dpnp.fft.irfft2(a, s=None, axes=(-2, -1), norm=None, out=None)[source]

Computes the inverse of dpnp.fft.rfft2.

For full documentation refer to numpy.fft.irfft2.

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

  • s ({None, sequence of ints}, optional) -- Shape (length of each transformed axis) of the output (s[0] refers to axis 0, s[1] to axis 1, etc.). s is also the number of input points used along this axis, except for the last axis, where s[-1]//2+1 points of the input are used. Along each axis, if the given shape is smaller than that of the input, the input is cropped. If it is larger, the input is padded with zeros. If it is -1, the whole input is used (no padding/trimming). If s is not given, the shape of the input along the axes specified by axes is used. Except for the last axis which is taken to be 2*(m-1) where m is the length of the input along that axis. If s is not None, axes must not be None Default: None.

  • axes ({None, sequence of ints}, optional) -- Axes over which to compute the inverse FFT. If not given, the last len(s) axes are used, or all axes if s is also not specified. Repeated indices in axes means that the transform over that axis is performed multiple times. If s is specified, the corresponding axes to be transformed must be explicitly specified too. A one-element sequence means that a one-dimensional FFT is performed. An empty sequence means that no FFT is performed. Default: (-2, -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}, optional) -- If provided, the result will be placed in this array. It should be of the appropriate dtype and shape for the last transformation (consistent with the choice of s). Default: None.

Returns:

out -- The truncated or zero-padded input, transformed along the axes indicated by axes, or the last two axes if axes is not given.

Return type:

dpnp.ndarray

See also

dpnp.fft

Overall view of discrete Fourier transforms, with definitions and conventions used.

dpnp.fft.rfft2

The forward two-dimensional FFT of real input, of which dpnp.fft.irfft2 is the inverse.

dpnp.fft.rfft

The one-dimensional FFT for real input.

dpnp.fft.irfft

The inverse of the one-dimensional FFT of real input.

dpnp.fft.irfftn

The inverse of the N-dimensional FFT of real input.

Notes

dpnp.fft.irfft2 is just dpnp.fft.irfftn with a different default for axes. For more details see dpnp.fft.irfftn.

Examples

>>> import dpnp as np
>>> a = np.mgrid[:5, :5][0]
>>> A = np.fft.rfft2(a)
>>> np.fft.irfft2(A, s=a.shape)
array([[0., 0., 0., 0., 0.],
       [1., 1., 1., 1., 1.],
       [2., 2., 2., 2., 2.],
       [3., 3., 3., 3., 3.],
       [4., 4., 4., 4., 4.]])