Skip to content

builtins: add fft and ifft via Cooley-Tukey#200

Merged
danieljohnmorris merged 1 commit into
mainfrom
fix/fft-builtins
May 12, 2026
Merged

builtins: add fft and ifft via Cooley-Tukey#200
danieljohnmorris merged 1 commit into
mainfrom
fix/fft-builtins

Conversation

@danieljohnmorris
Copy link
Copy Markdown
Collaborator

Signal-processing and frequency-domain work are weak spots without a built-in FFT.

Implementation:

  • fft xs returns complex spectrum as list of [re, im] pairs
  • ifft inverts it
  • iterative Cooley-Tukey, power-of-two only with clear error on non-pow2
  • in-place butterflies on pre-sized scratch buffer, allocation-light
  • opcodes allocated: fft, ifft

Tests: cross-engine regression tests + examples/fft.ilo with -- run: directives.

@danieljohnmorris danieljohnmorris force-pushed the fix/fft-builtins branch 2 times, most recently from 90e75ad to dc8e58e Compare May 12, 2026 09:22
@codecov
Copy link
Copy Markdown

codecov Bot commented May 12, 2026

Codecov Report

❌ Patch coverage is 78.16712% with 81 lines in your changes missing coverage. Please review.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/interpreter/mod.rs 76.51% 35 Missing ⚠️
src/verify.rs 33.33% 20 Missing ⚠️
src/vm/compile_cranelift.rs 17.64% 14 Missing ⚠️
src/vm/mod.rs 92.10% 12 Missing ⚠️

📢 Thoughts on this report? Let us know!

Signal-processing and frequency-domain analysis are weak spots for
any language that lacks a built-in FFT. fft xs returns the complex
spectrum as a list of [re, im] pairs, ifft inverts it. Both use
iterative Cooley-Tukey, power-of-two only for now with a clear
error on non-pow2 input.

Opcodes allocated: fft, ifft. Implementation is allocation-light:
in-place butterflies on a pre-sized scratch buffer.
@danieljohnmorris danieljohnmorris merged commit 4b69a45 into main May 12, 2026
4 of 5 checks passed
@danieljohnmorris danieljohnmorris deleted the fix/fft-builtins branch May 12, 2026 09:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant