hfft

paddle.fft. hfft ( x, n=None, axis=- 1, norm='backward', name=None ) [source]

Compute the FFT of a signal that has Hermitian symmetry, a real spectrum.

Parameters
  • x (Tensor) – The input data. It’s a Tensor type. It’s a complex.

  • n (int, optional) – The length of the output transform axis. For n output points, n//2 + 1 input points are necessary. If the length of the input tensor is greater than n, it will be cropped, if it is shorter than this, fill in zero. If n is not given, it is considered to be 2 * (k-1), where k is the length of the input axis specified along the ` axis’.

  • axis (int,optional) – Axis used to calculate FFT. If not specified, the last axis is used by default.

  • norm (str, optional) – 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 .

Returns

Real tensor. Truncated or zero fill input for the transformation along the axis indicated by axis, or the last input if axis is not specified. The length of the conversion axis is n, or 2 * k-2, if k is None, where k is the length of the input conversion axis. If the output is an odd number, you need to specify the value of ‘n’, such as 2 * k-1 in some cases.

Examples

>>> import paddle

>>> x = paddle.to_tensor([1, -1j, -1])
>>> hfft_x = paddle.fft.hfft(x)
>>> print(hfft_x)
Tensor(shape=[4], dtype=float32, place=Place(cpu), stop_gradient=True,
[0., 0., 0., 4.])