ihfftn
→Tensorihfftn(input: Tensor, s: int | Sequence[int] | None = None, dim: int | Sequence[int] | None = None, norm: str | None = None)N-dimensional inverse FFT of a real-valued signal, giving a Hermitian output.
Computes the inverse of hfftn: given a real-valued input,
produces the conjugate-symmetric half-spectrum. The implementation
uses the identity:
where denotes complex conjugation.
Equivalently, ihfftn computes the backward-sign DFT
() of the real input and returns only the
first bins along the last
transformed axis, exactly mirroring the output format of rfft.
Parameters
inputTensorsint or sequence of int= Nones[-1] // 2 + 1. If None, current axis sizes are used.dimint or sequence of int= Nonenormstr or None= None"backward" (default), "forward", or
"ortho". See fftn for the full description.Returns
TensorComplex tensor (complex64) with the same shape as input
except that the last transformed axis has length
.
Notes
Round-trip with hfftn — for a real tensor x:
Relationship to rfft — the output of ihfftn with
norm='backward' has the same element magnitudes as rfft with
norm='backward' but the signs of the imaginary parts are
negated (due to the conjugation in the identity above).
Examples
Compute the Hermitian half-spectrum of a real signal:
>>> x = lucid.randn(128)
>>> H = lucid.fft.ihfftn(x)
>>> H.shape # 128 // 2 + 1 = 65
(65,)
Round-trip:
>>> x_rec = lucid.fft.hfftn(H, s=[128])
>>> x_rec.shape
(128,)