fixed automorphism on gglwe for k_out < k_in

This commit is contained in:
Jean-Philippe Bossuat
2025-06-17 09:46:22 +02:00
parent ca19def72f
commit b93e011347
3 changed files with 38 additions and 24 deletions

View File

@@ -10,7 +10,7 @@ fn automorphism() {
let log_n: usize = 8;
let basek: usize = 12;
let k_in: usize = 60;
let k_out: usize = 60;
let k_out: usize = 40;
let digits: usize = k_in.div_ceil(basek);
let sigma: f64 = 3.2;
(1..4).for_each(|rank| {
@@ -141,12 +141,12 @@ fn test_automorphism(
sigma * sigma,
0f64,
rank as f64,
k_in,
k_out,
k_apply,
);
assert!(
(noise_have - noise_want).abs() <= 0.5,
noise_have < noise_want + 0.5,
"{} {}",
noise_have,
noise_want
@@ -260,7 +260,7 @@ fn test_automorphism_inplace(
);
assert!(
(noise_have - noise_want).abs() <= 0.5,
noise_have < noise_want + 0.5,
"{} {}",
noise_have,
noise_want

View File

@@ -62,7 +62,7 @@ pub(crate) fn log2_std_noise_gglwe_product(
b_logq,
);
noise = noise.sqrt();
noise.log2().min(-1.0) // max noise is [-2^{-1}, 2^{-1}]
noise.log2().min(-1.0).max(-(a_logq as f64)) // max noise is [-2^{-1}, 2^{-1}]
}
pub(crate) fn noise_ggsw_product(