Working schemes
Pro7ech jeanphilippe.bossuat@gmail.com
Wed, 19 Nov 2025 09:26:52 +0100
3 files changed,
8 insertions(+),
5 deletions(-)
M
poulpy-core/src/noise/glwe.rs
→
poulpy-core/src/noise/glwe.rs
@@ -52,8 +52,8 @@ S: GLWESecretPreparedToRef<BE>,
{ let (mut pt_have, scratch_1) = scratch.take_glwe_plaintext(res); self.glwe_decrypt(res, &mut pt_have, sk_prepared, scratch_1); - // println!("pt_have: {pt_have}"); - // println!("pt_want: {}", pt_want.to_ref()); + //println!("pt_have: {pt_have}"); + //println!("pt_want: {}", pt_want.to_ref()); self.glwe_sub_inplace(&mut pt_have, pt_want); self.glwe_normalize_inplace(&mut pt_have, scratch_1); pt_have.data.stats(pt_have.base2k().into(), 0)
M
poulpy-schemes/src/tfhe/bdd_arithmetic/ciphertexts/fhe_uint_prepared_debug.rs
→
poulpy-schemes/src/tfhe/bdd_arithmetic/ciphertexts/fhe_uint_prepared_debug.rs
@@ -14,7 +14,7 @@ layouts::{GGSWInfos, GGSWPreparedFactory, GLWEInfos, LWEInfos},
}; use poulpy_hal::api::{ModuleN, ScratchTakeBasic}; -use poulpy_hal::layouts::{Backend, Data, DataMut, DataRef, Module, Scratch, Stats}; +use poulpy_hal::layouts::{Backend, Data, DataMut, DataRef, Module, Scratch, Stats, ZnxZero}; pub struct FheUintPreparedDebug<D: Data, T: UnsignedInteger> { pub(crate) bits: Vec<GGSW<D>>,@@ -99,6 +99,7 @@ let mut stats = Vec::new();
for (i, ggsw) in self.bits.iter().enumerate() { use poulpy_hal::layouts::ZnxViewMut; let (mut pt_want, scratch_1) = scratch.take_scalar_znx(self.n().into(), 1); + pt_want.zero(); pt_want.at_mut(0, 0)[0] = want.bit(i) as i64; stats.push(ggsw.noise(module, row, col, &pt_want, sk, scratch_1)); }
M
poulpy-schemes/src/tfhe/bdd_arithmetic/tests/test_suite/prepare.rs
→
poulpy-schemes/src/tfhe/bdd_arithmetic/tests/test_suite/prepare.rs
@@ -84,8 +84,10 @@
for row in 0..c_enc_prep_debug.dnum().as_usize() { for col in 0..c_enc_prep_debug.rank().as_usize() + 1 { let stats: Vec<Stats> = c_enc_prep_debug.noise(module, row, col, value, sk_glwe_prep, scratch.borrow()); - for stat in &stats { - assert!(stat.std().log2() <= max_noise(col)) + for (i, stat) in stats.iter().enumerate() { + let noise_have: f64 = stat.std().log2(); + let noise_max: f64 = max_noise(col); + assert!(noise_have <= noise_max, "bit: {i} noise_have: {noise_have} > noise_max: {noise_max}") } } }