Rework BDCT into first-class BODFT primitive with iterative scheduling#42
Merged
Conversation
Reframes the half-bin transform as BODFT (Bruun odd-frequency DFT), a
first-class half-bin spectral primitive, and removes all DCT-I..IV framing
and code. BODFT computes
H[k] = sum_n x[n] exp(-2*pi*i*(k+1/2)*n/N)
for real input -- the spectrum sampled halfway between the ordinary FFT
bins -- emitting the packed lower half H[0..N/2-1].
Changes:
- Rename kernel/API bdct -> bodft (namespace bodft, bodft::plan/plan_f32,
C ABI bodft_plan/bodft_forward/bodft_inverse[_f32], C++ bfft::bodft).
- Strip the DCT-IV path entirely (dctiv_plan, DCT-IV API, dctiv benchmark).
- Replace the recursion with iterative scheduling: a build-time radix-4
digit-reversal permutation drives one leaf pass, then log4(N) ping-pong
combine passes run leaves-up (forward) / top-down (inverse). This also
improves locality (forward ~20% faster than the recursion at large N).
- Forward and inverse are first class in both float and double. Forward
uses the explicit 128-bit SoA SIMD combine (V2 double, V4F float, FMA,
portable SSE+NEON); inverse is the exact algebraic inverse (scalar).
- Precomputed t, t^2, t^3 twiddle tables (three muls per combine, no
derivation chain).
Validation: examples/bodft_benchmark.cpp checks both precisions across
N=2..8192 -- forward vs direct DFT, exact impulse phase, exact inverse
roundtrip (~1e-16 double, ~1e-7 float). Warning-clean under
-Wall -Wextra -Wpedantic; existing make test suite still passes.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reframes the half-bin transform as BODFT (Bruun odd-frequency DFT), a first-class half-bin spectral primitive, and removes all DCT-I..IV framing and code. BODFT computes
for real input -- the spectrum sampled halfway between the ordinary FFT bins -- emitting the packed lower half H[0..N/2-1].
Changes:
Validation: examples/bodft_benchmark.cpp checks both precisions across N=2..8192 -- forward vs direct DFT, exact impulse phase, exact inverse roundtrip (~1e-16 double, ~1e-7 float). Warning-clean under -Wall -Wextra -Wpedantic; existing make test suite still passes.