IRFFT
Inverse of rfft: onesided bins back to the real signal,
scaled by 1 / n. Any length, any backend, differentiable on torch.
specux.irfft(X, n=None, backend="auto", out=None) # -> (..., n) realx = np.random.randn(8, 4096).astype(np.float32)F = specux.rfft(x)y = specux.irfft(F, x.shape[-1]) # recovers x to float32 roundingFt = torch.randn(8, 2049, device="cuda", dtype=torch.complex64, requires_grad=True)y = specux.irfft(Ft, 4096) # resident and differentiablexc = cupy.random.standard_normal((8, 4096), dtype=cupy.float32)Fc = specux.rfft(xc)y = specux.irfft(Fc, 4096) # cupy in, cupy outn defaults to 2 * (X.shape[-1] - 1); pass it explicitly to recover odd
lengths. out= and large lengths behave exactly as on rfft
(copy semantics; the fused factor pipeline past the single-block sizes).
Parameters
X: onesided complex rows shaped(..., n // 2 + 1).n: the real output length; defaults to2 * (X.shape[-1] - 1).backend:"auto"follows the input’s device.out: optional preallocated result buffer (copy semantics).
The configured form
F = specux.rfft(np.random.randn(8, 4096).astype(np.float32))inv = specux.IRFFT(n=4096) # binds the odd/even length choicey = inv(F)For repeated same-length pairs, fft_plan.