ifftn#

ivy.ifftn(x, s=None, axes=None, *, norm='backward', out=None)[source]#

Compute the N-dimensional inverse discrete Fourier Transform.

Parameters:
  • x (Union[Array, NativeArray]) – Input array of complex numbers.

  • s (Optional[Union[int, Tuple[int, ...]]], default: None) – Shape (length of transformed axis) of the output (s[0] refers to axis 0, s[1] to axis 1, etc.). If given shape is smaller than that of the input, the input is cropped. If larger, input is padded with zeros. If s is not given, shape of input along axes specified by axes is used.

  • axes (Optional[Union[int, Tuple[int, ...]]], default: None) – Axes over which to compute the IFFT. If not given, last len(s) axes are used, or all axes if s is also not specified. Repeated indices in axes means inverse transform over that axis is performed multiple times.

  • norm (str, default: 'backward') – Indicates direction of the forward/backward pair of transforms is scaled and with what normalization factor. “backward” indicates no normalization. “ortho” indicates normalization by $frac{1}{sqrt{n}}$. “forward” indicates normalization by $frac{1}{n}$.

  • out (Optional[Array], default: None) – Optional output array for writing the result to. It must have a shape that the inputs broadcast to.

Return type:

Array

Returns:

out – The truncated or zero-padded input, transformed along the axes indicated by axes, or by a combination of s or x, as explained in the parameters section above.

Raises:
  • ValueError – If s and axes have different length.

  • IndexError – If an element of axes is larger than the number of axes of x.

Examples

>>> x = ivy.array([[0.24730653+0.90832391j, 0.49495562+0.9039565j,
...                 0.98193269+0.49560517j],
...                 [0.93280757+0.48075343j, 0.28526384+0.3351205j,
...                 0.2343787 +0.83528011j],
...                 [0.18791352+0.30690572j, 0.82115787+0.96195183j,
...                 0.44719226+0.72654048j]])
>>> y = ivy.ifftn(x)
>>> print(y)
ivy.array([[ 0.51476765+0.66160417j, -0.04319742-0.05411636j,
        -0.015561  -0.04216015j],
       [ 0.06310689+0.05347854j, -0.13392983+0.16052352j,
        -0.08371392+0.17252843j],
       [-0.0031429 +0.05421245j, -0.10446617-0.17747098j,
         0.05344324+0.07972424j]])
>>> x = ivy.array([[0.24730653+0.90832391j, 0.49495562+0.9039565j,
...                 0.98193269+0.49560517j],
...                 [0.93280757+0.48075343j, 0.28526384+0.3351205j,
...                 0.2343787 +0.83528011j],
...                 [0.18791352+0.30690572j, 0.82115787+0.96195183j,
...                 0.44719226+0.72654048j]])
>>> b = ivy.ifftn(x, s=[2, 1], axes=[0, 1], norm='ortho')
>>> print(b)
ivy.array([[ 0.8344667 +0.98222595j],
       [-0.48472244+0.30233797j]])
Array.ifftn(self, s=None, axes=None, *, norm='backward', out=None)[source]#

Compute the N-dimensional inverse discrete Fourier Transform.

Parameters:
  • x – Input array of complex numbers.

  • s (Optional[Union[int, Tuple[int, ...]]], default: None) – sequence of ints, optional Shape (length of transformed axis) of the output (s[0] refers to axis 0, s[1] to axis 1, etc.). If given shape is smaller than that of the input, the input is cropped. If larger, input is padded with zeros. If s is not given, shape of input along axes specified by axes is used.

  • axes (Optional[Union[int, Tuple[int, ...]]], default: None) – axes over which to compute the IFFT. If not given, last len(s) axes are used, or all axes if s is also not specified. Repeated indices in axes means inverse transform over that axis is performed multiple times.

  • norm (str, default: 'backward') – Optional argument, “backward”, “ortho” or “forward”. Defaults to be “backward”. “backward” indicates no normalization. “ortho” indicates normalization by 1/sqrt(n). “forward” indicates normalization by 1/n.

  • out (Optional[Array], default: None) – Optional output array, for writing the result to. It must have a shape that the inputs broadcast to.

Return type:

Array

Returns:

ret – The truncated or zero-padded input, transformed along the axes indicated by axes, or by a combination of s or x, as explained in the parameters section above.

Examples

>>> x = ivy.array([[0.24730653+0.90832391j, 0.49495562+0.9039565j,
...                 0.98193269+0.49560517j],
...                 [0.93280757+0.48075343j, 0.28526384+0.3351205j,
...                 0.2343787 +0.83528011j],
...                 [0.18791352+0.30690572j, 0.82115787+0.96195183j,
...                 0.44719226+0.72654048j]])
>>> y = ivy.ifftn(x)
>>> print(y)
ivy.array([[ 0.51476765+0.66160417j, -0.04319742-0.05411636j,
        -0.015561  -0.04216015j],
       [ 0.06310689+0.05347854j, -0.13392983+0.16052352j,
        -0.08371392+0.17252843j],
       [-0.0031429 +0.05421245j, -0.10446617-0.17747098j,
         0.05344324+0.07972424j]])
>>> x = ivy.array([[0.24730653+0.90832391j, 0.49495562+0.9039565j,
...                 0.98193269+0.49560517j],
...                 [0.93280757+0.48075343j, 0.28526384+0.3351205j,
...                 0.2343787 +0.83528011j],
...                 [0.18791352+0.30690572j, 0.82115787+0.96195183j,
...                 0.44719226+0.72654048j]])
>>> y = ivy.ifftn(x, s=[2, 1], axes=[0, 1], norm='ortho')
>>> print(y)
ivy.array([[ 0.8344667 +0.98222595j],
       [-0.48472244+0.30233797j]])
Container.ifftn(self, s=None, axes=None, *, norm='backward', out=None)[source]#

ivy.Container static method variant of ivy.ifftn.

This method simply wraps the function, and so the docstring for ivy.ifftn also applies to this method with minimal changes.

Parameters:
  • x – Input array of complex numbers.

  • s (Optional[Union[int, Tuple[int, ...], Container]], default: None) – sequence of ints, optional Shape (length of transformed axis) of the output (s[0] refers to axis 0, s[1] to axis 1, etc.). If given shape is smaller than that of the input, the input is cropped. If larger, input is padded with zeros. If s is not given, shape of input along axes specified by axes is used.

  • axes (Optional[Union[int, Tuple[int, ...], Container]], default: None) – axes over which to compute the IFFT. If not given, last len(s) axes are used, or all axes if s is also not specified. Repeated indices in axes means inverse transform over that axis is performed multiple times.

  • norm (Union[str, Container], default: 'backward') – Optional argument, “backward”, “ortho” or “forward”. Defaults to be “backward”. “backward” indicates no normalization. “ortho” indicates normalization by 1/sqrt(n). “forward” indicates normalization by 1/n.

  • out (Optional[Union[Array, Container]], default: None) – Optional output array, for writing the result to. It must have a shape that the inputs broadcast to.

Returns:

ret – Container containing the transformed inputs

Examples

>>> x = ivy.Container(
...         a=ivy.array([[0.247306+0.908323j, 0.494955+0.90395j,
...                       0.98193269+0.49560517j],
...                      [0.93280757+0.48075343j, 0.28526384+0.3351205j,
...                       0.2343787 +0.83528011j],
...                      [0.18791352+0.30690572j, 0.82115787+0.96195183j,
...                       0.44719226+0.72654048j]]),
...         b=ivy.array([[0.24730653+0.90832391j, 0.49495562+0.9039565j,
...                       0.98193269+0.49560517j],
...                      [0.93280757+0.48075343j, 0.28526384+0.3351205j,
...                       0.2343787 +0.83528011j],
...                      [0.18791352+0.30690572j, 0.82115787+0.96195183j,
...                       0.44719226+0.72654048j]]),
...     )
>>> y = x.ifftn(s=[2, 1], axes=[0, 1], norm='ortho')
>>> print(y)
{
    a: ivy.array([[0.8344667+0.98222595j],
                  [-0.48472244+0.30233797j]]),
    b: ivy.array([[0.8344667+0.98222595j],
                  [-0.48472244+0.30233797j]])
}