bundles / numpy 2.5.0.dev0+git20251130.2de293a / numpy / fft / irfftn
_ArrayFunctionDispatcher
numpy.fft:irfftn
source: build-install/usr/lib/python3.14/site-packages/numpy/fft/_pocketfft.py :1473
Signature
def irfftn ( a , s = None , axes = None , norm = None , out = None ) Summary
Computes the inverse of rfftn.
Extended Summary
This function computes the inverse of the N-dimensional discrete Fourier Transform for real input over any number of axes in an M-dimensional array by means of the Fast Fourier Transform (FFT). In other words, irfftn(rfftn(a), a.shape) == a to within numerical accuracy. (The a.shape is necessary like len(a) is for irfft, and for the same reason.)
The input should be ordered in the same way as is returned by rfftn, i.e. as for irfft for the final transformation axis, and as for ifftn along all the other axes.
Parameters
a: array_likeInput array.
s: sequence of ints, optionalShape (length of each transformed axis) of the output (
s[0]refers to axis 0,s[1]to axis 1, etc.).sis also the number of input points used along this axis, except for the last axis, wheres[-1]//2+1points of the input are used. Along any axis, if the shape indicated bysis smaller than that of the input, the input is cropped. If it is larger, the input is padded with zeros.If
sis not given, the shape of the input along the axes specified by axes is used. Except for the last axis which is taken to be2*(m-1)wheremis the length of the input along that axis.axes: sequence of ints, optionalAxes over which to compute the inverse FFT. If not given, the last
len(s)axes are used, or all axes ifsis also not specified. Repeated indices inaxesmeans that the inverse transform over that axis is performed multiple times.norm: {"backward", "ortho", "forward"}, optionalNormalization mode (see numpy.fft). Default is "backward". Indicates which direction of the forward/backward pair of transforms is scaled and with what normalization factor.
out: ndarray, optionalIf provided, the result will be placed in this array. It should be of the appropriate shape and dtype for the last transformation.
Returns
out: ndarrayThe truncated or zero-padded input, transformed along the axes indicated by
axes, or by a combination ofsora, as explained in the parameters section above. The length of each transformed axis is as given by the corresponding element ofs, or the length of the input in every axis except for the last one ifsis not given. In the final transformed axis the length of the output whensis not given is2*(m-1)wheremis the length of the final transformed axis of the input. To get an odd number of output points in the final axis,smust be specified.
Raises
: ValueErrorIf
sandaxeshave different length.: IndexErrorIf an element of
axesis larger than than the number of axes ofa.
Notes
See fft for definitions and conventions used.
See rfft for definitions and conventions used for real input.
The correct interpretation of the hermitian input depends on the shape of the original data, as given by s. This is because each input shape could correspond to either an odd or even length signal. By default, irfftn assumes an even output length which puts the last entry at the Nyquist frequency; aliasing with its symmetric counterpart. When performing the final complex to real transform, the last value is thus treated as purely real. To avoid losing information, the correct shape of the real input must be given.
Examples
import numpy as np a = np.zeros((3, 2, 2)) a[0, 0, 0] = 3 * 2 * 2✓
np.fft.irfftn(a)
✗See also
Aliases
-
numpy.fft.irfftn