mirror of
https://github.com/zama-ai/concrete.git
synced 2026-02-09 03:55:04 -05:00
refactor(optimizer): remove restart_at
fix new clippy lints
This commit is contained in:
@@ -43,7 +43,6 @@ fn optimize_bootstrap(
|
||||
config,
|
||||
noise_factor,
|
||||
&search_space,
|
||||
None,
|
||||
);
|
||||
result
|
||||
.best_solution
|
||||
|
||||
@@ -35,12 +35,6 @@ impl LevelledComplexity {
|
||||
}
|
||||
}
|
||||
|
||||
impl std::ops::AddAssign<&Self> for LevelledComplexity {
|
||||
fn add_assign(&mut self, rhs: &Self) {
|
||||
*self += *rhs;
|
||||
}
|
||||
}
|
||||
|
||||
impl std::ops::Mul<u64> for LevelledComplexity {
|
||||
type Output = Self;
|
||||
fn mul(self, factor: u64) -> Self {
|
||||
|
||||
@@ -182,7 +182,6 @@ pub fn optimize_one(
|
||||
config: Config,
|
||||
noise_factor: f64,
|
||||
search_space: &SearchSpace,
|
||||
restart_at: Option<Solution>,
|
||||
) -> OptimizationState {
|
||||
assert!(0 < precision && precision <= 16);
|
||||
assert!(1.0 <= noise_factor);
|
||||
@@ -229,13 +228,6 @@ pub fn optimize_one(
|
||||
> consts.safe_variance
|
||||
};
|
||||
|
||||
let skip = |glwe_dim, glwe_poly_size| match restart_at {
|
||||
Some(solution) => {
|
||||
glwe_dim < solution.glwe_dimension && glwe_poly_size < solution.glwe_polynomial_size
|
||||
}
|
||||
None => false,
|
||||
};
|
||||
|
||||
let mut caches = Caches {
|
||||
blind_rotate: blind_rotate::for_security(security_level).cache(),
|
||||
keyswitch: keyswitch::for_security(security_level).cache(),
|
||||
@@ -249,9 +241,6 @@ pub fn optimize_one(
|
||||
if lower_bound_cut(glwe_poly_size) {
|
||||
continue;
|
||||
}
|
||||
if skip(glwe_dim, glwe_poly_size) {
|
||||
continue;
|
||||
}
|
||||
|
||||
let glwe_params = GlweParameters {
|
||||
log2_polynomial_size: glwe_log_poly_size,
|
||||
|
||||
@@ -443,14 +443,8 @@ mod tests {
|
||||
|
||||
times.dag_time += chrono.elapsed().as_nanos();
|
||||
let chrono = Instant::now();
|
||||
let state_ref = atomic_pattern::optimize_one(
|
||||
sum_size,
|
||||
precision,
|
||||
config,
|
||||
weight as f64,
|
||||
&search_space,
|
||||
None,
|
||||
);
|
||||
let state_ref =
|
||||
atomic_pattern::optimize_one(sum_size, precision, config, weight as f64, &search_space);
|
||||
times.worst_time += chrono.elapsed().as_nanos();
|
||||
assert_eq!(
|
||||
state.best_solution.is_some(),
|
||||
@@ -515,14 +509,8 @@ mod tests {
|
||||
};
|
||||
|
||||
let state = optimize(&dag);
|
||||
let state_ref = atomic_pattern::optimize_one(
|
||||
1,
|
||||
precision as u64,
|
||||
config,
|
||||
weight as f64,
|
||||
&search_space,
|
||||
None,
|
||||
);
|
||||
let state_ref =
|
||||
atomic_pattern::optimize_one(1, precision as u64, config, weight as f64, &search_space);
|
||||
assert_eq!(
|
||||
state.best_solution.is_some(),
|
||||
state_ref.best_solution.is_some()
|
||||
|
||||
@@ -137,7 +137,6 @@ pub fn all_results(args: &Args) -> Vec<Vec<OptimizationState>> {
|
||||
config,
|
||||
noise_scale,
|
||||
&search_space,
|
||||
last_solution, // 33% gains
|
||||
)
|
||||
};
|
||||
last_solution = result.best_solution;
|
||||
|
||||
Reference in New Issue
Block a user