mirror of
https://github.com/arnaucube/poulpy.git
synced 2026-02-10 13:16:44 +01:00
Improve noise stats functionality
This commit is contained in:
@@ -159,7 +159,7 @@ where
|
||||
col_i,
|
||||
);
|
||||
|
||||
let noise_have: f64 = pt.data.std(base2k, 0).log2();
|
||||
let noise_have: f64 = pt.data.stats(base2k, 0).std().log2();
|
||||
let noise_want: f64 = log2_std_noise_gglwe_product(
|
||||
n as f64,
|
||||
base2k * di,
|
||||
@@ -306,7 +306,7 @@ where
|
||||
col_i,
|
||||
);
|
||||
|
||||
let noise_have: f64 = pt.data.std(base2k, 0).log2();
|
||||
let noise_have: f64 = pt.data.stats(base2k, 0).std().log2();
|
||||
let noise_want: f64 = log2_std_noise_gglwe_product(
|
||||
n as f64,
|
||||
base2k * di,
|
||||
|
||||
@@ -74,7 +74,7 @@ where
|
||||
|
||||
module.glwe_sub_inplace(&mut pt_want, &pt_have);
|
||||
|
||||
let noise_have: f64 = pt_want.data.std(base2k, 0) * (ct.k().as_u32() as f64).exp2();
|
||||
let noise_have: f64 = pt_want.data.stats(base2k, 0).std() * (ct.k().as_u32() as f64).exp2();
|
||||
let noise_want: f64 = SIGMA;
|
||||
|
||||
assert!(noise_have <= noise_want + 0.2);
|
||||
@@ -147,7 +147,7 @@ where
|
||||
|
||||
module.glwe_sub_inplace(&mut pt_want, &pt_have);
|
||||
|
||||
let noise_have: f64 = pt_want.data.std(base2k, 0) * (ct.k().as_u32() as f64).exp2();
|
||||
let noise_have: f64 = pt_want.data.stats(base2k, 0).std() * (ct.k().as_u32() as f64).exp2();
|
||||
let noise_want: f64 = SIGMA;
|
||||
|
||||
assert!(
|
||||
@@ -203,7 +203,7 @@ where
|
||||
);
|
||||
ct.decrypt(module, &mut pt, &sk_prepared, scratch.borrow());
|
||||
|
||||
assert!((SIGMA - pt.data.std(base2k, 0) * (k_ct as f64).exp2()) <= 0.2);
|
||||
assert!((SIGMA - pt.data.stats(base2k, 0).std() * (k_ct as f64).exp2()) <= 0.2);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -271,7 +271,7 @@ where
|
||||
|
||||
module.glwe_sub_inplace(&mut pt_want, &pt_have);
|
||||
|
||||
let noise_have: f64 = pt_want.data.std(base2k, 0).log2();
|
||||
let noise_have: f64 = pt_want.data.stats(base2k, 0).std().log2();
|
||||
let noise_want: f64 = ((((rank as f64) + 1.0) * n as f64 * 0.5 * SIGMA * SIGMA).sqrt()).log2() - (k_ct as f64);
|
||||
|
||||
assert!(
|
||||
|
||||
@@ -150,7 +150,7 @@ where
|
||||
|
||||
module.glwe_sub_inplace(&mut pt, &pt_want);
|
||||
|
||||
let noise_have: f64 = pt.std().log2();
|
||||
let noise_have: f64 = pt.stats().std().log2();
|
||||
|
||||
assert!(
|
||||
noise_have < -((k_ct - base2k) as f64),
|
||||
|
||||
@@ -123,7 +123,7 @@ where
|
||||
module.vec_znx_sub_inplace(&mut pt_want.data, 0, &pt_have.data, 0);
|
||||
module.vec_znx_normalize_inplace(base2k, &mut pt_want.data, 0, scratch.borrow());
|
||||
|
||||
let noise_have: f64 = pt_want.std().log2();
|
||||
let noise_have: f64 = pt_want.stats().std().log2();
|
||||
|
||||
let mut noise_want: f64 = var_noise_gglwe_product(
|
||||
n as f64,
|
||||
|
||||
Reference in New Issue
Block a user