irfftn

irfftn(x: array, /, *, s: Sequence[int] | None = None, axes: Sequence[int] | None = None, norm: Literal['backward', 'ortho', 'forward'] = 'backward') array

Computes the n-dimensional inverse of rfftn for complex-valued input.

Note

Applying the n-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., irfftn(rfftn(x)) == x), provided that the transform and inverse transform are performed with the same arguments (axes and normalization mode) and consistent sizes.

Parameters:
  • x (array) – input array. Should have a complex-valued floating-point data type.

  • s (Optional[Sequence[int]]) –

    number of elements along the transformed axes (dimensions) specified by axes in the output array. Let i be the index of the n-th axis specified by axes (i.e., i = axes[n]) and M[i] be the size of the input array along axis i. When s is None, the function must set s equal to a sequence of integers such that s[i] equals M[i] for all i, except for the last transformed axis in which s[i] equals 2*(M[i]-1). For each i, let n equal s[i], except for the last transformed axis in which n equals s[i]//2+1.

    • If n is greater than M[i], axis i of the input array must be zero-padded to size n.

    • If n is less than M[i], axis i of the input array must be trimmed to size n.

    • If n equals M[i] or -1, all elements along axis i of the input array must be used when computing the transform.

    If s is not None, axes must not be None. Default: None.

  • axes (Optional[Sequence[int]]) –

    axes (dimensions) over which to compute the transform. A valid axis in axes must be an integer on the interval [-N, N), where N is the rank (number of dimensions) of x. If an axis 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).

    If s is provided, the corresponding axes to be transformed must also be provided. If axes is None, the function must compute the transform over all axes. Default: None.

    If axes contains two or more entries which resolve to the same axis (i.e., resolved axes are not unique), the behavior is unspecified and thus implementation-defined.

  • norm (Literal['backward', 'ortho', 'forward']) –

    normalization mode. Should be one of the following modes:

    • 'backward': normalize by 1/n.

    • 'ortho': normalize by 1/sqrt(n) (i.e., make the FFT orthonormal).

    • 'forward': no normalization.

    where n = prod(s) is the logical FFT size.

    Default: 'backward'.

Returns:

out (array) – an array transformed along the axes (dimension) specified by axes. The returned array must have a real-valued floating-point data type whose precision matches the precision of x (e.g., if x is complex128, then the returned array must have a float64 data type). The returned array must have the same shape as x, except for the transformed axes which must have size s[i].

Notes

  • In order to return an array having an odd number of elements along the last transformed axis, the function must be provided an odd integer for s[-1].

New in version 2022.12.