irfft¶
- irfft(x: array, /, *, n: int | None = None, axis: int = -1, norm: Literal['backward', 'ortho', 'forward'] = 'backward') array ¶
Computes the one-dimensional inverse of
rfft
for complex-valued input.Note
Applying the one-dimensional inverse discrete Fourier transform for real-valued input to the output of this function must return the original (i.e., non-transformed) input array within numerical accuracy (i.e.,
irfft(rfft(x)) == x
), provided that the transform and inverse transform are performed with the same arguments (axis and normalization mode) and consistent values for the number of elements over which to compute the transforms.- Parameters:
x (array) – input array. Should have a complex floating-point data type.
n (Optional[int]) –
number of elements along the transformed axis (dimension) specified by
axis
in the output array. LetM
be the size of the input array along the axis specified byaxis
. Whenn
isNone
, the function must setn
equal to2*(M-1)
.If
n//2+1
is greater thanM
, the axis of the input array specified byaxis
must be zero-padded to sizen//2+1
.If
n//2+1
is less thanM
, the axis of the input array specified byaxis
must be trimmed to sizen//2+1
.If
n//2+1
equalsM
, all elements along the axis of the input array specified byaxis
must be used when computing the transform.
Default:
None
.axis (int) – axis (dimension) of the input array over which to compute the transform. A valid
axis
must be an integer on the interval[-N, N)
, whereN
is the rank (number of dimensions) ofx
. If anaxis
is specified as a negative integer, the function must determine the axis along which to compute the transform by counting backward from the last dimension (where-1
refers to the last dimension). Default:-1
.norm (Literal['backward', 'ortho', 'forward']) –
normalization mode. Should be one of the following modes:
'backward'
: normalize by1/n
.'ortho'
: normalize by1/sqrt(n)
(i.e., make the FFT orthonormal).'forward'
: no normalization.
Default:
'backward'
.
- Returns:
out (array) – an array transformed along the axis (dimension) specified by
axis
. The returned array must have a real-valued floating-point data type whose precision matches the precision ofx
(e.g., ifx
iscomplex128
, then the returned array must have afloat64
data type). The returned array must have the same shape asx
, except for the axis specified byaxis
which must have sizen
.
Notes
In order to return an array having an odd number of elements along the transformed axis, the function must be provided an odd integer for
n
.
New in version 2022.12.
Changed in version 2023.12: Required the output array have a real-valued floating-point data type having the same precision as the input array.