fn

hfft2

Tensor
hfft2(input: Tensor, s: Sequence[int] | None = None, dim: Sequence[int] = (-2, -1), norm: str | None = None)
source

2-D FFT of a Hermitian-symmetric complex signal over a pair of axes.

Computes the two-dimensional DFT of a Hermitian signal stored as a one-sided half-spectrum (as produced by ihfft2), returning a real-valued output. This is the 2-D specialisation of hfftn.

For an input of shape (M,m)(M, m) where m=N//2+1m = N//2 + 1, the output shape is (M,N)(M, N).

Parameters

inputTensor
Complex Hermitian half-spectrum tensor with at least 2 dimensions.
ssequence of int= None
Full output sizes (M_out, N_out) along the two transformed axes. If None, the last axis defaults to 2(m1)2(m-1).
dimsequence of int= (-2, -1)
The two axes over which to compute the transform. Default is (-2, -1).
normstr or None= None
Normalisation mode — "backward" (default), "forward", or "ortho". See fftn for the full description.

Returns

Tensor

Real tensor (float32) with the same shape as input except the last transformed axis has length s[-1] (or 2(m1)2(m-1) by default).

Notes

Odd-length last axis — always pass s explicitly when the original last axis had an odd length to avoid the default 2(m1)2(m-1) even-length assumption.

Examples

Recover a real 2-D signal from its Hermitian half-spectrum:
>>> H = lucid.randn(64, 33)   # half-spectrum for 64×64 real image
>>> y = lucid.fft.hfft2(H, s=[64, 64])
>>> y.shape
(64, 64)