flopscope.

flopscope.numpy.fft.irfft2

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

Computes the inverse of `rfft2`.

Adapted from NumPy docs np.fft.irfft2

Areafft
Typecustom
NumPy Refnp.fft.irfft2
Cost
5(N/2)log2N5(N/2) \cdot \lceil\log_2 N\rceil
Flopscope Context

Inverse 2-D real FFT. Cost: staged -- replays numpy's cascade as complex FFTs over the leading axes (forward order) followed by the real (Hermitian-reconstructing) inverse on the last axis, with batch at each stage taken from the shape at that point in the cascade (not the final transform shape). Cost formula already counts complex real-FLOPs; priced-in.

Computes the inverse of rfft2.

Parameters

a:array_like

The input array

s:sequence of ints, optional

Shape of the real output to the inverse FFT.

Changed in version 2.0.
Deprecated since 2.0.
Deprecated since 2.0.
axes:sequence of ints, optional

The axes over which to compute the inverse fft. Default: (-2, -1), the last two axes.

Deprecated since 2.0.
norm:{"backward", "ortho", "forward"}, optional

Normalization mode (see flops.fft). Default is "backward". Indicates which direction of the forward/backward pair of transforms is scaled and with what normalization factor.

Added in version 1.20.0.
out:ndarray, optional

If provided, the result will be placed in this array. It should be of the appropriate shape and dtype for the last transformation.

Added in version 2.0.0.

Returns

out:ndarray

The result of the inverse real 2-D FFT.

See also

Notes

This is really irfftn with different defaults. For more details see irfftn.

Examples

>>> import flopscope.numpy as fnp
>>> a = flops.mgrid[:5, :5][0]
>>> A = flops.fft.rfft2(a)
>>> flops.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.]])