#modulo #prime #transform #power #composite #numbers #polynomial

bin+lib ntt

Fast NTT (number theoretic transform) for polynomial multiplcation for primes, prime power, and certain composite moduli

10 releases

0.1.9 Feb 17, 2025
0.1.8 Feb 17, 2025
0.1.2 Jan 28, 2025

#732 in Math

Download history 259/week @ 2025-01-22 109/week @ 2025-01-29 288/week @ 2025-02-05 529/week @ 2025-02-12 152/week @ 2025-02-19 46/week @ 2025-02-26

1,029 downloads per month
Used in 2 crates

MIT and AGPL-3.0-or-later

18KB
254 lines

ntt

CI MIT License crates.io

Implementation of the number theoretic transform (NTT) in Rust.

The NTT is a DFT over the ring Z/mZ. We use a fast divide-and conquer algorithm. The array size n must be a power of two.

We allow composite moduli as long as n divides phi(p^e) for each prime factor p of the modulus, where phi is the Euler totient.

Dependencies

~2MB
~44K SLoC