pub struct Plan { /* private fields */ }
Expand description
Negacyclic NTT plan for 64bit primes.
Implementations§
Source§impl Plan
impl Plan
Sourcepub fn try_new(polynomial_size: usize, modulus: u64) -> Option<Self>
pub fn try_new(polynomial_size: usize, modulus: u64) -> Option<Self>
Returns a negacyclic NTT plan for the given polynomial size and modulus, or None
if no
suitable roots of unity can be found for the wanted parameters.
Sourcepub fn fwd(&self, buf: &mut [u64])
pub fn fwd(&self, buf: &mut [u64])
Applies a forward negacyclic NTT transform in place to the given buffer.
§Note
On entry, the buffer holds the polynomial coefficients in standard order. On exit, the buffer holds the negacyclic NTT transform coefficients in bit reversed order.
Sourcepub fn inv(&self, buf: &mut [u64])
pub fn inv(&self, buf: &mut [u64])
Applies an inverse negacyclic NTT transform in place to the given buffer.
§Note
On entry, the buffer holds the negacyclic NTT transform coefficients in bit reversed order. On exit, the buffer holds the polynomial coefficients in standard order.
Sourcepub fn mul_assign_normalize(&self, lhs: &mut [u64], rhs: &[u64])
pub fn mul_assign_normalize(&self, lhs: &mut [u64], rhs: &[u64])
Computes the elementwise product of lhs
and rhs
, multiplied by the inverse of the
polynomial modulo the NTT modulus, and stores the result in lhs
.
Sourcepub fn normalize(&self, values: &mut [u64])
pub fn normalize(&self, values: &mut [u64])
Multiplies the values by the inverse of the polynomial modulo the NTT modulus, and stores
the result in values
.
Sourcepub fn mul_accumulate(&self, acc: &mut [u64], lhs: &[u64], rhs: &[u64])
pub fn mul_accumulate(&self, acc: &mut [u64], lhs: &[u64], rhs: &[u64])
Computes the elementwise product of lhs
and rhs
and accumulates the result to acc
.