Commit 7ef6a273 authored by Jakub Klemsa's avatar Jakub Klemsa
Browse files

Minor: before New Approach.

parent 57a07fb9
......@@ -74,10 +74,10 @@ results.each do |ri|
eta_calc = eta par[:pi], par[:_2Delta], v0_calc, par[:N], par[:n]
eta_meas = eta par[:pi], par[:_2Delta], v0_meas, par[:N], par[:n]
puts "(♥) %12.10f of %12.10f (%7.2f%%)" % [h, hb, h/hb*100]
puts "(♦) %12.10f of %12.10f (%7.2f%%)" % [d, db, d/db*100]
puts "(♣) %12.10f of %12.10f (%7.2f%%)" % [c, cb, c/cb*100]
puts "(♠) %12.10f of %12.10f (%7.2f%%)" % [s, sb, s/sb*100]
puts "(♥) %12.10f of %12.10f (used %7.2f%%, bnd ratio %7.5f, actual ratio %7.5f)" % [h, hb, h/hb*100, hb/(hb+db+cb+sb), h/(h+d+c+s)]
puts "(♦) %12.10f of %12.10f (used %7.2f%%, bnd ratio %7.5f, actual ratio %7.5f)" % [d, db, d/db*100, db/(hb+db+cb+sb), d/(h+d+c+s)]
puts "(♣) %12.10f of %12.10f (used %7.2f%%, bnd ratio %7.5f, actual ratio %7.5f)" % [c, cb, c/cb*100, cb/(hb+db+cb+sb), c/(h+d+c+s)]
puts "(♠) %12.10f of %12.10f (used %7.2f%%, bnd ratio %7.5f, actual ratio %7.5f)" % [s, sb, s/sb*100, sb/(hb+db+cb+sb), s/(h+d+c+s)]
puts "(V_0 M calc) %12.10f" % [v0_calc]
puts "(V_0 C calc) %12.10f" % [v0_calc_C]
puts "(V_0 meas) %12.10f" % [v0_meas]
......
......@@ -58,6 +58,33 @@ pub const NUM_STEPS_XY: usize = STEPS_XY * EXTRA_STEPS_XY;
pub const NUM_STEPS_ABCD: usize = STEPS_ABCD * EXTRA_STEPS_ABCD;
// Other Constants
/// RLWE Dimension(s) N
#[cfg(any(feature = "perturb", feature = "numerical"))]
#[allow(non_upper_case_globals)]
pub const Ns: [usize; 6] = [256, 512, 1024, 2048, 4096, 8192]; // the higher ones are (usually) excluded by param filtering
#[cfg(any(feature = "perturb", feature = "numerical"))]
#[allow(non_upper_case_globals)]
pub const KAPPA_MAX: usize = 1;
#[cfg(any(feature = "perturb", feature = "numerical"))]
pub const NU_MAX: usize = 20; // just to ensure ...
pub const THREE: f64 = 3.0; // to call log2() on
/// Noise Growth in BlindRotate
#[cfg(not(feature = "brot_im"))]
pub const BROT_NOISE_FACTOR: usize = 1;
#[cfg(feature = "brot_im")]
pub const BROT_NOISE_FACTOR: usize = 3;
// Imported Constants
/// Torus Precision in Concrete
#[cfg(any(feature = "perturb", feature = "numerical"))]
pub const TORUS_PREC: f64 = 64.0; // https://github.com/zama-ai/concrete/blob/concrete-0.1.11/concrete/src/lib.rs#L21
// Manual Params
#[cfg(feature = "manual")]
......@@ -411,29 +438,3 @@ pub const MAN_PARAMS: [[Params; 3]; 1] = [
//~ },
//~ ],
//~ ];
// Other Constants
/// RLWE Dimension(s) N
#[cfg(any(feature = "perturb", feature = "numerical"))]
#[allow(non_upper_case_globals)]
pub const Ns: [usize; 6] = [256, 512, 1024, 2048, 4096, 8192]; // the higher ones are (usually) excluded by param filtering
#[cfg(any(feature = "perturb", feature = "numerical"))]
#[allow(non_upper_case_globals)]
pub const KAPPA_MAX: usize = 20;
#[cfg(any(feature = "perturb", feature = "numerical"))]
pub const NU_MAX: usize = 20; // just to ensure ...
/// Noise Growth in BlindRotate
#[cfg(not(feature = "brot_im"))]
pub const BROT_NOISE_FACTOR: usize = 1;
#[cfg(feature = "brot_im")]
pub const BROT_NOISE_FACTOR: usize = 3;
// Imported Constants
/// Torus Precision in Concrete
#[cfg(any(feature = "perturb", feature = "numerical"))]
pub const TORUS_PREC: f64 = 64.0; // https://github.com/zama-ai/concrete/blob/concrete-0.1.11/concrete/src/lib.rs#L21
......@@ -72,6 +72,11 @@ impl Params {
Params::refine(&mut to_refine_params);
n_params += to_refine_params.len();
//~ //DBG out
//~ for par in to_refine_params.clone() {
//~ println!("\n{:?}", par);
//~ }
#[cfg(feature = "perturb")]
println!("{}", format!("\n(i) Generated {} valid params with pertb. x = {:.3}, y = {:.3}, a = {:.3}, b = {:.3}, c = {:.3}, d = {:.3}\n ({}-bit, for π = {}, 2^2∆ = {}; refined).\n ============================================================================\n",
to_refine_params.len(),
......@@ -163,7 +168,7 @@ impl Params {
return Err("(!) τ_KS > 64");
}
let n: usize = ((-logAKSn / s_lambda).floor() as usize).max(n_min); //TODO FIXME shall be ceil
let n: usize = ((-logAKSn / s_lambda).ceil() as usize).max(n_min);
if n > n_max {return Err("(!) too small upper bound on n");}
let gamma_l_min = (Params::diamond_gamma_l_min(pi, Delta2, nu, n, y, b)).ceil() as usize;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment