flopscope.

flopscope.numpy.fft.rfft2

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

Compute the 2-dimensional FFT of a real array.

Adapted from NumPy docs np.fft.rfft2

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

2-D real FFT. Cost: 5*(N//2)*ceil(log2(N)), N=prod(s) (Cooley-Tukey radix-2; Van Loan 1992 §1.4).

Parameters

a:array

Input array, taken to be real.

s:sequence of ints, optional

Shape of the FFT.

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

Axes over which to compute the FFT. Default: (-2, -1).

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:complex ndarray, optional

If provided, the result will be placed in this array. It should be of the appropriate shape and dtype for the last inverse transform. incompatible with passing in all but the trivial s).

Added in version 2.0.0.

Returns

out:ndarray

The result of the real 2-D FFT.

See also

Notes

This is really just rfftn with different default behavior. For more details see rfftn.

Examples

>>> import flopscope.numpy as fnp
>>> a = flops.mgrid[:5, :5][0]
>>> flops.fft.rfft2(a)
array([[ 50.  +0.j        ,   0.  +0.j        ,   0.  +0.j        ],
       [-12.5+17.20477401j,   0.  +0.j        ,   0.  +0.j        ],
       [-12.5 +4.0614962j ,   0.  +0.j        ,   0.  +0.j        ],
       [-12.5 -4.0614962j ,   0.  +0.j        ,   0.  +0.j        ],
       [-12.5-17.20477401j,   0.  +0.j        ,   0.  +0.j        ]])