Skip to content

Conversation

@jacksonwalters
Copy link
Member

add a test for the case with modulus = 2*p^k for a prime p. the multiplicative group is cyclic here as well.

currently, this case is failing. the resulting polynomial is almost right, but there are a few coefficients that are off by either p^k or 2*p^k.

being off by 2*p^k is a non-issue since that's just the modulus. being off by p^k indicates something isn't quite right.

note that gcd(n,2*p^k) = 2 since n is a power of 2, so n is not invertible. since the divide-and-conquer method requires n be a power of 2, it is currently unclear how to get the NTT working in this case despite the multiplicative group being cyclic.
@jacksonwalters jacksonwalters changed the title failing test for 2*p^k remove failing test for 2*p^k Feb 11, 2025
@jacksonwalters jacksonwalters changed the title remove failing test for 2*p^k remove failing test for 2p^k Feb 11, 2025
@jacksonwalters
Copy link
Member Author

jacksonwalters commented Feb 11, 2025

note that since n must be a power of two for the divide-and-conquer algorithm to work, then gcd(n,2p^k) = 2, so n is not invertible. for now, there is no obvious workaround, so even though $2p^k$ has a cyclic multiplicative group, we will not attempt to compute the NTT.

we add a gcd function and add a check when computing $n^{-1}$ to ensure that n is actually invertible.

@jacksonwalters jacksonwalters merged commit 1fe9601 into main Feb 11, 2025
1 check passed
@jacksonwalters jacksonwalters deleted the add_unit_test_for_twice_prime_power_modulus branch February 11, 2025 23:16
@jacksonwalters jacksonwalters linked an issue Feb 11, 2025 that may be closed by this pull request
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.

n is not invertible when modulus = 2p^k

2 participants