impl GetModulus for WordSizeModulus
Janmajaya Mall janmajayamall@protonmail.com
Mon, 20 May 2024 10:05:37 +0530
2 files changed,
15 insertions(+),
6 deletions(-)
M
src/backend.rs
→
src/backend.rs
@@ -345,10 +345,6 @@
fn sub(&self, a: &Self::Element, b: &Self::Element) -> Self::Element { T::Element::wrapping_sub(a, b) } - - // fn modulus(&self) -> &T { - // &self.modulus - // } } impl<T> VectorOps for WordSizeModulus<T>@@ -420,3 +416,14 @@ // fn modulus(&self) -> &T {
// &self.modulus // } } + +impl<T> GetModulus for WordSizeModulus<T> +where + T: Modulus, +{ + type Element = T::Element; + type M = T; + fn modulus(&self) -> &Self::M { + &self.modulus + } +}
M
src/bool/evaluator.rs
→
src/bool/evaluator.rs
@@ -1881,7 +1881,7 @@ use rand::{thread_rng, Rng};
use rand_distr::Uniform; use crate::{ - backend::ModularOpsU64, + backend::{GetModulus, ModInit, ModularOpsU64, WordSizeModulus}, bool, ntt::NttBackendU64, random::DEFAULT_RNG,@@ -1922,10 +1922,12 @@ let rng = DefaultSecureRng::new_seeded([19u8; 32]);
*r = rng; }); + // let mog = WordSizeModulus::<CiphertextModulus<u64>>::new(12u64); + let mut bool_evaluator = BoolEvaluator::< Vec<Vec<u64>>, NttBackendU64, - ModularOpsU64<CiphertextModulus<u64>>, + WordSizeModulus<CiphertextModulus<u64>>, ModularOpsU64<CiphertextModulus<u64>>, >::new(SP_BOOL_PARAMS);