mirror of
https://github.com/zama-ai/concrete.git
synced 2026-02-08 19:44:57 -05:00
style: remove useless #[allow(lint)]
This commit is contained in:
@@ -3,7 +3,6 @@ use super::super::fft;
|
||||
use crate::parameters::CmuxParameters;
|
||||
use crate::utils::square;
|
||||
|
||||
#[allow(non_snake_case)]
|
||||
pub struct SimpleWithFactors {
|
||||
fft: fft::AsymptoticWithFactors,
|
||||
blind_rotate_factor: f64,
|
||||
@@ -28,7 +27,6 @@ impl SimpleWithFactors {
|
||||
}
|
||||
|
||||
// https://github.com/zama-ai/concrete-optimizer/blob/prototype/python/optimizer/noise_formulas/bootstrap.py#L145
|
||||
#[allow(non_snake_case)]
|
||||
pub fn complexity(&self, params: CmuxParameters, ciphertext_modulus_log: u64) -> Complexity {
|
||||
let glwe_polynomial_size = params.output_glwe_params.polynomial_size() as f64;
|
||||
|
||||
|
||||
@@ -18,7 +18,6 @@ pub(crate) struct ParameterToOperation {
|
||||
pub ks_decomposition: Vec<Vec<OperatorIndex>>,
|
||||
}
|
||||
|
||||
#[allow(clippy::module_name_repetitions)]
|
||||
#[derive(Clone, Copy, PartialEq, Eq, Debug)]
|
||||
pub struct ParameterCount {
|
||||
pub glwe: usize,
|
||||
|
||||
@@ -387,7 +387,6 @@ fn update_state_with_best_decompositions<W: UnsignedInteger>(
|
||||
|
||||
// This function provides reference values with unoptimised code, until we have non regeression tests
|
||||
#[allow(clippy::float_cmp)]
|
||||
#[allow(clippy::too_many_lines)]
|
||||
fn assert_checks<W: UnsignedInteger>(
|
||||
consts: &OptimizationDecompositionsConsts,
|
||||
internal_dim: u64,
|
||||
@@ -492,7 +491,6 @@ fn assert_checks<W: UnsignedInteger>(
|
||||
|
||||
const REL_EPSILON_PROBA: f64 = 1.0 + 1e-8;
|
||||
|
||||
#[allow(clippy::too_many_lines)]
|
||||
pub fn optimize_one<W: UnsignedInteger>(
|
||||
sum_size: u64,
|
||||
precision: u64,
|
||||
|
||||
@@ -193,7 +193,6 @@ fn update_best_solution_with_best_decompositions<W: UnsignedInteger>(
|
||||
|
||||
const REL_EPSILON_PROBA: f64 = 1.0 + 1e-8;
|
||||
|
||||
#[allow(clippy::too_many_lines)]
|
||||
pub fn optimize<W: UnsignedInteger>(
|
||||
dag: &unparametrized::OperationDag,
|
||||
config: Config,
|
||||
@@ -315,7 +314,6 @@ pub fn optimize_v0<W: UnsignedInteger>(
|
||||
state
|
||||
}
|
||||
|
||||
#[allow(clippy::unnecessary_cast)] // unecessary warning on 'as Precision'
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use std::time::Instant;
|
||||
@@ -595,16 +593,14 @@ mod tests {
|
||||
circuit(&mut dag_multi, high_precision, 1);
|
||||
}
|
||||
let state_multi = optimize(&dag_multi);
|
||||
#[allow(clippy::question_mark)] // question mark doesn't work here
|
||||
if state_multi.best_solution.is_none() {
|
||||
return None;
|
||||
}
|
||||
|
||||
let mut sol_multi = state_multi.best_solution?;
|
||||
|
||||
let state_low = optimize(&dag_low);
|
||||
let state_high = optimize(&dag_high);
|
||||
|
||||
let sol_low = state_low.best_solution.unwrap();
|
||||
let sol_high = state_high.best_solution.unwrap();
|
||||
let mut sol_multi = state_multi.best_solution.unwrap();
|
||||
sol_multi.complexity /= 2.0;
|
||||
if sol_low.complexity < sol_high.complexity {
|
||||
assert!(sol_high.assert_same_pbs_solution(sol_multi));
|
||||
|
||||
@@ -2,24 +2,19 @@ use crate::dag::operator::Precision;
|
||||
|
||||
// Default heuristic to split in several word
|
||||
pub fn default_coprimes(precision: Precision) -> Vec<u64> {
|
||||
#[allow(clippy::match_same_arms)]
|
||||
match precision {
|
||||
1 => vec![2], // 1 bit
|
||||
2 => vec![4], // 2 bit
|
||||
3 => vec![8], // 3 bit
|
||||
4 => vec![2, 3, 7], // 1,2,3 bits
|
||||
5 => vec![2, 3, 7], // 1,2,3 bits
|
||||
6 => vec![2, 5, 7], // 1,3,3 bits
|
||||
7 => vec![3, 7, 8], // 2,3,3 bits
|
||||
8 => vec![5, 7, 8], // 3,3,3 bits
|
||||
9 => vec![5, 7, 16], // 3,3,4 bits
|
||||
10 => vec![7, 15, 16], // 3,4,4 bits
|
||||
11 => vec![13, 15, 16], // 4,4,4 bits
|
||||
12 => vec![13, 15, 16], // 4,4,4 bits
|
||||
13 => vec![11, 13, 15, 16], // 4,4,4,4 bits
|
||||
14 => vec![11, 13, 15, 16], // 4,4,4,4 bits
|
||||
15 => vec![11, 13, 15, 16], // 4,4,4,4 bits
|
||||
16 => vec![7, 8, 9, 11, 13], // 4,4,4,4,4 bits
|
||||
1 => vec![2], // 1 bit
|
||||
2 => vec![4], // 2 bit
|
||||
3 => vec![8], // 3 bit
|
||||
4 | 5 => vec![2, 3, 7], // 1,2,3 bits
|
||||
6 => vec![2, 5, 7], // 1,3,3 bits
|
||||
7 => vec![3, 7, 8], // 2,3,3 bits
|
||||
8 => vec![5, 7, 8], // 3,3,3 bits
|
||||
9 => vec![5, 7, 16], // 3,3,4 bits
|
||||
10 => vec![7, 15, 16], // 3,4,4 bits
|
||||
11 | 12 => vec![13, 15, 16], // 4,4,4 bits
|
||||
13 | 14 | 15 => vec![11, 13, 15, 16], // 4,4,4,4 bits
|
||||
16 => vec![7, 8, 9, 11, 13], // 4,4,4,4,4 bits
|
||||
0 => panic!("Precision cannot be zero"),
|
||||
_ => panic!("Precision is limited to 16-bits"),
|
||||
}
|
||||
|
||||
@@ -106,7 +106,6 @@ impl From<Solution> for atomic_pattern::Solution {
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(clippy::type_complexity)]
|
||||
#[derive(Debug)]
|
||||
struct NoiseCostByMicroParam {
|
||||
cutted_blind_rotate: Vec<ComplexityNoise>,
|
||||
@@ -114,7 +113,6 @@ struct NoiseCostByMicroParam {
|
||||
pp_switching: Vec<(f64, Complexity)>,
|
||||
}
|
||||
|
||||
#[allow(clippy::too_many_lines)]
|
||||
fn compute_noise_cost_by_micro_param<W: UnsignedInteger>(
|
||||
consts: &OptimizationDecompositionsConsts,
|
||||
glwe_params: GlweParameters,
|
||||
@@ -447,9 +445,6 @@ fn update_state_with_best_decompositions<W: UnsignedInteger>(
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(clippy::expect_fun_call)]
|
||||
#[allow(clippy::identity_op)]
|
||||
#[allow(clippy::too_many_lines)]
|
||||
fn optimize_raw<W: UnsignedInteger>(
|
||||
max_word_precision: u64, // max precision of a word
|
||||
log_norm: f64, // ?? norm2 of noise multisum, complexity of multisum is neglected
|
||||
@@ -521,7 +516,6 @@ fn optimize_raw<W: UnsignedInteger>(
|
||||
state
|
||||
}
|
||||
|
||||
#[allow(clippy::too_many_lines)]
|
||||
pub fn optimize_one<W: UnsignedInteger>(
|
||||
precision: u64,
|
||||
config: Config,
|
||||
@@ -548,7 +542,6 @@ pub fn optimize_one<W: UnsignedInteger>(
|
||||
state
|
||||
}
|
||||
|
||||
#[allow(clippy::too_many_lines)]
|
||||
pub fn optimize_one_compat<W: UnsignedInteger>(
|
||||
_sum_size: u64,
|
||||
precision: u64,
|
||||
|
||||
Reference in New Issue
Block a user