fftn¶
- fftn(x: array, /, *, s: Sequence[int] | None = None, axes: Sequence[int] | None = None, norm: Literal['backward', 'ortho', 'forward'] = 'backward') array¶
- Computes the n-dimensional discrete Fourier transform. - Note - Applying the n-dimensional inverse discrete Fourier transform to the output of this function must return the original (i.e., non-transformed) input array within numerical accuracy (i.e., - ifftn(fftn(x)) == x), provided that the transform and inverse transform are performed with the same arguments (sizes, axes, and normalization mode).- Parameters:
- x (array) – input array. Should have a complex floating-point data type. 
- s (Optional[Sequence[int]]) – - number of elements over which to compute the transform along the axes (dimensions) specified by - axes. Let- ibe 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- sis- None, the function must set- sequal to a sequence of integers such that- s[i]equals- M[i]for all- i.- If - s[i]is greater than- M[i], axis- imust be zero-padded to size- s[i].
- If - s[i]is less than- M[i], axis- imust be trimmed to size- s[i].
- If - s[i]equals- M[i]or- -1, all elements along axis- imust be used when computing the transform.
 - If - sis not- None,- axesmust not be- None. Default:- None.
- axes (Optional[Sequence[int]]) – - axes (dimensions) over which to compute the transform. A valid axis in - axesmust be an integer on the interval- [-N, N), where- Nis 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- -1refers to the last dimension).- If - sis provided, the corresponding- axesto be transformed must also be provided. If- axesis- None, the function must compute the transform over all axes. Default:- None.- If - axescontains 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': no normalization.
- 'ortho': normalize by- 1/sqrt(n)(i.e., make the FFT orthonormal).
- 'forward': normalize by- 1/n.
 - where - n = prod(s)is the logical FFT size.- Default: - 'backward'.
 
- Returns:
- out (array) – an array transformed along the axes (dimensions) specified by - axes. The returned array must have the same data type as- xand must have the same shape as- x, except for the axes specified by- axeswhich must have size- s[i].
 - Notes - New in version 2022.12. - Changed in version 2023.12: Required the input array have a complex floating-point data type and required that the output array have the same data type as the input array.