mirror of
https://github.com/arnaucube/poulpy.git
synced 2026-02-10 13:16:44 +01:00
fixed automorphism on gglwe for k_out < k_in
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user