arnaucube
arnaucube/poulpyPublic Self-hosted repository
poulpy/src/ring/impl_u64/ring.rs
src/ring/impl_u64/ring.rsRaw
 1use crate::ring::Ring;
 2use crate::dft::ntt::Table;
 3use crate::modulus::prime::Prime;
 4use crate::poly::Poly;
 5
 6impl Ring<u64>{
 7    pub fn new(n:usize, q_base:u64, q_power:usize) -> Self{
 8        let prime: Prime<u64> = Prime::<u64>::new(q_base, q_power);
 9        Self {
10            n: n,
11            modulus: prime.clone(),
12            dft: Box::new(Table::<u64>::new(prime, (2 * n) as u64)),
13        }
14    }
15
16    pub fn n(&self) -> usize{
17        return self.n
18    }
19
20    pub fn new_poly(&self) -> Poly<u64>{
21        Poly::<u64>::new(self.n())
22    }
23}