- paddle.fft. hfftn ( x, s=None, axes=None, norm='backward', name=None )
Compute the N-D FFT of Hermitian symmetric complex input, i.e., a signal with a real spectrum.
This function calculates the n-D discrete Fourier transform of Hermite symmetric complex input on any axis in M-D array by fast Fourier transform (FFT). In other words,
ihfftn(hfftn(x, s)) == x is within the numerical accuracy range. (``shere are
s[-1] = x.shape[- 1] * 2 - 1. This is necessary for the same reason that
irfft` requires ``x.shape.)
x (Tensor) – The input data. It’s a Tensor type.
s (sequence of ints, optional) – The length of the output transform axis. (
srefers to axis 0,
sto axis 1, etc.). s is also the number of input points used along this axis, except for the last axis, where
s[-1]//2+1points of the input are used. Along any axis, if the shape indicated by s is smaller than that of the input, the input is cropped. If it is larger, the input is padded with zeros. If s is not given, the shape of the input along the axes specified by axes is used. Except for the last axis which is taken to be
kis the length of the input along that axis.
axes (sequence of ints, optional) – Axes over which to compute the inverse FFT. If not given, the last len(s) axes are used, or all axes if s is also not specified.
norm (str) – Indicates which direction to scale the forward or backward transform pair and what normalization factor to use. The parameter value must be one of “forward” or “backward” or “ortho”. Default is “backward”.
name (str, optional) – The default value is None. Normally there is no need for user to set this property. For more information, please refer to Name.
Real tensor. Truncate or zero fill input, transforming along the axis indicated by axis or a combination of s or X.
import numpy as np import paddle x = (np.array([2, 2, 3]) + 1j * np.array([2, 2, 3])).astype(np.complex128) xp = paddle.to_tensor(x) hfftn_xp = paddle.fft.hfftn(xp).numpy() print(hfftn_xp) # [ 9. 3. 1. -5.]