Skip to content

Refactor NTT butterfly iterations & remove redundant input arrays and padding#3

Merged
erdkocak merged 3 commits intomasterfrom
ntt-basic-fixes
Mar 21, 2026
Merged

Refactor NTT butterfly iterations & remove redundant input arrays and padding#3
erdkocak merged 3 commits intomasterfrom
ntt-basic-fixes

Conversation

@doran2728
Copy link
Collaborator

Summary

Targeted performance and structural optimizations to the core NTT module.

Changes

Redundant Array Cleanup (Domain.lean, Forward.lean)

  • Removed inputArray, zeroPad, and pad helper functions
  • The forward pipeline now evaluates directly on raw polynomials without an intermediate array copy

Butterfly Iteration Refactor (Forward.lean, Inverse.lean)

  • Rewrote the Cooley-Tukey butterflyStage outer loop in both the forward and inverse transforms
  • Before: for base in [0:D.n] with an inner if base % blockSize == 0 guard
  • After: for block in [0:D.n / blockSize] with base := block * blockSize
  • This direct block iteration eliminates redundant modulo checks, yields faster wall-clock execution, and significantly simplifies the upcoming formal correctness proofs

@erdkocak
Copy link
Owner

thanks for the effort, since tests pass and the changes were necessary I am merging

@erdkocak erdkocak merged commit e4885b1 into master Mar 21, 2026
@doran2728 doran2728 deleted the ntt-basic-fixes branch March 21, 2026 17:49
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.

2 participants