# Transform-domain real packing

- ID: 2298
- Canonical URL: https://synthcore.org/idea/2298/transform-domain-real-packing
- API JSON: https://synthcore.org/api/idea/2298.json
- API Markdown: https://synthcore.org/api/idea/2298.md
- Verification status: unverified
- Source: [arXiv:2608.14497](https://arxiv.org/abs/2608.14497)
- Category: architecture
- Solves: speedup, memory
- ML areas: cnn, ssm, inference-speedup, memory
- Math tags: harmonic-analysis, linear-algebra, numerical-analysis
- Ratings: usefulness 6/10; difficulty 6/10; novelty 5/10

## Idea description

Pack two real tensors into the real and imaginary components of one complex tensor, perform one complex transform, and recover both real spectra through conjugate symmetry. Combine this with implicit padding so separate padded real arrays and transform workspaces are not allocated.

## Mathematical statement

Let a and b be real sequences of length M, with A=DFT_M(a) and B=DFT_M(b). Define z_j=a_j+i b_j and Z=DFT_M(z), so Z_k=A_k+iB_k by linearity. Since a and b are real, A_{(-k) mod M}=conjugate(A_k) and B_{(-k) mod M}=conjugate(B_k). Therefore A_k=(Z_k+conjugate(Z_{(-k) mod M}))/2 and B_k=(Z_k-conjugate(Z_{(-k) mod M}))/(2i). The zero-frequency bin and, when M is even, the Nyquist bin k=M/2 are self-conjugate and should have negligible imaginary parts. These identities recover two independent real transforms from one complex transform. In a spectral neural layer, the recovered spectra can be multiplied by separate learned complex filters before inverse transformation.

## Key formulas

- $$z_j=a_j+i b_j,\qquad Z_k=\operatorname{DFT}_M(z)_k=A_k+iB_k.$$
- $$A_k=\frac{Z_k+\overline{Z_{(-k)\bmod M}}}{2},\qquad B_k=\frac{Z_k-\overline{Z_{(-k)\bmod M}}}{2i}.$$
- $$A_{M-k}=\overline{A_k},\qquad B_{M-k}=\overline{B_k}\quad\text{for real }a,b.$$
- $$Y_a=\operatorname{IFFT}_M(A\odot H_a),\qquad Y_b=\operatorname{IFFT}_M(B\odot H_b).$$

## Implementation notes

Integrate this at the transform interface of a spectral Conv1d or Fourier neural operator with many independent real channels. Pair channels x[...,2c,:] and x[...,2c+1,:], and form one complex packed signal z=x_even+i*x_odd. Do not create two separately padded length-M tensors: use the implicit tile loader above, returning zero for indices outside the original length. Run one complex FFT, then for every frequency k retrieve kbar=(-k) mod M and compute `Xe[k]=(Z[k]+conj(Z[kbar]))/2` and `Xo[k]=(Z[k]-conj(Z[kbar]))/(2j)`. Multiply Xe and Xo by separate learned filters He and Ho, inverse-transform, and take real parts. Handle k=0 and, for even M, k=M/2 explicitly to avoid numerical artifacts. Pseudocode is: `z=implicit_pad(x_even)+1j*implicit_pad(x_odd); Z=FFT(z); Xe=(Z+conj(reverse_mod_frequency(Z)))/2; Xo=(Z-conj(reverse_mod_frequency(Z)))/(2j); ye=IFFT(Xe*He).real; yo=IFFT(Xo*Ho).real`. Complex autodiff should propagate through the reconstruction algebra; verify gradients against two independent real FFTs. The formulas are exact in exact arithmetic, while performance depends on backend fusion and memory layout. Start with a two-layer Fourier neural operator on Burgers-equation data or a long Conv1d classifier, using M=8192 and 16384. Compare two separate real FFTs, one ordinary complex FFT, and packed implicit FFT. Success is at least 1.3x transform throughput or 20% lower workspace memory with identical validation error, forward error below 1e-5, and gradient error below 1e-4.

## Disclaimer

AI-generated research hypothesis, automatically tested. Not peer-reviewed.
