From bc3c778b1990691b1f0dc307b450f0c5902b822c Mon Sep 17 00:00:00 2001 From: "Mayeul@Zama" <69792125+mayeul-zama@users.noreply.github.com> Date: Fri, 4 Oct 2024 10:19:52 +0200 Subject: [PATCH] chore(all): enforce polynomial size to be a power of 2 --- tfhe/benches/core_crypto/dev_bench.rs | 4 +- tfhe/benches/core_crypto/pbs128_bench.rs | 2 +- .../references/core-crypto-api/tutorial.md | 2 +- .../fine-grained-apis/boolean/parameters.md | 2 +- .../fine-grained-apis/shortint/parameters.md | 2 +- tfhe/src/boolean/parameters/mod.rs | 2 +- tfhe/src/boolean/parameters/params.rs | 8 +- tfhe/src/c_api/boolean/parameters.rs | 4 +- tfhe/src/c_api/core_crypto/mod.rs | 24 ++-- tfhe/src/c_api/shortint/parameters.rs | 4 +- .../core_crypto/algorithms/ggsw_encryption.rs | 12 +- .../core_crypto/algorithms/glwe_encryption.rs | 63 +++++----- .../algorithms/glwe_linear_algebra.rs | 66 +++++------ .../algorithms/glwe_sample_extraction.rs | 34 +++--- .../algorithms/glwe_secret_key_generation.rs | 2 +- .../lwe_bootstrap_key_generation.rs | 4 +- .../lwe_multi_bit_bootstrap_key_generation.rs | 4 +- ...we_multi_bit_programmable_bootstrapping.rs | 6 +- .../algorithms/lwe_packing_keyswitch.rs | 32 ++--- .../lwe_packing_keyswitch_key_generation.rs | 12 +- ...tional_packing_keyswitch_key_generation.rs | 10 +- .../lwe_programmable_bootstrapping/fft128.rs | 2 +- .../lwe_programmable_bootstrapping/fft64.rs | 14 +-- .../lwe_programmable_bootstrapping/ntt64.rs | 18 +-- tfhe/src/core_crypto/algorithms/lwe_wopbs.rs | 2 +- .../algorithms/polynomial_algorithms.rs | 56 +++++---- .../algorithms/test/ggsw_encryption.rs | 2 +- .../test/lwe_bootstrap_key_generation.rs | 2 +- .../lwe_multi_bit_bootstrap_key_generation.rs | 2 +- .../lwe_packing_keyswitch_key_generation.rs | 2 +- ...we_private_functional_packing_keyswitch.rs | 10 +- .../test/lwe_programmable_bootstrapping.rs | 10 +- tfhe/src/core_crypto/algorithms/test/mod.rs | 38 +++--- .../algorithms/test/noise_distribution/mod.rs | 2 +- .../commons/generators/encryption/test.rs | 2 +- .../src/core_crypto/commons/math/ntt/ntt64.rs | 4 +- tfhe/src/core_crypto/commons/mod.rs | 2 +- tfhe/src/core_crypto/commons/parameters.rs | 30 ++++- ...ressed_modulus_switched_glwe_ciphertext.rs | 50 ++++---- ...dulus_switched_multi_bit_lwe_ciphertext.rs | 2 +- .../core_crypto/entities/ggsw_ciphertext.rs | 24 ++-- .../entities/ggsw_ciphertext_list.rs | 18 +-- .../core_crypto/entities/glwe_ciphertext.rs | 24 ++-- .../entities/glwe_ciphertext_list.rs | 14 ++- .../core_crypto/entities/glwe_secret_key.rs | 8 +- .../core_crypto/entities/lwe_bootstrap_key.rs | 2 +- .../entities/lwe_compact_public_key.rs | 6 +- .../entities/lwe_multi_bit_bootstrap_key.rs | 9 +- .../entities/lwe_packing_keyswitch_key.rs | 14 ++- ...rivate_functional_packing_keyswitch_key.rs | 16 ++- ...e_functional_packing_keyswitch_key_list.rs | 14 ++- .../entities/ntt_ggsw_ciphertext.rs | 2 +- .../entities/ntt_ggsw_ciphertext_list.rs | 2 +- .../entities/ntt_lwe_bootstrap_key.rs | 2 +- tfhe/src/core_crypto/entities/polynomial.rs | 12 +- .../core_crypto/entities/polynomial_list.rs | 22 ++-- .../entities/seeded_ggsw_ciphertext.rs | 22 ++-- .../entities/seeded_ggsw_ciphertext_list.rs | 18 +-- .../entities/seeded_glwe_ciphertext.rs | 10 +- .../entities/seeded_glwe_ciphertext_list.rs | 8 +- .../entities/seeded_lwe_bootstrap_key.rs | 2 +- .../entities/seeded_lwe_compact_public_key.rs | 4 +- .../seeded_lwe_multi_bit_bootstrap_key.rs | 2 +- .../seeded_lwe_packing_keyswitch_key.rs | 20 ++-- .../algorithms/glwe_fast_keyswitch.rs | 10 +- .../glwe_partial_sample_extraction.rs | 16 +-- .../partial_glwe_secret_key_generation.rs | 2 +- .../algorithms/test/lwe_fast_keyswitch.rs | 4 +- .../algorithms/test/lwe_stair_keyswitch.rs | 2 +- .../entities/pseudo_ggsw_ciphertext.rs | 22 ++-- .../fft_impl/fft128/math/fft/mod.rs | 6 +- .../fft_impl/fft128/math/fft/tests.rs | 8 +- .../fft_impl/fft64/crypto/wop_pbs/tests.rs | 26 ++-- .../fft_impl/fft64/math/fft/mod.rs | 36 +++--- .../fft_impl/fft64/math/fft/tests.rs | 4 +- .../fft_impl/fft64/math/polynomial.rs | 4 +- tfhe/src/integer/parameters/mod.rs | 10 +- tfhe/src/js_on_wasm_api/boolean.rs | 2 +- tfhe/src/js_on_wasm_api/shortint.rs | 6 +- .../gaussian/p_fail_2_minus_64/ks_pbs.rs | 72 +++++------ .../gaussian/p_fail_2_minus_64/pbs_ks.rs | 8 +- .../gaussian/p_fail_2_minus_64/ks_pbs.rs | 72 +++++------ .../gaussian/p_fail_2_minus_64/pbs_ks.rs | 8 +- .../tuniform/p_fail_2_minus_64/ks_pbs.rs | 2 +- .../tuniform/p_fail_2_minus_64/pbs_ks.rs | 8 +- .../parameters/coverage_parameters.rs | 12 +- .../shortint/parameters/list_compression.rs | 4 +- .../multi_bit/p_fail_2_minus_64/ks_pbs.rs | 112 +++++++++--------- .../multi_bit/p_fail_2_minus_64/ks_pbs_gpu.rs | 12 +- .../parameters_wopbs_message_carry.rs | 88 +++++++------- .../parameters/parameters_wopbs_only.rs | 72 +++++------ tfhe/tests/backward_compatibility/shortint.rs | 2 +- 92 files changed, 764 insertions(+), 690 deletions(-) diff --git a/tfhe/benches/core_crypto/dev_bench.rs b/tfhe/benches/core_crypto/dev_bench.rs index 2177b90b30..c14d21c1ff 100644 --- a/tfhe/benches/core_crypto/dev_bench.rs +++ b/tfhe/benches/core_crypto/dev_bench.rs @@ -34,7 +34,7 @@ fn get_bench_params() -> ( DecompositionBaseLog(3), DecompositionLevelCount(5), GlweDimension(1), - PolynomialSize(1024), + PolynomialSize::new(1024), LweBskGroupingFactor(2), ThreadCount(5), ) @@ -45,7 +45,7 @@ fn get_bench_params() -> ( DecompositionBaseLog(18), DecompositionLevelCount(1), GlweDimension(3), - PolynomialSize(512), + PolynomialSize::new(512), LweBskGroupingFactor(2), ThreadCount(5), ) diff --git a/tfhe/benches/core_crypto/pbs128_bench.rs b/tfhe/benches/core_crypto/pbs128_bench.rs index 96599d4521..e254f41fdf 100644 --- a/tfhe/benches/core_crypto/pbs128_bench.rs +++ b/tfhe/benches/core_crypto/pbs128_bench.rs @@ -22,7 +22,7 @@ fn pbs_128(c: &mut Criterion) { let lwe_dimension = LweDimension(860); let glwe_dimension = GlweDimension(2); - let polynomial_size = PolynomialSize(2048); + let polynomial_size = PolynomialSize::new(2048); let lwe_noise_distribution = DynamicDistribution::new_t_uniform(45); let glwe_noise_distribution = DynamicDistribution::new_t_uniform(24); let pbs_base_log = DecompositionBaseLog(24); diff --git a/tfhe/docs/references/core-crypto-api/tutorial.md b/tfhe/docs/references/core-crypto-api/tutorial.md index 2f05b4b909..2cdf4328cd 100644 --- a/tfhe/docs/references/core-crypto-api/tutorial.md +++ b/tfhe/docs/references/core-crypto-api/tutorial.md @@ -47,7 +47,7 @@ pub fn main() { // Define the parameters for a 4 bits message able to hold the doubled 2 bits message let small_lwe_dimension = LweDimension(742); let glwe_dimension = GlweDimension(1); - let polynomial_size = PolynomialSize(2048); + let polynomial_size = PolynomialSize::new(2048); let lwe_noise_distribution = Gaussian::from_dispersion_parameter(StandardDev(0.000007069849454709433), 0.0); let glwe_noise_distribution = diff --git a/tfhe/docs/references/fine-grained-apis/boolean/parameters.md b/tfhe/docs/references/fine-grained-apis/boolean/parameters.md index 110446abaf..7583178605 100644 --- a/tfhe/docs/references/fine-grained-apis/boolean/parameters.md +++ b/tfhe/docs/references/fine-grained-apis/boolean/parameters.md @@ -30,7 +30,7 @@ fn main() { let parameters = BooleanParameters::new( LweDimension(586), GlweDimension(2), - PolynomialSize(512), + PolynomialSize::new(512), DynamicDistribution::new_gaussian_from_std_dev( StandardDev(0.00008976167396834998), ), diff --git a/tfhe/docs/references/fine-grained-apis/shortint/parameters.md b/tfhe/docs/references/fine-grained-apis/shortint/parameters.md index e2eeaf8482..3d1076c2c6 100644 --- a/tfhe/docs/references/fine-grained-apis/shortint/parameters.md +++ b/tfhe/docs/references/fine-grained-apis/shortint/parameters.md @@ -60,7 +60,7 @@ fn main() { let param = ClassicPBSParameters::new( LweDimension(656), GlweDimension(2), - PolynomialSize(512), + PolynomialSize::new(512), DynamicDistribution::new_gaussian_from_std_dev( StandardDev(0.000034119201269311964), ), diff --git a/tfhe/src/boolean/parameters/mod.rs b/tfhe/src/boolean/parameters/mod.rs index 3ce31df1a3..90a2cf5a30 100644 --- a/tfhe/src/boolean/parameters/mod.rs +++ b/tfhe/src/boolean/parameters/mod.rs @@ -130,7 +130,7 @@ impl BooleanKeySwitchingParameters { pub const TFHE_LIB_PARAMETERS: BooleanParameters = BooleanParameters { lwe_dimension: LweDimension(630), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(1024), + polynomial_size: PolynomialSize::new(1024), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 0.000030517578125, )), diff --git a/tfhe/src/boolean/parameters/params.rs b/tfhe/src/boolean/parameters/params.rs index ad463a81eb..c9ea44ddc9 100644 --- a/tfhe/src/boolean/parameters/params.rs +++ b/tfhe/src/boolean/parameters/params.rs @@ -10,7 +10,7 @@ use crate::core_crypto::prelude::*; pub const DEFAULT_PARAMETERS: BooleanParameters = BooleanParameters { lwe_dimension: LweDimension(805), glwe_dimension: GlweDimension(3), - polynomial_size: PolynomialSize(512), + polynomial_size: PolynomialSize::new(512), #[allow(clippy::excessive_precision)] lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 5.8615896642671336e-06, @@ -28,7 +28,7 @@ pub const DEFAULT_PARAMETERS: BooleanParameters = BooleanParameters { pub const DEFAULT_PARAMETERS_KS_PBS: BooleanParameters = BooleanParameters { lwe_dimension: LweDimension(739), glwe_dimension: GlweDimension(3), - polynomial_size: PolynomialSize(512), + polynomial_size: PolynomialSize::new(512), #[allow(clippy::excessive_precision)] lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 1.8304520733507305e-05, @@ -46,7 +46,7 @@ pub const DEFAULT_PARAMETERS_KS_PBS: BooleanParameters = BooleanParameters { pub const PARAMETERS_ERROR_PROB_2_POW_MINUS_165: BooleanParameters = BooleanParameters { lwe_dimension: LweDimension(837), glwe_dimension: GlweDimension(2), - polynomial_size: PolynomialSize(1024), + polynomial_size: PolynomialSize::new(1024), #[allow(clippy::excessive_precision)] lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 3.374714376692653e-06, @@ -64,7 +64,7 @@ pub const PARAMETERS_ERROR_PROB_2_POW_MINUS_165: BooleanParameters = BooleanPara pub const PARAMETERS_ERROR_PROB_2_POW_MINUS_165_KS_PBS: BooleanParameters = BooleanParameters { lwe_dimension: LweDimension(770), glwe_dimension: GlweDimension(2), - polynomial_size: PolynomialSize(1024), + polynomial_size: PolynomialSize::new(1024), #[allow(clippy::excessive_precision)] lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 1.0721931696480342e-05, diff --git a/tfhe/src/c_api/boolean/parameters.rs b/tfhe/src/c_api/boolean/parameters.rs index cb4737342e..2fab8b3d9c 100644 --- a/tfhe/src/c_api/boolean/parameters.rs +++ b/tfhe/src/c_api/boolean/parameters.rs @@ -58,7 +58,7 @@ impl TryFrom for crate::boolean::parameters::BooleanParameter Ok(Self { lwe_dimension: LweDimension(c_params.lwe_dimension), glwe_dimension: GlweDimension(c_params.glwe_dimension), - polynomial_size: PolynomialSize(c_params.polynomial_size), + polynomial_size: PolynomialSize::new(c_params.polynomial_size), lwe_noise_distribution: c_params.lwe_noise_distribution.try_into()?, glwe_noise_distribution: c_params.glwe_noise_distribution.try_into()?, pbs_base_log: DecompositionBaseLog(c_params.pbs_base_log), @@ -81,7 +81,7 @@ impl BooleanParameters { Self { lwe_dimension: rust_params.lwe_dimension.0, glwe_dimension: rust_params.glwe_dimension.0, - polynomial_size: rust_params.polynomial_size.0, + polynomial_size: rust_params.polynomial_size.get(), lwe_noise_distribution: rust_params.lwe_noise_distribution.convert_to_c(), glwe_noise_distribution: rust_params.glwe_noise_distribution.convert_to_c(), pbs_base_log: rust_params.pbs_base_log.0, diff --git a/tfhe/src/c_api/core_crypto/mod.rs b/tfhe/src/c_api/core_crypto/mod.rs index 8568fd88ea..a86d3bf042 100644 --- a/tfhe/src/c_api/core_crypto/mod.rs +++ b/tfhe/src/c_api/core_crypto/mod.rs @@ -212,7 +212,7 @@ pub unsafe extern "C" fn core_crypto_ggsw_encrypt( use crate::core_crypto::prelude::*; let glwe_sk_slice = std::slice::from_raw_parts(glwe_sk_ptr, glwe_sk_dim * poly_size); - let glwe_sk = GlweSecretKey::from_container(glwe_sk_slice, PolynomialSize(poly_size)); + let glwe_sk = GlweSecretKey::from_container(glwe_sk_slice, PolynomialSize::new(poly_size)); let seed_low_bytes: u128 = seed_low_bytes.into(); let seed_high_bytes: u128 = seed_high_bytes.into(); @@ -230,14 +230,14 @@ pub unsafe extern "C" fn core_crypto_ggsw_encrypt( output_ct_ptr, ggsw_ciphertext_size( GlweDimension(glwe_sk_dim).to_glwe_size(), - PolynomialSize(poly_size), + PolynomialSize::new(poly_size), DecompositionLevelCount(level_count), ), ); let mut ct = GgswCiphertext::from_container( output_ct, GlweDimension(glwe_sk_dim).to_glwe_size(), - PolynomialSize(poly_size), + PolynomialSize::new(poly_size), DecompositionBaseLog(base_log), CiphertextModulus::new_native(), ); @@ -289,18 +289,18 @@ pub unsafe extern "C" fn core_crypto_glwe_decrypt( use crate::core_crypto::prelude::*; let glwe_sk_slice = std::slice::from_raw_parts(glwe_sk_ptr, glwe_sk_dim * glwe_poly_size); - let glwe_sk = GlweSecretKey::from_container(glwe_sk_slice, PolynomialSize(glwe_poly_size)); + let glwe_sk = GlweSecretKey::from_container(glwe_sk_slice, PolynomialSize::new(glwe_poly_size)); let input_ct = std::slice::from_raw_parts( input_ct_ptr, glwe_ciphertext_size( GlweDimension(glwe_sk_dim).to_glwe_size(), - PolynomialSize(glwe_poly_size), + PolynomialSize::new(glwe_poly_size), ), ); let ct = GlweCiphertext::from_container( input_ct, - PolynomialSize(glwe_poly_size), + PolynomialSize::new(glwe_poly_size), CiphertextModulus::new_native(), ); let output = std::slice::from_raw_parts_mut(output_pt, glwe_poly_size); @@ -327,7 +327,7 @@ pub unsafe extern "C" fn core_crypto_lwe_multi_bit_bootstrapping_key_element_siz let input_lwe_sk_dim = LweDimension(input_lwe_sk_dim); let output_glwe_sk_dim = GlweDimension(output_glwe_sk_dim); - let output_glwe_sk_poly_size = PolynomialSize(output_glwe_sk_poly_size); + let output_glwe_sk_poly_size = PolynomialSize::new(output_glwe_sk_poly_size); let lwe_multi_bit_level_count = DecompositionLevelCount(lwe_multi_bit_level_count); let lwe_multi_bit_grouping_factor = LweBskGroupingFactor(lwe_multi_bit_grouping_factor); @@ -366,7 +366,7 @@ pub unsafe extern "C" fn core_crypto_par_generate_lwe_bootstrapping_key( let input_lwe_sk = LweSecretKey::from_container(input_lwe_sk_slice); let output_glwe_sk_dim = GlweDimension(output_glwe_sk_dim); - let output_glwe_sk_poly_size = PolynomialSize(output_glwe_sk_poly_size); + let output_glwe_sk_poly_size = PolynomialSize::new(output_glwe_sk_poly_size); let output_glwe_sk_size = glwe_ciphertext_mask_size(output_glwe_sk_dim, output_glwe_sk_poly_size); let output_glwe_sk_slice = @@ -450,7 +450,7 @@ pub unsafe extern "C" fn core_crypto_par_generate_lwe_multi_bit_bootstrapping_ke let input_lwe_sk = LweSecretKey::from_container(input_lwe_sk_slice); let output_glwe_sk_dim = GlweDimension(output_glwe_sk_dim); - let output_glwe_sk_poly_size = PolynomialSize(output_glwe_sk_poly_size); + let output_glwe_sk_poly_size = PolynomialSize::new(output_glwe_sk_poly_size); let output_glwe_sk_size = glwe_ciphertext_mask_size(output_glwe_sk_dim, output_glwe_sk_poly_size); let output_glwe_sk_slice = @@ -611,7 +611,7 @@ pub unsafe extern "C" fn core_crypto_par_generate_lwe_private_functional_keyswit let output_glwe_sk_slice = std::slice::from_raw_parts(output_glwe_sk_ptr, glwe_dim * poly_size); let output_glwe_sk = - GlweSecretKey::from_container(output_glwe_sk_slice, PolynomialSize(poly_size)); + GlweSecretKey::from_container(output_glwe_sk_slice, PolynomialSize::new(poly_size)); let seed_low_bytes: u128 = seed_low_bytes.into(); let seed_high_bytes: u128 = seed_high_bytes.into(); @@ -632,7 +632,7 @@ pub unsafe extern "C" fn core_crypto_par_generate_lwe_private_functional_keyswit DecompositionLevelCount(pksk_level_count), LweDimension(input_lwe_sk_dim), GlweDimension(glwe_dim).to_glwe_size(), - PolynomialSize(poly_size), + PolynomialSize::new(poly_size), FunctionalPackingKeyswitchKeyCount(glwe_dim + 1), CiphertextModulus::new_native(), ); @@ -647,7 +647,7 @@ pub unsafe extern "C" fn core_crypto_par_generate_lwe_private_functional_keyswit DecompositionLevelCount(pksk_level_count), LweDimension(input_lwe_sk_dim).to_lwe_size(), GlweDimension(glwe_dim).to_glwe_size(), - PolynomialSize(poly_size), + PolynomialSize::new(poly_size), CiphertextModulus::new_native(), ); diff --git a/tfhe/src/c_api/shortint/parameters.rs b/tfhe/src/c_api/shortint/parameters.rs index 3b71a9502b..db4a77e706 100644 --- a/tfhe/src/c_api/shortint/parameters.rs +++ b/tfhe/src/c_api/shortint/parameters.rs @@ -51,7 +51,7 @@ impl TryFrom for crate::shortint::ClassicPBSParameters { Ok(Self { lwe_dimension: LweDimension(c_params.lwe_dimension), glwe_dimension: GlweDimension(c_params.glwe_dimension), - polynomial_size: PolynomialSize(c_params.polynomial_size), + polynomial_size: PolynomialSize::new(c_params.polynomial_size), lwe_noise_distribution: c_params.lwe_noise_distribution.try_into()?, glwe_noise_distribution: c_params.glwe_noise_distribution.try_into()?, pbs_base_log: DecompositionBaseLog(c_params.pbs_base_log), @@ -106,7 +106,7 @@ impl ShortintPBSParameters { Self { lwe_dimension: rust_params.lwe_dimension.0, glwe_dimension: rust_params.glwe_dimension.0, - polynomial_size: rust_params.polynomial_size.0, + polynomial_size: rust_params.polynomial_size.get(), lwe_noise_distribution: rust_params.lwe_noise_distribution.convert_to_c(), glwe_noise_distribution: rust_params.glwe_noise_distribution.convert_to_c(), pbs_base_log: rust_params.pbs_base_log.0, diff --git a/tfhe/src/core_crypto/algorithms/ggsw_encryption.rs b/tfhe/src/core_crypto/algorithms/ggsw_encryption.rs index e99dc19c17..b121e0911f 100644 --- a/tfhe/src/core_crypto/algorithms/ggsw_encryption.rs +++ b/tfhe/src/core_crypto/algorithms/ggsw_encryption.rs @@ -55,7 +55,7 @@ pub fn ggsw_encryption_multiplicative_factor( /// // computations /// // Define parameters for GgswCiphertext creation /// let glwe_size = GlweSize(2); -/// let polynomial_size = PolynomialSize(1024); +/// let polynomial_size = PolynomialSize::new(1024); /// let decomp_base_log = DecompositionBaseLog(8); /// let decomp_level_count = DecompositionLevelCount(3); /// let glwe_noise_distribution = @@ -188,7 +188,7 @@ pub fn encrypt_constant_ggsw_ciphertext, { assert!( - output_plaintext_list.plaintext_count().0 == input_glwe_ciphertext.polynomial_size().0, + output_plaintext_list.plaintext_count().0 == input_glwe_ciphertext.polynomial_size().get(), "Mismatched output PlaintextCount {:?} and input PolynomialSize {:?}", output_plaintext_list.plaintext_count(), input_glwe_ciphertext.polynomial_size() @@ -863,7 +863,7 @@ pub fn decrypt_glwe_ciphertext_other_mod OutputCont: ContainerMut, { assert!( - output_plaintext_list.plaintext_count().0 == input_glwe_ciphertext.polynomial_size().0, + output_plaintext_list.plaintext_count().0 == input_glwe_ciphertext.polynomial_size().get(), "Mismatched output PlaintextCount {:?} and input PolynomialSize {:?}", output_plaintext_list.plaintext_count(), input_glwe_ciphertext.polynomial_size() @@ -914,14 +914,14 @@ pub fn decrypt_glwe_ciphertext_list( { assert!( output_plaintext_list.plaintext_count().0 - == input_glwe_ciphertext_list.polynomial_size().0 + == input_glwe_ciphertext_list.polynomial_size().get() * input_glwe_ciphertext_list.glwe_ciphertext_count().0, "Mismatched output PlaintextCount {:?} and input PolynomialSize ({:?}) * \ GlweCiphertextCount ({:?}) = {:?}", output_plaintext_list.plaintext_count(), input_glwe_ciphertext_list.polynomial_size(), input_glwe_ciphertext_list.glwe_ciphertext_count(), - input_glwe_ciphertext_list.polynomial_size().0 + input_glwe_ciphertext_list.polynomial_size().get() * input_glwe_ciphertext_list.glwe_ciphertext_count().0 ); assert!( @@ -938,10 +938,9 @@ pub fn decrypt_glwe_ciphertext_list( input_glwe_ciphertext_list.polynomial_size() ); - for (ciphertext, mut output_sublist) in input_glwe_ciphertext_list - .iter() - .zip(output_plaintext_list.chunks_exact_mut(input_glwe_ciphertext_list.polynomial_size().0)) - { + for (ciphertext, mut output_sublist) in input_glwe_ciphertext_list.iter().zip( + output_plaintext_list.chunks_exact_mut(input_glwe_ciphertext_list.polynomial_size().get()), + ) { decrypt_glwe_ciphertext(glwe_secret_key, &ciphertext, &mut output_sublist); } } @@ -966,7 +965,7 @@ pub fn decrypt_glwe_ciphertext_list( /// // computations /// // Define parameters for GlweCiphertext creation /// let glwe_size = GlweSize(2); -/// let polynomial_size = PolynomialSize(1024); +/// let polynomial_size = PolynomialSize::new(1024); /// let ciphertext_modulus = CiphertextModulus::new_native(); /// /// // Create the PRNG @@ -978,7 +977,7 @@ pub fn decrypt_glwe_ciphertext_list( /// // Create the plaintext /// let msg = 3u64; /// let encoded_msg = msg << 60; -/// let plaintext_list = PlaintextList::new(encoded_msg, PlaintextCount(polynomial_size.0)); +/// let plaintext_list = PlaintextList::new(encoded_msg, PlaintextCount(polynomial_size.get())); /// /// // Create a new GlweCiphertext /// let mut glwe = GlweCiphertext::new(0u64, glwe_size, polynomial_size, ciphertext_modulus); @@ -1016,7 +1015,7 @@ pub fn trivially_encrypt_glwe_ciphertext( InputCont: Container, { assert!( - encoded.plaintext_count().0 == output.polynomial_size().0, + encoded.plaintext_count().0 == output.polynomial_size().get(), "Mismatched input PlaintextCount {:?} and output PolynomialSize {:?}", encoded.plaintext_count(), output.polynomial_size() @@ -1061,7 +1060,7 @@ pub fn trivially_encrypt_glwe_ciphertext( /// // computations /// // Define parameters for GlweCiphertext creation /// let glwe_size = GlweSize(2); -/// let polynomial_size = PolynomialSize(1024); +/// let polynomial_size = PolynomialSize::new(1024); /// let ciphertext_modulus = CiphertextModulus::new_native(); /// /// // Create the PRNG @@ -1073,7 +1072,7 @@ pub fn trivially_encrypt_glwe_ciphertext( /// // Create the plaintext /// let msg = 3u64; /// let encoded_msg = msg << 60; -/// let plaintext_list = PlaintextList::new(encoded_msg, PlaintextCount(polynomial_size.0)); +/// let plaintext_list = PlaintextList::new(encoded_msg, PlaintextCount(polynomial_size.get())); /// /// // Create a new GlweCiphertext /// let glwe = allocate_and_trivially_encrypt_new_glwe_ciphertext( @@ -1113,7 +1112,7 @@ where Scalar: UnsignedTorus, InputCont: Container, { - let polynomial_size = PolynomialSize(encoded.plaintext_count().0); + let polynomial_size = PolynomialSize::new(encoded.plaintext_count().0); let mut new_ct = GlweCiphertextOwned::new(Scalar::ZERO, glwe_size, polynomial_size, ciphertext_modulus); @@ -1156,7 +1155,7 @@ pub fn encrypt_seeded_glwe_ciphertext_with_existing_generator< Gen: ByteRandomGenerator, { assert!( - output_glwe_ciphertext.polynomial_size().0 == input_plaintext_list.plaintext_count().0, + output_glwe_ciphertext.polynomial_size().get() == input_plaintext_list.plaintext_count().0, "Mismatch between PolynomialSize of output ciphertext PlaintextCount of input. \ Got {:?} in output, and {:?} in input.", output_glwe_ciphertext.polynomial_size(), @@ -1209,7 +1208,7 @@ pub fn encrypt_seeded_glwe_ciphertext_with_existing_generator< /// // computations /// // Define parameters for GlweCiphertext creation /// let glwe_size = GlweSize(2); -/// let polynomial_size = PolynomialSize(1024); +/// let polynomial_size = PolynomialSize::new(1024); /// let glwe_noise_distribution = /// Gaussian::from_dispersion_parameter(StandardDev(0.00000000000000029403601535432533), 0.0); /// let ciphertext_modulus = CiphertextModulus::new_native(); @@ -1230,7 +1229,7 @@ pub fn encrypt_seeded_glwe_ciphertext_with_existing_generator< /// // Create the plaintext /// let msg = 3u64; /// let encoded_msg = msg << 60; -/// let plaintext_list = PlaintextList::new(encoded_msg, PlaintextCount(polynomial_size.0)); +/// let plaintext_list = PlaintextList::new(encoded_msg, PlaintextCount(polynomial_size.get())); /// /// // Create a new GlweCiphertext /// let mut glwe = SeededGlweCiphertext::new( @@ -1345,12 +1344,12 @@ pub fn encrypt_seeded_glwe_ciphertext_list_with_existing_generator< output.glwe_size().to_glwe_dimension(), ); assert!( - output.glwe_ciphertext_count().0 * output.polynomial_size().0 + output.glwe_ciphertext_count().0 * output.polynomial_size().get() == encoded.plaintext_count().0, "Mismatch between number of output ciphertexts and input plaintexts. \ Got {:?} plaintexts while {:?} plaintexts are required to encrypt {:?} ciphertexts.", encoded.plaintext_count(), - output.glwe_ciphertext_count().0 * output.polynomial_size().0, + output.glwe_ciphertext_count().0 * output.polynomial_size().get(), output.glwe_ciphertext_count() ); @@ -1372,7 +1371,7 @@ pub fn encrypt_seeded_glwe_ciphertext_list_with_existing_generator< for (mut output_glwe, plaintext_list) in output .iter_mut() - .zip(encoded.chunks_exact(polynomial_size.0)) + .zip(encoded.chunks_exact(polynomial_size.get())) { fill_glwe_mask_and_body_for_encryption( glwe_secret_key, @@ -1395,7 +1394,7 @@ pub fn encrypt_seeded_glwe_ciphertext_list_with_existing_generator< /// // computations /// // Define parameters for GlweCiphertext creation /// let glwe_size = GlweSize(2); -/// let polynomial_size = PolynomialSize(1024); +/// let polynomial_size = PolynomialSize::new(1024); /// let glwe_noise_distribution = /// Gaussian::from_dispersion_parameter(StandardDev(0.00000000000000029403601535432533), 0.0); /// let glwe_count = GlweCiphertextCount(2); @@ -1419,7 +1418,7 @@ pub fn encrypt_seeded_glwe_ciphertext_list_with_existing_generator< /// let encoded_msg = msg << 60; /// let plaintext_list = PlaintextList::new( /// encoded_msg, -/// PlaintextCount(polynomial_size.0 * glwe_count.0), +/// PlaintextCount(polynomial_size.get() * glwe_count.0), /// ); /// /// // Create a new GlweCiphertextList diff --git a/tfhe/src/core_crypto/algorithms/glwe_linear_algebra.rs b/tfhe/src/core_crypto/algorithms/glwe_linear_algebra.rs index 3f222a8823..6f7aec08f8 100644 --- a/tfhe/src/core_crypto/algorithms/glwe_linear_algebra.rs +++ b/tfhe/src/core_crypto/algorithms/glwe_linear_algebra.rs @@ -17,7 +17,7 @@ use crate::core_crypto::entities::*; /// // computations /// // Define parameters for GlweCiphertext creation /// let glwe_dimension = GlweDimension(1); -/// let polynomial_size = PolynomialSize(2048); +/// let polynomial_size = PolynomialSize::new(2048); /// let glwe_noise_distribution = /// Gaussian::from_dispersion_parameter(StandardDev(0.00000000000000029403601535432533), 0.0); /// let ciphertext_modulus = CiphertextModulus::new_native(); @@ -40,7 +40,7 @@ use crate::core_crypto::entities::*; /// // Create the plaintext /// let msg = 3u64; /// let encoded_msg = msg << 60; -/// let plaintext_list = PlaintextList::new(encoded_msg, PlaintextCount(polynomial_size.0)); +/// let plaintext_list = PlaintextList::new(encoded_msg, PlaintextCount(polynomial_size.get())); /// /// // Create a new GlweCiphertext /// let mut glwe = GlweCiphertext::new( @@ -62,7 +62,7 @@ use crate::core_crypto::entities::*; /// glwe_ciphertext_add_assign(&mut glwe, &rhs); /// /// let mut output_plaintext_list = -/// PlaintextList::new(0u64, PlaintextCount(glwe.polynomial_size().0)); +/// PlaintextList::new(0u64, PlaintextCount(glwe.polynomial_size().get())); /// /// decrypt_glwe_ciphertext(&glwe_secret_key, &glwe, &mut output_plaintext_list); /// @@ -110,7 +110,7 @@ pub fn glwe_ciphertext_add_assign( /// // computations /// // Define parameters for GlweCiphertext creation /// let glwe_dimension = GlweDimension(1); -/// let polynomial_size = PolynomialSize(2048); +/// let polynomial_size = PolynomialSize::new(2048); /// let glwe_noise_distribution = /// Gaussian::from_dispersion_parameter(StandardDev(0.00000000000000029403601535432533), 0.0); /// let ciphertext_modulus = CiphertextModulus::new_native(); @@ -133,7 +133,7 @@ pub fn glwe_ciphertext_add_assign( /// // Create the plaintext /// let msg = 3u64; /// let encoded_msg = msg << 60; -/// let plaintext_list = PlaintextList::new(encoded_msg, PlaintextCount(polynomial_size.0)); +/// let plaintext_list = PlaintextList::new(encoded_msg, PlaintextCount(polynomial_size.get())); /// /// // Create a new GlweCiphertext /// let mut glwe = GlweCiphertext::new( @@ -157,7 +157,7 @@ pub fn glwe_ciphertext_add_assign( /// glwe_ciphertext_add(&mut output, &glwe, &rhs); /// /// let mut output_plaintext_list = -/// PlaintextList::new(0u64, PlaintextCount(output.polynomial_size().0)); +/// PlaintextList::new(0u64, PlaintextCount(output.polynomial_size().get())); /// /// decrypt_glwe_ciphertext(&glwe_secret_key, &output, &mut output_plaintext_list); /// @@ -214,7 +214,7 @@ pub fn glwe_ciphertext_add( /// // computations /// // Define parameters for GlweCiphertext creation /// let glwe_dimension = GlweDimension(1); -/// let polynomial_size = PolynomialSize(2048); +/// let polynomial_size = PolynomialSize::new(2048); /// let glwe_noise_distribution = /// Gaussian::from_dispersion_parameter(StandardDev(0.00000000000000029403601535432533), 0.0); /// let ciphertext_modulus = CiphertextModulus::new_native(); @@ -237,7 +237,7 @@ pub fn glwe_ciphertext_add( /// // Create the plaintext /// let msg = 3u64; /// let encoded_msg = msg << 60; -/// let plaintext_list = PlaintextList::new(encoded_msg, PlaintextCount(polynomial_size.0)); +/// let plaintext_list = PlaintextList::new(encoded_msg, PlaintextCount(polynomial_size.get())); /// /// // Create a new GlweCiphertext /// let mut glwe = GlweCiphertext::new( @@ -257,7 +257,7 @@ pub fn glwe_ciphertext_add( /// glwe_ciphertext_plaintext_list_add_assign(&mut glwe, &plaintext_list); /// /// let mut output_plaintext_list = -/// PlaintextList::new(0u64, PlaintextCount(glwe.polynomial_size().0)); +/// PlaintextList::new(0u64, PlaintextCount(glwe.polynomial_size().get())); /// /// decrypt_glwe_ciphertext(&glwe_secret_key, &glwe, &mut output_plaintext_list); /// @@ -306,7 +306,7 @@ pub fn glwe_ciphertext_plaintext_list_add_assign( /// // computations /// // Define parameters for GlweCiphertext creation /// let glwe_dimension = GlweDimension(1); -/// let polynomial_size = PolynomialSize(2048); +/// let polynomial_size = PolynomialSize::new(2048); /// let glwe_noise_distribution = /// Gaussian::from_dispersion_parameter(StandardDev(0.00000000000000029403601535432533), 0.0); /// let ciphertext_modulus = CiphertextModulus::new_native(); @@ -329,7 +329,7 @@ pub fn glwe_ciphertext_plaintext_list_add_assign( /// // Create the plaintext /// let msg = 3u64; /// let encoded_msg = msg << 60; -/// let plaintext_list = PlaintextList::new(encoded_msg, PlaintextCount(polynomial_size.0)); +/// let plaintext_list = PlaintextList::new(encoded_msg, PlaintextCount(polynomial_size.get())); /// /// // Create a new GlweCiphertext /// let mut glwe = GlweCiphertext::new( @@ -349,7 +349,7 @@ pub fn glwe_ciphertext_plaintext_list_add_assign( /// glwe_ciphertext_plaintext_list_sub_assign(&mut glwe, &plaintext_list); /// /// let mut output_plaintext_list = -/// PlaintextList::new(0u64, PlaintextCount(glwe.polynomial_size().0)); +/// PlaintextList::new(0u64, PlaintextCount(glwe.polynomial_size().get())); /// /// decrypt_glwe_ciphertext(&glwe_secret_key, &glwe, &mut output_plaintext_list); /// @@ -398,7 +398,7 @@ pub fn glwe_ciphertext_plaintext_list_sub_assign( /// // computations /// // Define parameters for GlweCiphertext creation /// let glwe_dimension = GlweDimension(1); -/// let polynomial_size = PolynomialSize(2048); +/// let polynomial_size = PolynomialSize::new(2048); /// let glwe_noise_distribution = /// Gaussian::from_dispersion_parameter(StandardDev(0.00000000000000029403601535432533), 0.0); /// let ciphertext_modulus = CiphertextModulus::new_native(); @@ -421,7 +421,7 @@ pub fn glwe_ciphertext_plaintext_list_sub_assign( /// // Create the plaintext /// let msg = 3u64; /// let encoded_msg = msg << 60; -/// let plaintext_list = PlaintextList::new(encoded_msg, PlaintextCount(polynomial_size.0)); +/// let plaintext_list = PlaintextList::new(encoded_msg, PlaintextCount(polynomial_size.get())); /// /// // Create a new GlweCiphertext /// let mut glwe = GlweCiphertext::new( @@ -441,7 +441,7 @@ pub fn glwe_ciphertext_plaintext_list_sub_assign( /// glwe_ciphertext_plaintext_add_assign(&mut glwe, Plaintext(encoded_msg)); /// /// let mut output_plaintext_list = -/// PlaintextList::new(0u64, PlaintextCount(glwe.polynomial_size().0)); +/// PlaintextList::new(0u64, PlaintextCount(glwe.polynomial_size().get())); /// /// decrypt_glwe_ciphertext(&glwe_secret_key, &glwe, &mut output_plaintext_list); /// @@ -490,7 +490,7 @@ pub fn glwe_ciphertext_plaintext_add_assign( /// // computations /// // Define parameters for GlweCiphertext creation /// let glwe_dimension = GlweDimension(1); -/// let polynomial_size = PolynomialSize(2048); +/// let polynomial_size = PolynomialSize::new(2048); /// let glwe_noise_distribution = /// Gaussian::from_dispersion_parameter(StandardDev(0.00000000000000029403601535432533), 0.0); /// let ciphertext_modulus = CiphertextModulus::new_native(); @@ -513,7 +513,7 @@ pub fn glwe_ciphertext_plaintext_add_assign( /// // Create the plaintext /// let msg = 3u64; /// let encoded_msg = msg << 60; -/// let plaintext_list = PlaintextList::new(encoded_msg, PlaintextCount(polynomial_size.0)); +/// let plaintext_list = PlaintextList::new(encoded_msg, PlaintextCount(polynomial_size.get())); /// /// // Create a new GlweCiphertext /// let mut glwe = GlweCiphertext::new( @@ -533,7 +533,7 @@ pub fn glwe_ciphertext_plaintext_add_assign( /// glwe_ciphertext_plaintext_sub_assign(&mut glwe, Plaintext(encoded_msg)); /// /// let mut output_plaintext_list = -/// PlaintextList::new(0u64, PlaintextCount(glwe.polynomial_size().0)); +/// PlaintextList::new(0u64, PlaintextCount(glwe.polynomial_size().get())); /// /// decrypt_glwe_ciphertext(&glwe_secret_key, &glwe, &mut output_plaintext_list); /// @@ -581,7 +581,7 @@ pub fn glwe_ciphertext_plaintext_sub_assign( /// // computations /// // Define parameters for GlweCiphertext creation /// let glwe_dimension = GlweDimension(1); -/// let polynomial_size = PolynomialSize(2048); +/// let polynomial_size = PolynomialSize::new(2048); /// let glwe_noise_distribution = /// Gaussian::from_dispersion_parameter(StandardDev(0.00000000000000029403601535432533), 0.0); /// let ciphertext_modulus = CiphertextModulus::new_native(); @@ -604,7 +604,7 @@ pub fn glwe_ciphertext_plaintext_sub_assign( /// // Create the plaintext /// let msg = 3u64; /// let encoded_msg = msg << 60; -/// let plaintext_list = PlaintextList::new(encoded_msg, PlaintextCount(polynomial_size.0)); +/// let plaintext_list = PlaintextList::new(encoded_msg, PlaintextCount(polynomial_size.get())); /// /// // Create a new GlweCiphertext /// let mut glwe = GlweCiphertext::new( @@ -624,7 +624,7 @@ pub fn glwe_ciphertext_plaintext_sub_assign( /// glwe_ciphertext_opposite_assign(&mut glwe); /// /// let mut output_plaintext_list = -/// PlaintextList::new(0u64, PlaintextCount(glwe.polynomial_size().0)); +/// PlaintextList::new(0u64, PlaintextCount(glwe.polynomial_size().get())); /// /// decrypt_glwe_ciphertext(&glwe_secret_key, &glwe, &mut output_plaintext_list); /// @@ -662,7 +662,7 @@ where /// // computations /// // Define parameters for GlweCiphertext creation /// let glwe_dimension = GlweDimension(1); -/// let polynomial_size = PolynomialSize(2048); +/// let polynomial_size = PolynomialSize::new(2048); /// let glwe_noise_distribution = /// Gaussian::from_dispersion_parameter(StandardDev(0.00000000000000029403601535432533), 0.0); /// let ciphertext_modulus = CiphertextModulus::new_native(); @@ -686,7 +686,7 @@ where /// let msg = 3u64; /// let encoded_msg = msg << 60; /// let cleartext_mul = Cleartext(2); -/// let plaintext_list = PlaintextList::new(encoded_msg, PlaintextCount(polynomial_size.0)); +/// let plaintext_list = PlaintextList::new(encoded_msg, PlaintextCount(polynomial_size.get())); /// /// // Create a new GlweCiphertext /// let mut glwe = GlweCiphertext::new( @@ -706,7 +706,7 @@ where /// glwe_ciphertext_cleartext_mul_assign(&mut glwe, cleartext_mul); /// /// let mut output_plaintext_list = -/// PlaintextList::new(0u64, PlaintextCount(glwe.polynomial_size().0)); +/// PlaintextList::new(0u64, PlaintextCount(glwe.polynomial_size().get())); /// /// decrypt_glwe_ciphertext(&glwe_secret_key, &glwe, &mut output_plaintext_list); /// @@ -746,7 +746,7 @@ pub fn glwe_ciphertext_cleartext_mul_assign( /// // computations /// // Define parameters for GlweCiphertext creation /// let glwe_dimension = GlweDimension(1); -/// let polynomial_size = PolynomialSize(2048); +/// let polynomial_size = PolynomialSize::new(2048); /// let glwe_noise_distribution = /// Gaussian::from_dispersion_parameter(StandardDev(0.00000000000000029403601535432533), 0.0); /// let ciphertext_modulus = CiphertextModulus::new_native(); @@ -770,7 +770,7 @@ pub fn glwe_ciphertext_cleartext_mul_assign( /// let msg = 3u64; /// let encoded_msg = msg << 60; /// let cleartext_mul = Cleartext(2); -/// let plaintext_list = PlaintextList::new(encoded_msg, PlaintextCount(polynomial_size.0)); +/// let plaintext_list = PlaintextList::new(encoded_msg, PlaintextCount(polynomial_size.get())); /// /// // Create a new GlweCiphertext /// let mut glwe = GlweCiphertext::new( @@ -792,7 +792,7 @@ pub fn glwe_ciphertext_cleartext_mul_assign( /// glwe_ciphertext_cleartext_mul(&mut output, &glwe, cleartext_mul); /// /// let mut output_plaintext_list = -/// PlaintextList::new(0u64, PlaintextCount(output.polynomial_size().0)); +/// PlaintextList::new(0u64, PlaintextCount(output.polynomial_size().get())); /// /// decrypt_glwe_ciphertext(&glwe_secret_key, &output, &mut output_plaintext_list); /// @@ -842,7 +842,7 @@ pub fn glwe_ciphertext_cleartext_mul( /// // computations /// // Define parameters for GlweCiphertext creation /// let glwe_dimension = GlweDimension(1); -/// let polynomial_size = PolynomialSize(2048); +/// let polynomial_size = PolynomialSize::new(2048); /// let glwe_noise_distribution = /// Gaussian::from_dispersion_parameter(StandardDev(0.00000000000000029403601535432533), 0.0); /// let ciphertext_modulus = CiphertextModulus::new_native(); @@ -865,7 +865,7 @@ pub fn glwe_ciphertext_cleartext_mul( /// // Create the plaintext /// let msg = 3u64; /// let encoded_msg = msg << 60; -/// let plaintext_list = PlaintextList::new(encoded_msg, PlaintextCount(polynomial_size.0)); +/// let plaintext_list = PlaintextList::new(encoded_msg, PlaintextCount(polynomial_size.get())); /// /// // Create a new GlweCiphertext /// let mut glwe = GlweCiphertext::new( @@ -887,7 +887,7 @@ pub fn glwe_ciphertext_cleartext_mul( /// glwe_ciphertext_sub_assign(&mut glwe, &rhs); /// /// let mut output_plaintext_list = -/// PlaintextList::new(0u64, PlaintextCount(glwe.polynomial_size().0)); +/// PlaintextList::new(0u64, PlaintextCount(glwe.polynomial_size().get())); /// /// decrypt_glwe_ciphertext(&glwe_secret_key, &glwe, &mut output_plaintext_list); /// @@ -935,7 +935,7 @@ pub fn glwe_ciphertext_sub_assign( /// // computations /// // Define parameters for GlweCiphertext creation /// let glwe_dimension = GlweDimension(1); -/// let polynomial_size = PolynomialSize(2048); +/// let polynomial_size = PolynomialSize::new(2048); /// let glwe_noise_distribution = /// Gaussian::from_dispersion_parameter(StandardDev(0.00000000000000029403601535432533), 0.0); /// let ciphertext_modulus = CiphertextModulus::new_native(); @@ -958,7 +958,7 @@ pub fn glwe_ciphertext_sub_assign( /// // Create the plaintext /// let msg = 3u64; /// let encoded_msg = msg << 60; -/// let plaintext_list = PlaintextList::new(encoded_msg, PlaintextCount(polynomial_size.0)); +/// let plaintext_list = PlaintextList::new(encoded_msg, PlaintextCount(polynomial_size.get())); /// /// // Create a new GlweCiphertext /// let mut glwe = GlweCiphertext::new( @@ -982,7 +982,7 @@ pub fn glwe_ciphertext_sub_assign( /// glwe_ciphertext_sub(&mut output, &glwe, &rhs); /// /// let mut output_plaintext_list = -/// PlaintextList::new(0u64, PlaintextCount(output.polynomial_size().0)); +/// PlaintextList::new(0u64, PlaintextCount(output.polynomial_size().get())); /// /// decrypt_glwe_ciphertext(&glwe_secret_key, &output, &mut output_plaintext_list); /// diff --git a/tfhe/src/core_crypto/algorithms/glwe_sample_extraction.rs b/tfhe/src/core_crypto/algorithms/glwe_sample_extraction.rs index 216d456575..183eada56b 100644 --- a/tfhe/src/core_crypto/algorithms/glwe_sample_extraction.rs +++ b/tfhe/src/core_crypto/algorithms/glwe_sample_extraction.rs @@ -24,7 +24,7 @@ use rayon::prelude::*; /// // computations /// // Define parameters for GlweCiphertext creation /// let glwe_size = GlweSize(2); -/// let polynomial_size = PolynomialSize(1024); +/// let polynomial_size = PolynomialSize::new(1024); /// let glwe_noise_distribution = /// Gaussian::from_dispersion_parameter(StandardDev(0.00000000000000029403601535432533), 0.0); /// let ciphertext_modulus = CiphertextModulus::new_native(); @@ -47,7 +47,7 @@ use rayon::prelude::*; /// // Create the plaintext /// let msg = 3u64; /// let encoded_msg = msg << 60; -/// let mut plaintext_list = PlaintextList::new(encoded_msg, PlaintextCount(polynomial_size.0)); +/// let mut plaintext_list = PlaintextList::new(encoded_msg, PlaintextCount(polynomial_size.get())); /// /// let special_value = 15; /// *plaintext_list.get_mut(42).0 = 15 << 60; @@ -129,14 +129,14 @@ pub fn extract_lwe_sample_from_glwe_ciphertext( // We compute the number of elements which must be // turned into their opposite - let opposite_count = input_glwe.polynomial_size().0 - nth.0 - 1; + let opposite_count = input_glwe.polynomial_size().get() - nth.0 - 1; let ciphertext_modulus = input_glwe.ciphertext_modulus(); if ciphertext_modulus.is_compatible_with_native_modulus() { // We loop through the polynomials for lwe_mask_poly in lwe_mask .as_mut() - .chunks_exact_mut(input_glwe.polynomial_size().0) + .chunks_exact_mut(input_glwe.polynomial_size().get()) { // We reverse the polynomial lwe_mask_poly.reverse(); @@ -150,7 +150,7 @@ pub fn extract_lwe_sample_from_glwe_ciphertext( // We loop through the polynomials for lwe_mask_poly in lwe_mask .as_mut() - .chunks_exact_mut(input_glwe.polynomial_size().0) + .chunks_exact_mut(input_glwe.polynomial_size().get()) { // We reverse the polynomial lwe_mask_poly.reverse(); @@ -183,7 +183,7 @@ pub fn extract_lwe_sample_from_glwe_ciphertext( /// // computations /// // Define parameters for GlweCiphertext creation /// let glwe_size = GlweSize(2); -/// let polynomial_size = PolynomialSize(1024); +/// let polynomial_size = PolynomialSize::new(1024); /// let glwe_noise_distribution = /// Gaussian::from_dispersion_parameter(StandardDev(0.00000000000000029403601535432533), 0.0); /// let ciphertext_modulus = CiphertextModulus::new_native(); @@ -206,7 +206,7 @@ pub fn extract_lwe_sample_from_glwe_ciphertext( /// // Create the plaintext /// let msg = 3u64; /// let encoded_msg = msg << 60; -/// let plaintext_list = PlaintextList::new(encoded_msg, PlaintextCount(polynomial_size.0)); +/// let plaintext_list = PlaintextList::new(encoded_msg, PlaintextCount(polynomial_size.get())); /// /// // Create a new GlweCiphertext /// let mut glwe = GlweCiphertext::new(0u64, glwe_size, polynomial_size, ciphertext_modulus); @@ -225,7 +225,7 @@ pub fn extract_lwe_sample_from_glwe_ciphertext( /// let mut extracted_samples = LweCiphertextList::new( /// 0u64, /// equivalent_lwe_sk.lwe_dimension().to_lwe_size(), -/// LweCiphertextCount(glwe.polynomial_size().0), +/// LweCiphertextCount(glwe.polynomial_size().get()), /// ciphertext_modulus, /// ); /// @@ -290,7 +290,7 @@ pub fn par_extract_lwe_sample_from_glwe_ciphertext( /// // Define the parameters for a 4 bits message able to hold the doubled 2 bits message /// let small_lwe_dimension = LweDimension(742); /// let glwe_dimension = GlweDimension(1); -/// let polynomial_size = PolynomialSize(2048); +/// let polynomial_size = PolynomialSize::new(2048); /// let lwe_noise_distribution = /// Gaussian::from_dispersion_parameter(StandardDev(0.000007069849454709433), 0.0); /// let glwe_noise_distribution = diff --git a/tfhe/src/core_crypto/algorithms/lwe_packing_keyswitch.rs b/tfhe/src/core_crypto/algorithms/lwe_packing_keyswitch.rs index 01987f5086..2775739c4e 100644 --- a/tfhe/src/core_crypto/algorithms/lwe_packing_keyswitch.rs +++ b/tfhe/src/core_crypto/algorithms/lwe_packing_keyswitch.rs @@ -25,7 +25,7 @@ use rayon::prelude::*; /// let glwe_noise_distribution = /// Gaussian::from_dispersion_parameter(StandardDev(0.00000000000000029403601535432533), 0.0); /// let output_glwe_dimension = GlweDimension(1); -/// let output_polynomial_size = PolynomialSize(2048); +/// let output_polynomial_size = PolynomialSize::new(2048); /// let decomp_base_log = DecompositionBaseLog(23); /// let decomp_level_count = DecompositionLevelCount(1); /// let ciphertext_modulus = CiphertextModulus::new_native(); @@ -80,7 +80,7 @@ use rayon::prelude::*; /// keyswitch_lwe_ciphertext_into_glwe_ciphertext(&pksk, &input_lwe, &mut output_glwe); /// /// let mut decrypted_plaintext_list = -/// PlaintextList::new(0u64, PlaintextCount(output_glwe.polynomial_size().0)); +/// PlaintextList::new(0u64, PlaintextCount(output_glwe.polynomial_size().get())); /// /// decrypt_glwe_ciphertext( /// &output_glwe_secret_key, @@ -203,7 +203,7 @@ pub fn keyswitch_lwe_ciphertext_into_glwe_ciphertext::new( @@ -332,7 +332,7 @@ pub fn generate_seeded_lwe_packing_keyswitch_key< for (level, mut messages) in (1..=decomp_level_count.0) .rev() .map(DecompositionLevel) - .zip(decomposition_plaintexts_buffer.chunks_exact_mut(polynomial_size.0)) + .zip(decomposition_plaintexts_buffer.chunks_exact_mut(polynomial_size.get())) { // Here we take the decomposition term from the native torus, bring it to the torus we // are working with by dividing by the scaling factor and the encryption will take care diff --git a/tfhe/src/core_crypto/algorithms/lwe_private_functional_packing_keyswitch_key_generation.rs b/tfhe/src/core_crypto/algorithms/lwe_private_functional_packing_keyswitch_key_generation.rs index 9098c689f0..0cff038511 100644 --- a/tfhe/src/core_crypto/algorithms/lwe_private_functional_packing_keyswitch_key_generation.rs +++ b/tfhe/src/core_crypto/algorithms/lwe_private_functional_packing_keyswitch_key_generation.rs @@ -74,7 +74,7 @@ pub fn generate_lwe_private_functional_packing_keyswitch_key< let mut messages = PlaintextListOwned::new( Scalar::ZERO, PlaintextCount( - lwe_pfpksk.decomposition_level_count().0 * lwe_pfpksk.output_polynomial_size().0, + lwe_pfpksk.decomposition_level_count().0 * lwe_pfpksk.output_polynomial_size().get(), ), ); @@ -105,7 +105,7 @@ pub fn generate_lwe_private_functional_packing_keyswitch_key< // We fill the buffer with the powers of the key bits for (level, mut message) in (1..=decomp_level_count.0) .map(DecompositionLevel) - .zip(messages.chunks_exact_mut(polynomial_size.0)) + .zip(messages.chunks_exact_mut(polynomial_size.get())) { slice_wrapping_add_scalar_mul_assign( message.as_mut(), @@ -204,7 +204,7 @@ pub fn par_generate_lwe_private_functional_packing_keyswitch_key< .unwrap(); let plaintext_count = PlaintextCount( - lwe_pfpksk.decomposition_level_count().0 * lwe_pfpksk.output_polynomial_size().0, + lwe_pfpksk.decomposition_level_count().0 * lwe_pfpksk.output_polynomial_size().get(), ); // loop over the before key blocks @@ -219,7 +219,7 @@ pub fn par_generate_lwe_private_functional_packing_keyswitch_key< // We fill the buffer with the powers of the key bits for (level, mut message) in (1..=decomp_level_count.0) .map(DecompositionLevel) - .zip(messages.chunks_exact_mut(polynomial_size.0)) + .zip(messages.chunks_exact_mut(polynomial_size.get())) { slice_wrapping_add_scalar_mul_assign( message.as_mut(), @@ -260,7 +260,7 @@ mod test { // correct computations let glwe_dimension = GlweDimension(crate::core_crypto::commons::test_tools::random_usize_between(5..10)); - let polynomial_size = PolynomialSize( + let polynomial_size = PolynomialSize::new( crate::core_crypto::commons::test_tools::random_usize_between(5..10), ); let pfpksk_level_count = DecompositionLevelCount( diff --git a/tfhe/src/core_crypto/algorithms/lwe_programmable_bootstrapping/fft128.rs b/tfhe/src/core_crypto/algorithms/lwe_programmable_bootstrapping/fft128.rs index 8fbf7ad590..8b2a9e1068 100644 --- a/tfhe/src/core_crypto/algorithms/lwe_programmable_bootstrapping/fft128.rs +++ b/tfhe/src/core_crypto/algorithms/lwe_programmable_bootstrapping/fft128.rs @@ -29,7 +29,7 @@ use dyn_stack::{PodStack, SizeOverflow, StackReq}; /// // Define the parameters for a 4 bits message able to hold the doubled 2 bits message /// let small_lwe_dimension = LweDimension(742); /// let glwe_dimension = GlweDimension(1); -/// let polynomial_size = PolynomialSize(2048); +/// let polynomial_size = PolynomialSize::new(2048); /// let lwe_noise_distribution = Gaussian::from_dispersion_parameter( /// StandardDev(0.000007069849454709433 * 0.000007069849454709433), /// 0.0, diff --git a/tfhe/src/core_crypto/algorithms/lwe_programmable_bootstrapping/fft64.rs b/tfhe/src/core_crypto/algorithms/lwe_programmable_bootstrapping/fft64.rs index da5f449f42..25fc09a5f1 100644 --- a/tfhe/src/core_crypto/algorithms/lwe_programmable_bootstrapping/fft64.rs +++ b/tfhe/src/core_crypto/algorithms/lwe_programmable_bootstrapping/fft64.rs @@ -38,7 +38,7 @@ use dyn_stack::{PodStack, SizeOverflow, StackReq}; /// // Define the parameters for a 4 bits message able to hold the doubled 2 bits message /// let small_lwe_dimension = LweDimension(742); /// let glwe_dimension = GlweDimension(1); -/// let polynomial_size = PolynomialSize(2048); +/// let polynomial_size = PolynomialSize::new(2048); /// let lwe_noise_distribution = /// Gaussian::from_dispersion_parameter(StandardDev(0.000007069849454709433), 0.0); /// let glwe_noise_distribution = @@ -331,7 +331,7 @@ pub fn add_external_product_assign( /// // computations /// // Define parameters for GgswCiphertext creation /// let glwe_size = GlweSize(2); -/// let polynomial_size = PolynomialSize(2048); +/// let polynomial_size = PolynomialSize::new(2048); /// let decomp_base_log = DecompositionBaseLog(23); /// let decomp_level_count = DecompositionLevelCount(1); /// let glwe_noise_distribution = @@ -634,8 +634,8 @@ pub fn cmux_assign( /// let ct0_plaintext = Plaintext(1 << 60); /// let ct1_plaintext = Plaintext(3 << 60); /// -/// let ct0_plaintexts = PlaintextList::new(ct0_plaintext.0, PlaintextCount(polynomial_size.0)); -/// let ct1_plaintexts = PlaintextList::new(ct1_plaintext.0, PlaintextCount(polynomial_size.0)); +/// let ct0_plaintexts = PlaintextList::new(ct0_plaintext.0, PlaintextCount(polynomial_size.get())); +/// let ct1_plaintexts = PlaintextList::new(ct1_plaintext.0, PlaintextCount(polynomial_size.get())); /// /// let mut ct0 = GlweCiphertext::new(0u64, glwe_size, polynomial_size, ciphertext_modulus); /// let mut ct1 = GlweCiphertext::new(0u64, glwe_size, polynomial_size, ciphertext_modulus); @@ -807,7 +807,7 @@ pub fn cmux_assign_mem_optimized_requirement( /// // Define the parameters for a 4 bits message able to hold the doubled 2 bits message /// let small_lwe_dimension = LweDimension(742); /// let glwe_dimension = GlweDimension(1); -/// let polynomial_size = PolynomialSize(2048); +/// let polynomial_size = PolynomialSize::new(2048); /// let lwe_noise_distribution = /// Gaussian::from_dispersion_parameter(StandardDev(0.000007069849454709433), 0.0); /// let glwe_noise_distribution = diff --git a/tfhe/src/core_crypto/algorithms/lwe_programmable_bootstrapping/ntt64.rs b/tfhe/src/core_crypto/algorithms/lwe_programmable_bootstrapping/ntt64.rs index 3901282d14..d53964e02e 100644 --- a/tfhe/src/core_crypto/algorithms/lwe_programmable_bootstrapping/ntt64.rs +++ b/tfhe/src/core_crypto/algorithms/lwe_programmable_bootstrapping/ntt64.rs @@ -40,7 +40,7 @@ use dyn_stack::{PodStack, ReborrowMut, SizeOverflow, StackReq}; /// // Define the parameters for a 4 bits message able to hold the doubled 2 bits message /// let small_lwe_dimension = LweDimension(742); /// let glwe_dimension = GlweDimension(1); -/// let polynomial_size = PolynomialSize(2048); +/// let polynomial_size = PolynomialSize::new(2048); /// let lwe_noise_distribution = /// Gaussian::from_dispersion_parameter(StandardDev(0.000007069849454709433), 0.0); /// let glwe_noise_distribution = @@ -296,7 +296,7 @@ pub fn blind_rotate_ntt64_assign_mem_optimized( /// // Define the parameters for a 4 bits message able to hold the doubled 2 bits message /// let small_lwe_dimension = LweDimension(742); /// let glwe_dimension = GlweDimension(1); -/// let polynomial_size = PolynomialSize(2048); +/// let polynomial_size = PolynomialSize::new(2048); /// let lwe_noise_distribution = /// Gaussian::from_dispersion_parameter(StandardDev(0.000007069849454709433), 0.0); /// let glwe_noise_distribution = @@ -556,7 +556,7 @@ pub(crate) fn add_external_product_ntt64_assign( debug_assert_eq!(ggsw.glwe_size(), out.glwe_size()); let align = CACHELINE_ALIGN; - let poly_size = ggsw.polynomial_size().0; + let poly_size = ggsw.polynomial_size().get(); // we round the input mask and body let decomposer = SignedDecomposerNonNative::::new( @@ -695,11 +695,11 @@ pub(crate) fn ntt64_add_external_product_assign_scratch( ) -> Result { let align = CACHELINE_ALIGN; let standard_scratch = - StackReq::try_new_aligned::(glwe_size.0 * polynomial_size.0, align)?; + StackReq::try_new_aligned::(glwe_size.0 * polynomial_size.get(), align)?; let decomp_sign_scratch = - StackReq::try_new_aligned::(glwe_size.0 * polynomial_size.0, align)?; - let ntt_scratch = StackReq::try_new_aligned::(glwe_size.0 * polynomial_size.0, align)?; - let ntt_scratch_single = StackReq::try_new_aligned::(polynomial_size.0, align)?; + StackReq::try_new_aligned::(glwe_size.0 * polynomial_size.get(), align)?; + let ntt_scratch = StackReq::try_new_aligned::(glwe_size.0 * polynomial_size.get(), align)?; + let ntt_scratch_single = StackReq::try_new_aligned::(polynomial_size.get(), align)?; let _ = &ntt; let substack2 = ntt_scratch_single; @@ -725,7 +725,7 @@ pub fn blind_rotate_ntt64_assign_mem_optimized_requirement( polynomial_size: PolynomialSize, ntt: Ntt64View<'_>, ) -> Result { - StackReq::try_new_aligned::(glwe_size.0 * polynomial_size.0, CACHELINE_ALIGN)? + StackReq::try_new_aligned::(glwe_size.0 * polynomial_size.get(), CACHELINE_ALIGN)? .try_and(ntt64_cmux_scratch(glwe_size, polynomial_size, ntt)?) } @@ -736,6 +736,6 @@ pub fn programmable_bootstrap_ntt64_lwe_ciphertext_mem_optimized_requirement( ntt: Ntt64View<'_>, ) -> Result { blind_rotate_ntt64_assign_mem_optimized_requirement(glwe_size, polynomial_size, ntt)?.try_and( - StackReq::try_new_aligned::(glwe_size.0 * polynomial_size.0, CACHELINE_ALIGN)?, + StackReq::try_new_aligned::(glwe_size.0 * polynomial_size.get(), CACHELINE_ALIGN)?, ) } diff --git a/tfhe/src/core_crypto/algorithms/lwe_wopbs.rs b/tfhe/src/core_crypto/algorithms/lwe_wopbs.rs index b7f8c2132e..540bac1809 100644 --- a/tfhe/src/core_crypto/algorithms/lwe_wopbs.rs +++ b/tfhe/src/core_crypto/algorithms/lwe_wopbs.rs @@ -423,7 +423,7 @@ pub fn extract_bits_from_lwe_ciphertext_mem_optimized_requirement( /// /// // DISCLAIMER: these toy example parameters are not guaranteed to be secure or yield correct /// // computations -/// let polynomial_size = PolynomialSize(1024); +/// let polynomial_size = PolynomialSize::new(1024); /// let glwe_dimension = GlweDimension(1); /// let lwe_dimension = LweDimension(481); /// let ciphertext_modulus = CiphertextModulus::new_native(); diff --git a/tfhe/src/core_crypto/algorithms/polynomial_algorithms.rs b/tfhe/src/core_crypto/algorithms/polynomial_algorithms.rs index 43e4c39304..9959f18358 100644 --- a/tfhe/src/core_crypto/algorithms/polynomial_algorithms.rs +++ b/tfhe/src/core_crypto/algorithms/polynomial_algorithms.rs @@ -109,9 +109,11 @@ pub fn polynomial_wrapping_sub_assign_custom_mod( /// use tfhe::core_crypto::algorithms::polynomial_algorithms::*; /// use tfhe::core_crypto::commons::parameters::*; /// use tfhe::core_crypto::entities::*; -/// let poly_list = PolynomialList::from_container(vec![100_u8, 20, 3, 4, 5, 6], PolynomialSize(3)); -/// let bin_poly_list = PolynomialList::from_container(vec![0, 1, 1, 1, 0, 0], PolynomialSize(3)); -/// let mut output = Polynomial::new(250, PolynomialSize(3)); +/// let poly_list = +/// PolynomialList::from_container(vec![100_u8, 20, 3, 4, 5, 6], PolynomialSize::new(3)); +/// let bin_poly_list = +/// PolynomialList::from_container(vec![0, 1, 1, 1, 0, 0], PolynomialSize::new(3)); +/// let mut output = Polynomial::new(250, PolynomialSize::new(3)); /// polynomial_wrapping_add_multisum_assign(&mut output, &poly_list, &bin_poly_list); /// assert_eq!(output.as_ref(), &[231, 96, 120]); /// ``` @@ -178,7 +180,7 @@ fn polynomial_wrapping_add_mul_schoolbook_assign KARATUSBA_STOP { + if polynomial_size.get().is_power_of_two() && polynomial_size.get() > KARATUSBA_STOP { let mut tmp = Polynomial::new(Scalar::ZERO, polynomial_size); polynomial_karatsuba_wrapping_mul(&mut tmp, lhs, rhs); @@ -324,7 +326,7 @@ pub fn polynomial_wrapping_add_mul_assign_custom_mod KARATUSBA_STOP { + if polynomial_size.get().is_power_of_two() && polynomial_size.get() > KARATUSBA_STOP { let mut tmp = Polynomial::new(Scalar::ZERO, polynomial_size); polynomial_karatsuba_wrapping_mul_custom_mod(&mut tmp, lhs, rhs, custom_modulus); @@ -513,7 +515,7 @@ pub fn polynomial_wrapping_monic_monomial_div( input.polynomial_size(), ); - let polynomial_size = output.polynomial_size().0; + let polynomial_size = output.polynomial_size().get(); let remaining_degree = monomial_degree.0 % polynomial_size; let full_cycles_count = monomial_degree.0 / polynomial_size; @@ -573,7 +575,7 @@ pub fn polynomial_wrapping_monic_monomial_mul( input.polynomial_size(), ); - let polynomial_size = output.polynomial_size().0; + let polynomial_size = output.polynomial_size().get(); let remaining_degree = monomial_degree.0 % polynomial_size; let full_cycles_count = monomial_degree.0 / polynomial_size; @@ -645,7 +647,7 @@ pub(crate) fn polynomial_wrapping_monic_monomial_mul_and_subtract KARATUSBA_STOP { + if polynomial_size.get().is_power_of_two() && polynomial_size.get() > KARATUSBA_STOP { let mut tmp = Polynomial::new(Scalar::ZERO, polynomial_size); polynomial_karatsuba_wrapping_mul(&mut tmp, lhs, rhs); @@ -909,7 +913,7 @@ pub fn polynomial_wrapping_sub_mul_assign_custom_mod KARATUSBA_STOP { + if polynomial_size.get().is_power_of_two() && polynomial_size.get() > KARATUSBA_STOP { let mut tmp = Polynomial::new(Scalar::ZERO, polynomial_size); polynomial_karatsuba_wrapping_mul_custom_mod(&mut tmp, lhs, rhs, custom_modulus); @@ -935,7 +939,7 @@ pub fn polynomial_wrapping_sub_mul_assign_custom_mod( /// use tfhe::core_crypto::entities::*; /// let lhs = Polynomial::from_container(vec![1_u32; 128]); /// let rhs = Polynomial::from_container(vec![2_u32; 128]); -/// let mut res_kara = Polynomial::new(0u32, PolynomialSize(128)); -/// let mut res_mul = Polynomial::new(0u32, PolynomialSize(128)); +/// let mut res_kara = Polynomial::new(0u32, PolynomialSize::new(128)); +/// let mut res_mul = Polynomial::new(0u32, PolynomialSize::new(128)); /// polynomial_karatsuba_wrapping_mul(&mut res_kara, &lhs, &rhs); /// polynomial_wrapping_mul(&mut res_mul, &lhs, &rhs); /// assert_eq!(res_kara, res_mul); @@ -999,7 +1003,7 @@ pub fn polynomial_karatsuba_wrapping_mul( q.polynomial_size(), ); - let poly_size = output.polynomial_size().0; + let poly_size = output.polynomial_size().get(); // check dimensions are a power of 2 assert!(poly_size.is_power_of_two()); @@ -1102,7 +1106,7 @@ pub fn polynomial_karatsuba_wrapping_mul_custom_mod() % 7) + 6; - let polynomial_size = PolynomialSize(1 << polynomial_log); + let polynomial_size = PolynomialSize::new(1 << polynomial_log); let mut generator = new_random_generator(); // generate two random Torus polynomials @@ -1340,7 +1344,7 @@ mod test { fn test_add_mul() { for polynomial_log in 4..=12 { for _ in 0..10 { - let polynomial_size = PolynomialSize(1 << polynomial_log); + let polynomial_size = PolynomialSize::new(1 << polynomial_log); let mut generator = new_random_generator(); // generate two random Torus polynomials @@ -1373,7 +1377,7 @@ mod test { fn test_sub_mul() { for polynomial_log in 4..=12 { for _ in 0..10 { - let polynomial_size = PolynomialSize(1 << polynomial_log); + let polynomial_size = PolynomialSize::new(1 << polynomial_log); let mut generator = new_random_generator(); // generate two random Torus polynomials diff --git a/tfhe/src/core_crypto/algorithms/test/ggsw_encryption.rs b/tfhe/src/core_crypto/algorithms/test/ggsw_encryption.rs index cf659da4b3..b4b3e2cade 100644 --- a/tfhe/src/core_crypto/algorithms/test/ggsw_encryption.rs +++ b/tfhe/src/core_crypto/algorithms/test/ggsw_encryption.rs @@ -17,7 +17,7 @@ fn test_parallel_and_seeded_ggsw_encryption_equivalence( // computations // Define parameters for GgswCiphertext creation let glwe_size = GlweSize(2); - let polynomial_size = PolynomialSize(1024); + let polynomial_size = PolynomialSize::new(1024); let decomp_base_log = DecompositionBaseLog(8); let decomp_level_count = DecompositionLevelCount(3); let glwe_noise_distribution = DynamicDistribution::new_gaussian_from_std_dev(StandardDev( diff --git a/tfhe/src/core_crypto/algorithms/test/lwe_bootstrap_key_generation.rs b/tfhe/src/core_crypto/algorithms/test/lwe_bootstrap_key_generation.rs index dcf31e34b8..4a6da67ff0 100644 --- a/tfhe/src/core_crypto/algorithms/test/lwe_bootstrap_key_generation.rs +++ b/tfhe/src/core_crypto/algorithms/test/lwe_bootstrap_key_generation.rs @@ -26,7 +26,7 @@ fn test_parallel_and_seeded_bsk_gen_equivalence( let glwe_dim = GlweDimension(crate::core_crypto::commons::test_tools::random_usize_between(5..10)); let poly_size = - PolynomialSize(crate::core_crypto::commons::test_tools::random_usize_between(5..10)); + PolynomialSize::new(crate::core_crypto::commons::test_tools::random_usize_between(5..10)); let level = DecompositionLevelCount( crate::core_crypto::commons::test_tools::random_usize_between(2..5), ); diff --git a/tfhe/src/core_crypto/algorithms/test/lwe_multi_bit_bootstrap_key_generation.rs b/tfhe/src/core_crypto/algorithms/test/lwe_multi_bit_bootstrap_key_generation.rs index 85d052a4c9..ac8a299e3c 100644 --- a/tfhe/src/core_crypto/algorithms/test/lwe_multi_bit_bootstrap_key_generation.rs +++ b/tfhe/src/core_crypto/algorithms/test/lwe_multi_bit_bootstrap_key_generation.rs @@ -29,7 +29,7 @@ fn test_parallel_and_seeded_multi_bit_bsk_gen_equivalence< let glwe_dim = GlweDimension(crate::core_crypto::commons::test_tools::random_usize_between(5..10)); let poly_size = - PolynomialSize(crate::core_crypto::commons::test_tools::random_usize_between(5..10)); + PolynomialSize::new(crate::core_crypto::commons::test_tools::random_usize_between(5..10)); let level = DecompositionLevelCount( crate::core_crypto::commons::test_tools::random_usize_between(2..5), ); diff --git a/tfhe/src/core_crypto/algorithms/test/lwe_packing_keyswitch_key_generation.rs b/tfhe/src/core_crypto/algorithms/test/lwe_packing_keyswitch_key_generation.rs index edc62ae884..f2cf610f14 100644 --- a/tfhe/src/core_crypto/algorithms/test/lwe_packing_keyswitch_key_generation.rs +++ b/tfhe/src/core_crypto/algorithms/test/lwe_packing_keyswitch_key_generation.rs @@ -14,7 +14,7 @@ fn test_seeded_lwe_pksk_gen_equivalence( // Define parameters for LweKeyswitchKey creation let input_lwe_dimension = LweDimension(742); let output_glwe_dimension = GlweDimension(1); - let output_polynomial_size = PolynomialSize(2048); + let output_polynomial_size = PolynomialSize::new(2048); let glwe_noise_distribution = DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 0.00000000000000029403601535432533, )); diff --git a/tfhe/src/core_crypto/algorithms/test/lwe_private_functional_packing_keyswitch.rs b/tfhe/src/core_crypto/algorithms/test/lwe_private_functional_packing_keyswitch.rs index d8f6b5af7c..b00cbf8282 100644 --- a/tfhe/src/core_crypto/algorithms/test/lwe_private_functional_packing_keyswitch.rs +++ b/tfhe/src/core_crypto/algorithms/test/lwe_private_functional_packing_keyswitch.rs @@ -16,7 +16,7 @@ fn test_parallel_pfpks_equivalence( let input_key_lwe_dimension = LweDimension(769); let output_glwe_dimension = GlweDimension(1); let output_glwe_size = output_glwe_dimension.to_glwe_size(); - let output_polynomial_size = PolynomialSize(2048); + let output_polynomial_size = PolynomialSize::new(2048); // ~ 2^-20 let noise_distribution = DynamicDistribution::new_gaussian_from_std_dev(StandardDev(0.0000006791658447437413)); @@ -111,7 +111,7 @@ fn test_parallel_pfpks_equivalence( let output_glwe_dimension = GlweDimension(crate::core_crypto::commons::test_tools::random_usize_between(5..10)); let output_glwe_size = output_glwe_dimension.to_glwe_size(); - let output_polynomial_size = PolynomialSize( + let output_polynomial_size = PolynomialSize::new( crate::core_crypto::commons::test_tools::random_usize_between(5..10), ); // ~ 2^-20 @@ -218,7 +218,7 @@ fn test_parallel_pfpks_lwe_list_equivalence let input_key_lwe_dimension = LweDimension(769); let output_glwe_dimension = GlweDimension(1); let output_glwe_size = output_glwe_dimension.to_glwe_size(); - let output_polynomial_size = PolynomialSize(2048); + let output_polynomial_size = PolynomialSize::new(2048); // ~ 2^-20 let noise_distribution = DynamicDistribution::new_gaussian_from_std_dev(StandardDev(0.0000006791658447437413)); @@ -316,7 +316,7 @@ fn test_parallel_pfpks_lwe_list_equivalence let output_glwe_dimension = GlweDimension(crate::core_crypto::commons::test_tools::random_usize_between(5..10)); let output_glwe_size = output_glwe_dimension.to_glwe_size(); - let output_polynomial_size = PolynomialSize( + let output_polynomial_size = PolynomialSize::new( crate::core_crypto::commons::test_tools::random_usize_between(5..10), ); // ~ 2^-20 @@ -365,7 +365,7 @@ fn test_parallel_pfpks_lwe_list_equivalence let mut lwe_list = LweCiphertextList::new( Scalar::ZERO, input_key_lwe_dimension.to_lwe_size(), - LweCiphertextCount(output_polynomial_size.0), + LweCiphertextCount(output_polynomial_size.get()), ciphertext_modulus, ); rsc.encryption_random_generator diff --git a/tfhe/src/core_crypto/algorithms/test/lwe_programmable_bootstrapping.rs b/tfhe/src/core_crypto/algorithms/test/lwe_programmable_bootstrapping.rs index c26e54b18d..f89e07d088 100644 --- a/tfhe/src/core_crypto/algorithms/test/lwe_programmable_bootstrapping.rs +++ b/tfhe/src/core_crypto/algorithms/test/lwe_programmable_bootstrapping.rs @@ -176,7 +176,7 @@ fn generate_accumulator_many_lut>( // N/(p/2) = size of each block, to correct noise from the input we introduce the // notion of box, which manages redundancy to yield a denoised value // for several noisy values around a true input value. - let box_size = polynomial_size.0 / message_modulus; + let box_size = polynomial_size.get() / message_modulus; let fn_count = funcs.len(); let fn_count = if fn_count.is_power_of_two() { @@ -187,10 +187,10 @@ fn generate_accumulator_many_lut>( assert!(fn_count <= (message_modulus / 2)); - let func_chunk_size = polynomial_size.0 / fn_count; + let func_chunk_size = polynomial_size.get() / fn_count; // Create the accumulator - let mut accumulator_scalar = vec![Scalar::ZERO; polynomial_size.0]; + let mut accumulator_scalar = vec![Scalar::ZERO; polynomial_size.get()]; let func_chunks = accumulator_scalar.chunks_exact_mut(func_chunk_size); @@ -376,7 +376,7 @@ create_parametrized_test!(lwe_encrypt_pbs_many_lut_decrypt_custom_mod); pub const TEST_PARAMS_4_BITS_NATIVE_U128: ClassicTestParams = ClassicTestParams { lwe_dimension: LweDimension(742), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(2048), + polynomial_size: PolynomialSize::new(2048), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 4.9982771e-11, )), @@ -401,7 +401,7 @@ pub const TEST_PARAMS_4_BITS_NATIVE_U128: ClassicTestParams = ClassicTestP pub const TEST_PARAMS_3_BITS_127_U128: ClassicTestParams = ClassicTestParams { lwe_dimension: LweDimension(742), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(2048), + polynomial_size: PolynomialSize::new(2048), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 4.9982771e-11, )), diff --git a/tfhe/src/core_crypto/algorithms/test/mod.rs b/tfhe/src/core_crypto/algorithms/test/mod.rs index 0650f30860..9f8997d1b0 100644 --- a/tfhe/src/core_crypto/algorithms/test/mod.rs +++ b/tfhe/src/core_crypto/algorithms/test/mod.rs @@ -56,7 +56,7 @@ impl Default for TestResources { pub const TEST_PARAMS_4_BITS_NATIVE_U64: ClassicTestParams = ClassicTestParams { lwe_dimension: LweDimension(742), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(2048), + polynomial_size: PolynomialSize::new(2048), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 0.000007069849454709433, )), @@ -81,7 +81,7 @@ pub const TEST_PARAMS_4_BITS_NATIVE_U64: ClassicTestParams = ClassicTestPar pub const TEST_PARAMS_3_BITS_63_U64: ClassicTestParams = ClassicTestParams { lwe_dimension: LweDimension(742), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(2048), + polynomial_size: PolynomialSize::new(2048), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 0.000007069849454709433, )), @@ -106,7 +106,7 @@ pub const TEST_PARAMS_3_BITS_63_U64: ClassicTestParams = ClassicTestParams pub const TEST_PARAMS_3_BITS_SOLINAS_U64: ClassicTestParams = ClassicTestParams { lwe_dimension: LweDimension(742), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(2048), + polynomial_size: PolynomialSize::new(2048), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 0.000007069849454709433, )), @@ -131,7 +131,7 @@ pub const TEST_PARAMS_3_BITS_SOLINAS_U64: ClassicTestParams = ClassicTestPa pub const DUMMY_NATIVE_U32: ClassicTestParams = ClassicTestParams { lwe_dimension: LweDimension(742), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(2048), + polynomial_size: PolynomialSize::new(2048), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 0.000007069849454709433, )), @@ -156,7 +156,7 @@ pub const DUMMY_NATIVE_U32: ClassicTestParams = ClassicTestParams { pub const DUMMY_31_U32: ClassicTestParams = ClassicTestParams { lwe_dimension: LweDimension(742), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(2048), + polynomial_size: PolynomialSize::new(2048), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 0.000007069849454709433, )), @@ -186,7 +186,7 @@ pub const MULTI_BIT_2_2_2_PARAMS: MultiBitTestParams = MultiBitTestParams { decomp_base_log: DecompositionBaseLog(22), decomp_level_count: DecompositionLevelCount(1), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(2048), + polynomial_size: PolynomialSize::new(2048), glwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 0.0000000000000003152931493498455, )), @@ -204,7 +204,7 @@ pub const MULTI_BIT_3_3_2_PARAMS: MultiBitTestParams = MultiBitTestParams { decomp_base_log: DecompositionBaseLog(14), decomp_level_count: DecompositionLevelCount(2), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(8192), + polynomial_size: PolynomialSize::new(8192), glwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 0.0000000000000000002168404344971009, )), @@ -222,7 +222,7 @@ pub const MULTI_BIT_2_2_2_CUSTOM_MOD_PARAMS: MultiBitTestParams = MultiBitT decomp_base_log: DecompositionBaseLog(22), decomp_level_count: DecompositionLevelCount(1), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(2048), + polynomial_size: PolynomialSize::new(2048), glwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 0.0000000000000003152931493498455, )), @@ -240,7 +240,7 @@ pub const MULTI_BIT_2_2_3_PARAMS: MultiBitTestParams = MultiBitTestParams { decomp_base_log: DecompositionBaseLog(21), decomp_level_count: DecompositionLevelCount(1), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(2048), + polynomial_size: PolynomialSize::new(2048), glwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 0.0000000000000003152931493498455, )), @@ -258,7 +258,7 @@ pub const MULTI_BIT_3_3_3_PARAMS: MultiBitTestParams = MultiBitTestParams { decomp_base_log: DecompositionBaseLog(14), decomp_level_count: DecompositionLevelCount(2), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(8192), + polynomial_size: PolynomialSize::new(8192), glwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 0.0000000000000000002168404344971009, )), @@ -276,7 +276,7 @@ pub const MULTI_BIT_2_2_3_CUSTOM_MOD_PARAMS: MultiBitTestParams = MultiBitT decomp_base_log: DecompositionBaseLog(21), decomp_level_count: DecompositionLevelCount(1), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(2048), + polynomial_size: PolynomialSize::new(2048), glwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 0.0000000000000003152931493498455, )), @@ -292,7 +292,7 @@ pub const MULTI_BIT_2_2_3_CUSTOM_MOD_PARAMS: MultiBitTestParams = MultiBitT pub const FFT_U32_PARAMS: FftTestParams = FftTestParams { lwe_dimension: LweDimension(742), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(2048), + polynomial_size: PolynomialSize::new(2048), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 0.00000000004998277131225527, )), @@ -307,7 +307,7 @@ pub const FFT_U32_PARAMS: FftTestParams = FftTestParams { pub const FFT_U64_PARAMS: FftTestParams = FftTestParams { lwe_dimension: LweDimension(742), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(2048), + polynomial_size: PolynomialSize::new(2048), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 0.00000000004998277131225527, )), @@ -322,7 +322,7 @@ pub const FFT_U64_PARAMS: FftTestParams = FftTestParams { pub const FFT_U128_PARAMS: FftTestParams = FftTestParams { lwe_dimension: LweDimension(742), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(2048), + polynomial_size: PolynomialSize::new(2048), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 0.00000000004998277131225527, )), @@ -337,7 +337,7 @@ pub const FFT_U128_PARAMS: FftTestParams = FftTestParams { pub const FFT128_U128_PARAMS: FftTestParams = FftTestParams { lwe_dimension: LweDimension(742), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(2048), + polynomial_size: PolynomialSize::new(2048), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev(0.12345)), glwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 0.00000000000000000000000000000008645717832544903, @@ -350,7 +350,7 @@ pub const FFT128_U128_PARAMS: FftTestParams = FftTestParams { pub const FFT_WOPBS_PARAMS: FftWopPbsTestParams = FftWopPbsTestParams { lwe_dimension: LweDimension(481), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(1024), + polynomial_size: PolynomialSize::new(1024), // Value was 0.000_000_000_000_000_221_486_881_160_055_68_513645324585951 // But rust indicates it gets truncated anyways to // 0.000_000_000_000_000_221_486_881_160_055_68 @@ -375,7 +375,7 @@ pub const FFT_WOPBS_PARAMS: FftWopPbsTestParams = FftWopPbsTestParams { pub const FFT_WOPBS_N512_PARAMS: FftWopPbsTestParams = FftWopPbsTestParams { lwe_dimension: LweDimension(4), glwe_dimension: GlweDimension(2), - polynomial_size: PolynomialSize(512), + polynomial_size: PolynomialSize::new(512), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 0.000_000_000_000_000_221_486_881_160_055_68, )), @@ -394,7 +394,7 @@ pub const FFT_WOPBS_N512_PARAMS: FftWopPbsTestParams = FftWopPbsTestParams pub const FFT_WOPBS_N1024_PARAMS: FftWopPbsTestParams = FftWopPbsTestParams { lwe_dimension: LweDimension(4), glwe_dimension: GlweDimension(2), - polynomial_size: PolynomialSize(1024), + polynomial_size: PolynomialSize::new(1024), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 0.000_000_000_000_000_221_486_881_160_055_68, )), @@ -413,7 +413,7 @@ pub const FFT_WOPBS_N1024_PARAMS: FftWopPbsTestParams = FftWopPbsTestParams pub const FFT_WOPBS_N2048_PARAMS: FftWopPbsTestParams = FftWopPbsTestParams { lwe_dimension: LweDimension(4), glwe_dimension: GlweDimension(2), - polynomial_size: PolynomialSize(2048), + polynomial_size: PolynomialSize::new(2048), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 0.000_000_000_000_000_221_486_881_160_055_68, )), diff --git a/tfhe/src/core_crypto/algorithms/test/noise_distribution/mod.rs b/tfhe/src/core_crypto/algorithms/test/noise_distribution/mod.rs index 16bdf52c73..e707505e24 100644 --- a/tfhe/src/core_crypto/algorithms/test/noise_distribution/mod.rs +++ b/tfhe/src/core_crypto/algorithms/test/noise_distribution/mod.rs @@ -9,7 +9,7 @@ pub const NOISE_TEST_PARAMS_4_BITS_NATIVE_U64_132_BITS_GAUSSIAN: ClassicTestPara ClassicTestParams { lwe_dimension: LweDimension(841), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(2048), + polynomial_size: PolynomialSize::new(2048), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 3.1496674685772435e-06, )), diff --git a/tfhe/src/core_crypto/commons/generators/encryption/test.rs b/tfhe/src/core_crypto/commons/generators/encryption/test.rs index 8a9307070c..c4cfe51b4e 100644 --- a/tfhe/src/core_crypto/commons/generators/encryption/test.rs +++ b/tfhe/src/core_crypto/commons/generators/encryption/test.rs @@ -22,7 +22,7 @@ fn test_gaussian_sampling_margin_factor_does_not_panic() { } let params = Params { glwe_size: GlweSize(2), - poly_size: PolynomialSize(1), + poly_size: PolynomialSize::new(1), dec_level_count: DecompositionLevelCount(1), dec_base_log: DecompositionBaseLog(4), lwe_dim: LweDimension(17000), diff --git a/tfhe/src/core_crypto/commons/math/ntt/ntt64.rs b/tfhe/src/core_crypto/commons/math/ntt/ntt64.rs index b2d53f5093..a0c671589d 100644 --- a/tfhe/src/core_crypto/commons/math/ntt/ntt64.rs +++ b/tfhe/src/core_crypto/commons/math/ntt/ntt64.rs @@ -36,7 +36,7 @@ impl Ntt64 { assert_eq!(modulus.kind(), CiphertextModulusKind::Other); - let n = size.0; + let n = size.get(); let modulus = modulus.get_custom_modulus() as u64; let get_plan = || { let plans = global_plans.read().unwrap(); @@ -69,7 +69,7 @@ impl Ntt64 { impl Ntt64View<'_> { pub fn polynomial_size(self) -> PolynomialSize { - PolynomialSize(self.plan.ntt_size()) + PolynomialSize::new(self.plan.ntt_size()) } pub fn custom_modulus(self) -> u64 { diff --git a/tfhe/src/core_crypto/commons/mod.rs b/tfhe/src/core_crypto/commons/mod.rs index fd7057bea2..f1308f0219 100644 --- a/tfhe/src/core_crypto/commons/mod.rs +++ b/tfhe/src/core_crypto/commons/mod.rs @@ -211,7 +211,7 @@ pub mod test_tools { /// Return a random polynomial size in [2;max]. pub fn random_polynomial_size(max: usize) -> PolynomialSize { let max = std::cmp::max(3, max); - PolynomialSize(random_usize_between(2..max + 1)) + PolynomialSize::new(random_usize_between(2..max + 1)) } /// Return a random base log in [2;max]. diff --git a/tfhe/src/core_crypto/commons/parameters.rs b/tfhe/src/core_crypto/commons/parameters.rs index 6e648d234b..e1fe88ea99 100644 --- a/tfhe/src/core_crypto/commons/parameters.rs +++ b/tfhe/src/core_crypto/commons/parameters.rs @@ -133,9 +133,19 @@ impl GlweDimension { Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize, Versionize, )] #[versionize(PolynomialSizeVersions)] -pub struct PolynomialSize(pub usize); +pub struct PolynomialSize(usize); impl PolynomialSize { + pub const fn new(polynomial_size: usize) -> Self { + assert!(polynomial_size.is_power_of_two()); + + Self(polynomial_size) + } + + pub const fn get(&self) -> usize { + self.0 + } + /// Return the associated [`PolynomialSizeLog`]. pub fn log2(&self) -> PolynomialSizeLog { PolynomialSizeLog((self.0 as f64).log2().ceil() as usize) @@ -147,7 +157,7 @@ impl PolynomialSize { 0, "Cannot convert a PolynomialSize that is not a multiple of 2 to FourierPolynomialSize" ); - FourierPolynomialSize(self.0 / 2) + FourierPolynomialSize::new(self.0 / 2) } /// Inputs of a blind rotation are monomials which degree may be up to 2 * N because of the @@ -166,11 +176,21 @@ impl PolynomialSize { Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize, Versionize, )] #[versionize(FourierPolynomialSizeVersions)] -pub struct FourierPolynomialSize(pub usize); +pub struct FourierPolynomialSize(usize); impl FourierPolynomialSize { + pub const fn new(polynomial_size: usize) -> Self { + assert!(polynomial_size.is_power_of_two()); + + Self(polynomial_size) + } + + pub const fn get(&self) -> usize { + self.0 + } + pub fn to_standard_polynomial_size(&self) -> PolynomialSize { - PolynomialSize(self.0 * 2) + PolynomialSize::new(self.0 * 2) } } @@ -186,7 +206,7 @@ pub struct PolynomialSizeLog(pub usize); impl PolynomialSizeLog { /// Return the associated [`PolynomialSizeLog`]. pub fn to_polynomial_size(&self) -> PolynomialSize { - PolynomialSize(1 << self.0) + PolynomialSize::new(1 << self.0) } } diff --git a/tfhe/src/core_crypto/entities/compressed_modulus_switched_glwe_ciphertext.rs b/tfhe/src/core_crypto/entities/compressed_modulus_switched_glwe_ciphertext.rs index 963af08045..031a38f14c 100644 --- a/tfhe/src/core_crypto/entities/compressed_modulus_switched_glwe_ciphertext.rs +++ b/tfhe/src/core_crypto/entities/compressed_modulus_switched_glwe_ciphertext.rs @@ -20,7 +20,7 @@ use crate::core_crypto::prelude::*; /// let log_modulus = 12; /// /// let glwe_size = GlweSize(2); -/// let polynomial_size = PolynomialSize(1024); +/// let polynomial_size = PolynomialSize::new(1024); /// let glwe_noise_distribution = /// Gaussian::from_dispersion_parameter(StandardDev(0.00000000000000029403601535432533), 0.0); /// let ciphertext_modulus = CiphertextModulus::new_native(); @@ -41,7 +41,7 @@ use crate::core_crypto::prelude::*; /// /// let inputs = [1 << 57, 1 << 58]; /// -/// let mut plaintext_list = PlaintextList::new(0, PlaintextCount(polynomial_size.0)); +/// let mut plaintext_list = PlaintextList::new(0, PlaintextCount(polynomial_size.get())); /// /// plaintext_list.as_mut_view().into_container()[0..inputs.len()].copy_from_slice(&inputs); /// @@ -64,7 +64,7 @@ use crate::core_crypto::prelude::*; /// /// let glwe_ms_ed = compressed.extract(); /// -/// let mut output_list = PlaintextList::new(0, PlaintextCount(polynomial_size.0)); +/// let mut output_list = PlaintextList::new(0, PlaintextCount(polynomial_size.get())); /// /// decrypt_glwe_ciphertext(&glwe_secret_key, &glwe_ms_ed, &mut output_list); /// @@ -126,10 +126,10 @@ impl CompressedModulusSwitchedGlweCiphertext { let polynomial_size = ct.polynomial_size(); assert!( - bodies_count.0 <= polynomial_size.0, + bodies_count.0 <= polynomial_size.get(), "Number of stored bodies (asked {}) cannot be bigger than polynomial_size ={}", bodies_count.0, - polynomial_size.0, + polynomial_size.get(), ); assert!( @@ -140,7 +140,7 @@ impl CompressedModulusSwitchedGlweCiphertext { ); let modulus_switched: Vec<_> = ct.as_ref() - [0..glwe_dimension.0 * polynomial_size.0 + bodies_count.0] + [0..glwe_dimension.0 * polynomial_size.get() + bodies_count.0] .iter() .map(|a| modulus_switch(*a, log_modulus)) .collect(); @@ -163,7 +163,7 @@ impl CompressedModulusSwitchedGlweCiphertext { let log_modulus = self.packed_integers.log_modulus.0; let number_bits_to_unpack = - (self.glwe_dimension.0 * self.polynomial_size.0 + self.bodies_count.0) * log_modulus; + (self.glwe_dimension.0 * self.polynomial_size.get() + self.bodies_count.0) * log_modulus; let len: usize = number_bits_to_unpack.div_ceil(Scalar::BITS); @@ -179,7 +179,7 @@ impl CompressedModulusSwitchedGlweCiphertext { // Scaling .map(|a| a << (Scalar::BITS - log_modulus)) .chain( - std::iter::repeat(Scalar::ZERO).take(self.polynomial_size.0 - self.bodies_count.0), + std::iter::repeat(Scalar::ZERO).take(self.polynomial_size.get() - self.bodies_count.0), ) .collect(); @@ -210,7 +210,7 @@ impl ParameterSetConformant let log_modulus = packed_integers.log_modulus.0; let number_bits_to_unpack = - (glwe_dimension.0 * polynomial_size.0 + bodies_count.0) * log_modulus; + (glwe_dimension.0 * polynomial_size.get() + bodies_count.0) * log_modulus; let len = number_bits_to_unpack.div_ceil(Scalar::BITS); @@ -229,20 +229,20 @@ mod test { #[test] fn glwe_ms_compression_() { - glwe_ms_compression::(1, GlweDimension(1), PolynomialSize(512), 0); - glwe_ms_compression::(10, GlweDimension(1), PolynomialSize(512), 1); - glwe_ms_compression::(11, GlweDimension(1), PolynomialSize(512), 511); - glwe_ms_compression::(12, GlweDimension(1), PolynomialSize(512), 512); - - glwe_ms_compression::(1, GlweDimension(1), PolynomialSize(512), 100); - glwe_ms_compression::(10, GlweDimension(1), PolynomialSize(512), 512); - glwe_ms_compression::(11, GlweDimension(1), PolynomialSize(512), 512); - glwe_ms_compression::(12, GlweDimension(1), PolynomialSize(512), 512); - glwe_ms_compression::(33, GlweDimension(1), PolynomialSize(512), 512); - glwe_ms_compression::(53, GlweDimension(1), PolynomialSize(512), 512); - glwe_ms_compression::(63, GlweDimension(1), PolynomialSize(512), 512); - - glwe_ms_compression::(127, GlweDimension(1), PolynomialSize(512), 100); + glwe_ms_compression::(1, GlweDimension(1), PolynomialSize::new(512), 0); + glwe_ms_compression::(10, GlweDimension(1), PolynomialSize::new(512), 1); + glwe_ms_compression::(11, GlweDimension(1), PolynomialSize::new(512), 511); + glwe_ms_compression::(12, GlweDimension(1), PolynomialSize::new(512), 512); + + glwe_ms_compression::(1, GlweDimension(1), PolynomialSize::new(512), 100); + glwe_ms_compression::(10, GlweDimension(1), PolynomialSize::new(512), 512); + glwe_ms_compression::(11, GlweDimension(1), PolynomialSize::new(512), 512); + glwe_ms_compression::(12, GlweDimension(1), PolynomialSize::new(512), 512); + glwe_ms_compression::(33, GlweDimension(1), PolynomialSize::new(512), 512); + glwe_ms_compression::(53, GlweDimension(1), PolynomialSize::new(512), 512); + glwe_ms_compression::(63, GlweDimension(1), PolynomialSize::new(512), 512); + + glwe_ms_compression::(127, GlweDimension(1), PolynomialSize::new(512), 100); } fn glwe_ms_compression + CastFrom>( @@ -255,7 +255,7 @@ mod test { let ciphertext_modulus = CiphertextModulus::new_native(); - let mut glwe = vec![Scalar::ZERO; (glwe_dimension.0 + 1) * polynomial_size.0]; + let mut glwe = vec![Scalar::ZERO; (glwe_dimension.0 + 1) * polynomial_size.get()]; rsc.encryption_random_generator .fill_slice_with_random_uniform_mask(&mut glwe); @@ -275,7 +275,7 @@ mod test { for (i, output) in glwe_ms_ed .into_iter() .enumerate() - .take(glwe_dimension.0 * polynomial_size.0 + bodies_count) + .take(glwe_dimension.0 * polynomial_size.get() + bodies_count) { assert_eq!( output, diff --git a/tfhe/src/core_crypto/entities/compressed_modulus_switched_multi_bit_lwe_ciphertext.rs b/tfhe/src/core_crypto/entities/compressed_modulus_switched_multi_bit_lwe_ciphertext.rs index 22fd0ba032..0ab607c6e2 100644 --- a/tfhe/src/core_crypto/entities/compressed_modulus_switched_multi_bit_lwe_ciphertext.rs +++ b/tfhe/src/core_crypto/entities/compressed_modulus_switched_multi_bit_lwe_ciphertext.rs @@ -16,7 +16,7 @@ use tfhe_versionable::Versionize; /// /// let small_lwe_dimension = LweDimension(742); /// let glwe_dimension = GlweDimension(1); -/// let polynomial_size = PolynomialSize(2048); +/// let polynomial_size = PolynomialSize::new(2048); /// let lwe_noise_distribution = /// Gaussian::from_dispersion_parameter(StandardDev(0.000007069849454709433), 0.0); /// let glwe_noise_distribution = diff --git a/tfhe/src/core_crypto/entities/ggsw_ciphertext.rs b/tfhe/src/core_crypto/entities/ggsw_ciphertext.rs index 028afb53fe..724c5356de 100644 --- a/tfhe/src/core_crypto/entities/ggsw_ciphertext.rs +++ b/tfhe/src/core_crypto/entities/ggsw_ciphertext.rs @@ -196,7 +196,7 @@ pub fn ggsw_ciphertext_size( /// Return the number of elements in a [`GgswLevelMatrix`] given a [`GlweSize`] and /// [`PolynomialSize`]. pub fn ggsw_level_matrix_size(glwe_size: GlweSize, polynomial_size: PolynomialSize) -> usize { - glwe_size.0 * glwe_size.0 * polynomial_size.0 + glwe_size.0 * glwe_size.0 * polynomial_size.get() } /// Return the number of elements in a [`FourierGgswCiphertext`] given a [`GlweSize`], @@ -215,7 +215,7 @@ pub fn fourier_ggsw_level_matrix_size( glwe_size: GlweSize, fourier_polynomial_size: FourierPolynomialSize, ) -> usize { - glwe_size.0 * glwe_size.0 * fourier_polynomial_size.0 + glwe_size.0 * glwe_size.0 * fourier_polynomial_size.get() } /// Return the number of mask samples used during encryption of a [`GgswCiphertext`] given a @@ -347,7 +347,7 @@ impl> GgswCiphertext /// // computations /// // Define parameters for GgswCiphertext creation /// let glwe_size = GlweSize(2); - /// let polynomial_size = PolynomialSize(1024); + /// let polynomial_size = PolynomialSize::new(1024); /// let decomp_base_log = DecompositionBaseLog(8); /// let decomp_level_count = DecompositionLevelCount(3); /// let ciphertext_modulus = CiphertextModulus::new_native(); @@ -406,12 +406,12 @@ impl> GgswCiphertext "Got an empty container to create a GgswCiphertext" ); assert!( - container.container_len() % (glwe_size.0 * glwe_size.0 * polynomial_size.0) == 0, + container.container_len() % (glwe_size.0 * glwe_size.0 * polynomial_size.get()) == 0, "The provided container length is not valid. \ It needs to be dividable by glwe_size * glwe_size * polynomial_size: {}. \ Got container length: {} and glwe_size: {glwe_size:?}, \ polynomial_size: {polynomial_size:?}.", - glwe_size.0 * glwe_size.0 * polynomial_size.0, + glwe_size.0 * glwe_size.0 * polynomial_size.get(), container.container_len() ); @@ -652,7 +652,7 @@ impl> GgswLevelMatrix /// // computations /// // Define parameters for GgswLevelMatrix creation /// let glwe_size = GlweSize(2); - /// let polynomial_size = PolynomialSize(1024); + /// let polynomial_size = PolynomialSize::new(1024); /// let ciphertext_modulus = CiphertextModulus::new_native(); /// /// let container = vec![0u64; ggsw_level_matrix_size(glwe_size, polynomial_size)]; @@ -780,13 +780,15 @@ impl> ContiguousEntityCo type EntityViewMetadata = GgswLevelMatrixCreationMetadata; - type EntityView<'this> = GgswLevelMatrix<&'this [Self::Element]> + type EntityView<'this> + = GgswLevelMatrix<&'this [Self::Element]> where Self: 'this; type SelfViewMetadata = (); - type SelfView<'this> = DummyCreateFrom + type SelfView<'this> + = DummyCreateFrom where Self: 'this; @@ -815,11 +817,13 @@ impl> ContiguousEntityCo impl> ContiguousEntityContainerMut for GgswCiphertext { - type EntityMutView<'this> = GgswLevelMatrix<&'this mut [Self::Element]> + type EntityMutView<'this> + = GgswLevelMatrix<&'this mut [Self::Element]> where Self: 'this; - type SelfMutView<'this> = DummyCreateFrom + type SelfMutView<'this> + = DummyCreateFrom where Self: 'this; } diff --git a/tfhe/src/core_crypto/entities/ggsw_ciphertext_list.rs b/tfhe/src/core_crypto/entities/ggsw_ciphertext_list.rs index fd79b6eda3..a2aaeadc02 100644 --- a/tfhe/src/core_crypto/entities/ggsw_ciphertext_list.rs +++ b/tfhe/src/core_crypto/entities/ggsw_ciphertext_list.rs @@ -106,7 +106,7 @@ impl> GgswCiphertextList /// // computations /// // Define parameters for GgswCiphertextList creation /// let glwe_size = GlweSize(2); - /// let polynomial_size = PolynomialSize(1024); + /// let polynomial_size = PolynomialSize::new(1024); /// let decomp_base_log = DecompositionBaseLog(8); /// let decomp_level_count = DecompositionLevelCount(3); /// let ciphertext_count = GgswCiphertextCount(2); @@ -160,13 +160,13 @@ impl> GgswCiphertextList ) -> Self { assert!( container.container_len() - % (decomp_level_count.0 * glwe_size.0 * glwe_size.0 * polynomial_size.0) + % (decomp_level_count.0 * glwe_size.0 * glwe_size.0 * polynomial_size.get()) == 0, "The provided container length is not valid. \ It needs to be dividable by decomp_level_count * glwe_size * glwe_size * polynomial_size: \ {}.Got container length: {} and decomp_level_count: {decomp_level_count:?}, \ glwe_size: {glwe_size:?}, polynomial_size: {polynomial_size:?}", - decomp_level_count.0 * glwe_size.0 * glwe_size.0 * polynomial_size.0, + decomp_level_count.0 * glwe_size.0 * glwe_size.0 * polynomial_size.get(), container.container_len() ); @@ -359,13 +359,15 @@ impl> ContiguousEntityCo type EntityViewMetadata = GgswCiphertextCreationMetadata; - type EntityView<'this> = GgswCiphertextView<'this, Self::Element> + type EntityView<'this> + = GgswCiphertextView<'this, Self::Element> where Self: 'this; type SelfViewMetadata = GgswCiphertextListCreationMetadata; - type SelfView<'this> = GgswCiphertextListView<'this, Self::Element> + type SelfView<'this> + = GgswCiphertextListView<'this, Self::Element> where Self: 'this; @@ -400,11 +402,13 @@ impl> ContiguousEntityCo impl> ContiguousEntityContainerMut for GgswCiphertextList { - type EntityMutView<'this> = GgswCiphertextMutView<'this, Self::Element> + type EntityMutView<'this> + = GgswCiphertextMutView<'this, Self::Element> where Self: 'this; - type SelfMutView<'this> = GgswCiphertextListMutView<'this, Self::Element> + type SelfMutView<'this> + = GgswCiphertextListMutView<'this, Self::Element> where Self: 'this; } diff --git a/tfhe/src/core_crypto/entities/glwe_ciphertext.rs b/tfhe/src/core_crypto/entities/glwe_ciphertext.rs index d1e001ac47..c217c91d47 100644 --- a/tfhe/src/core_crypto/entities/glwe_ciphertext.rs +++ b/tfhe/src/core_crypto/entities/glwe_ciphertext.rs @@ -32,10 +32,10 @@ impl> GlweBody { /// // DISCLAIMER: these toy example parameters are not guaranteed to be secure or yield correct /// // computations /// // Define parameters for GlweBody creation - /// let polynomial_size = PolynomialSize(1024); + /// let polynomial_size = PolynomialSize::new(1024); /// let ciphertext_modulus = CiphertextModulus::new_native(); /// - /// let glwe_body = GlweBody::from_container(vec![0u64; polynomial_size.0], ciphertext_modulus); + /// let glwe_body = GlweBody::from_container(vec![0u64; polynomial_size.get()], ciphertext_modulus); /// /// assert_eq!(glwe_body.polynomial_size(), polynomial_size); /// assert_eq!(glwe_body.ciphertext_modulus(), ciphertext_modulus); @@ -55,7 +55,7 @@ impl> GlweBody { /// /// See [`GlweBody::from_container`] for usage. pub fn polynomial_size(&self) -> PolynomialSize { - PolynomialSize(self.data.container_len()) + PolynomialSize::new(self.data.container_len()) } /// Return the [`CiphertextModulus`] of the [`GlweBody`]. @@ -117,7 +117,7 @@ impl> GlweMask { /// // computations /// // Define parameters for GlweMask creation /// let glwe_dimension = GlweDimension(1); - /// let polynomial_size = PolynomialSize(1024); + /// let polynomial_size = PolynomialSize::new(1024); /// let ciphertext_modulus = CiphertextModulus::new_native(); /// /// let glwe_mask = GlweMask::from_container( @@ -141,7 +141,7 @@ impl> GlweMask { ciphertext_modulus: CiphertextModulus, ) -> Self { assert!( - container.container_len() % polynomial_size.0 == 0, + container.container_len() % polynomial_size.get() == 0, "The provided container length is not valid. \ It needs to be dividable by polynomial_size. \ Got container length: {} and polynomial_size: {polynomial_size:?}.", @@ -158,7 +158,7 @@ impl> GlweMask { /// /// See [`GlweMask::from_container`] for usage. pub fn glwe_dimension(&self) -> GlweDimension { - GlweDimension(self.data.container_len() / self.polynomial_size.0) + GlweDimension(self.data.container_len() / self.polynomial_size.get()) } /// Return the [`PolynomialSize`] of the [`GlweMask`]. @@ -216,7 +216,7 @@ impl> AsMut<[T]> for GlweBody usize { - glwe_size.0 * polynomial_size.0 + glwe_size.0 * polynomial_size.get() } /// Return the number of elements in a [`GlweMask`] given a [`GlweDimension`] and @@ -244,7 +244,7 @@ pub fn glwe_ciphertext_encryption_mask_sample_count( pub fn glwe_ciphertext_encryption_noise_sample_count( polynomial_size: PolynomialSize, ) -> EncryptionNoiseSampleCount { - EncryptionNoiseSampleCount(polynomial_size.0) + EncryptionNoiseSampleCount(polynomial_size.get()) } /// A [`GLWE ciphertext`](`GlweCiphertext`). @@ -348,7 +348,7 @@ impl> GlweCiphertext /// // computations /// // Define parameters for GlweCiphertext creation /// let glwe_size = GlweSize(2); - /// let polynomial_size = PolynomialSize(1024); + /// let polynomial_size = PolynomialSize::new(1024); /// let ciphertext_modulus = CiphertextModulus::new_native(); /// /// // Create a new GlweCiphertext @@ -411,7 +411,7 @@ impl> GlweCiphertext "Got an empty container to create a GlweCiphertext" ); assert!( - container.container_len() % polynomial_size.0 == 0, + container.container_len() % polynomial_size.get() == 0, "The provided container length is not valid. \ It needs to be dividable by polynomial_size. \ Got container length: {} and polynomial_size: {polynomial_size:?}.", @@ -428,7 +428,7 @@ impl> GlweCiphertext /// /// See [`GlweCiphertext::from_container`] for usage. pub fn glwe_size(&self) -> GlweSize { - GlweSize(self.as_ref().container_len() / self.polynomial_size.0) + GlweSize(self.as_ref().container_len() / self.polynomial_size.get()) } /// Return the [`PolynomialSize`] of the [`GlweCiphertext`]. @@ -649,7 +649,7 @@ where ciphertext_modulus, } = self; - polynomial_size.0.is_power_of_two() + polynomial_size.get().is_power_of_two() && check_encrypted_content_respects_mod(self, glwe_ct_parameters.ct_modulus) && data.container_len() == glwe_ciphertext_size( diff --git a/tfhe/src/core_crypto/entities/glwe_ciphertext_list.rs b/tfhe/src/core_crypto/entities/glwe_ciphertext_list.rs index 040291effe..06a2390db1 100644 --- a/tfhe/src/core_crypto/entities/glwe_ciphertext_list.rs +++ b/tfhe/src/core_crypto/entities/glwe_ciphertext_list.rs @@ -53,7 +53,7 @@ impl> GlweCiphertextList /// // computations /// // Define parameters for GlweCiphertextList creation /// let glwe_size = GlweSize(2); - /// let polynomial_size = PolynomialSize(1024); + /// let polynomial_size = PolynomialSize::new(1024); /// let ciphertext_count = GlweCiphertextCount(2); /// let ciphertext_modulus = CiphertextModulus::new_native(); /// @@ -262,13 +262,15 @@ impl> ContiguousEntityCo type EntityViewMetadata = GlweCiphertextCreationMetadata; - type EntityView<'this> = GlweCiphertextView<'this, Self::Element> + type EntityView<'this> + = GlweCiphertextView<'this, Self::Element> where Self: 'this; type SelfViewMetadata = GlweCiphertextListCreationMetadata; - type SelfView<'this> = GlweCiphertextListView<'this, Self::Element> + type SelfView<'this> + = GlweCiphertextListView<'this, Self::Element> where Self: 'this; @@ -295,11 +297,13 @@ impl> ContiguousEntityCo impl> ContiguousEntityContainerMut for GlweCiphertextList { - type EntityMutView<'this> = GlweCiphertextMutView<'this, Self::Element> + type EntityMutView<'this> + = GlweCiphertextMutView<'this, Self::Element> where Self: 'this; - type SelfMutView<'this> = GlweCiphertextListMutView<'this, Self::Element> + type SelfMutView<'this> + = GlweCiphertextListMutView<'this, Self::Element> where Self: 'this; } diff --git a/tfhe/src/core_crypto/entities/glwe_secret_key.rs b/tfhe/src/core_crypto/entities/glwe_secret_key.rs index ac79fd4c4e..b532a5dfb5 100644 --- a/tfhe/src/core_crypto/entities/glwe_secret_key.rs +++ b/tfhe/src/core_crypto/entities/glwe_secret_key.rs @@ -60,7 +60,7 @@ impl> GlweSecretKey { /// // computations /// // Define parameters for GlweSecretKey creation /// let glwe_dimension = GlweDimension(1); - /// let polynomial_size = PolynomialSize(1024); + /// let polynomial_size = PolynomialSize::new(1024); /// /// // Create a new GlweSecretKey /// let glwe_secret_key = GlweSecretKey::new_empty_key(0u64, glwe_dimension, polynomial_size); @@ -83,7 +83,7 @@ impl> GlweSecretKey { "Got an empty container to create a GlweSecretKey" ); assert!( - container.container_len() % polynomial_size.0 == 0, + container.container_len() % polynomial_size.get() == 0, "The provided container length is not valid. \ It needs to be dividable by polynomial_size. \ Got container length: {} and polynomial_size: {polynomial_size:?}", @@ -99,7 +99,7 @@ impl> GlweSecretKey { /// /// See [`GlweSecretKey::from_container`] for usage. pub fn glwe_dimension(&self) -> GlweDimension { - GlweDimension(self.data.container_len() / self.polynomial_size.0) + GlweDimension(self.data.container_len() / self.polynomial_size.get()) } /// Return the [`PolynomialSize`] of the [`GlweSecretKey`]. @@ -196,7 +196,7 @@ where /// // computations /// // Define parameters for GlweSecretKey creation /// let glwe_size = GlweSize(2); - /// let polynomial_size = PolynomialSize(1024); + /// let polynomial_size = PolynomialSize::new(1024); /// /// // Create the PRNG /// let mut seeder = new_seeder(); diff --git a/tfhe/src/core_crypto/entities/lwe_bootstrap_key.rs b/tfhe/src/core_crypto/entities/lwe_bootstrap_key.rs index 91039cdb4d..76efe562ee 100644 --- a/tfhe/src/core_crypto/entities/lwe_bootstrap_key.rs +++ b/tfhe/src/core_crypto/entities/lwe_bootstrap_key.rs @@ -160,7 +160,7 @@ impl> LweBootstrapKey /// // computations /// // Define parameters for LweBootstrapKey creation /// let glwe_size = GlweSize(2); - /// let polynomial_size = PolynomialSize(1024); + /// let polynomial_size = PolynomialSize::new(1024); /// let decomp_base_log = DecompositionBaseLog(8); /// let decomp_level_count = DecompositionLevelCount(3); /// let input_lwe_dimension = LweDimension(600); diff --git a/tfhe/src/core_crypto/entities/lwe_compact_public_key.rs b/tfhe/src/core_crypto/entities/lwe_compact_public_key.rs index be77cbbe0c..1e092dcf24 100644 --- a/tfhe/src/core_crypto/entities/lwe_compact_public_key.rs +++ b/tfhe/src/core_crypto/entities/lwe_compact_public_key.rs @@ -82,7 +82,7 @@ impl> LweCompactPublicKe "LweCompactPublicKey container len must be a power of 2, got len = {}", container.container_len() ); - let equivalent_polynomial_size = PolynomialSize(container.container_len() / 2); + let equivalent_polynomial_size = PolynomialSize::new(container.container_len() / 2); Self { glwe_ciphertext: GlweCiphertext::from_container( container, @@ -103,7 +103,7 @@ impl> LweCompactPublicKe /// /// See [`LweCompactPublicKey::from_container`] for usage. pub fn lwe_dimension(&self) -> LweDimension { - LweDimension(self.glwe_ciphertext.polynomial_size().0) + LweDimension(self.glwe_ciphertext.polynomial_size().get()) } /// Return the [`CiphertextModulus`] of the [`LweCompactPublicKey`]. @@ -206,7 +206,7 @@ where let glwe_ciphertext_conformance_parameters = GlweCiphertextConformanceParameters { glwe_dim: GlweDimension(1), - polynomial_size: PolynomialSize(parameter_set.encryption_lwe_dimension.0), + polynomial_size: PolynomialSize::new(parameter_set.encryption_lwe_dimension.0), ct_modulus: parameter_set.ciphertext_modulus, }; diff --git a/tfhe/src/core_crypto/entities/lwe_multi_bit_bootstrap_key.rs b/tfhe/src/core_crypto/entities/lwe_multi_bit_bootstrap_key.rs index 6ca8915191..570c52ac0a 100644 --- a/tfhe/src/core_crypto/entities/lwe_multi_bit_bootstrap_key.rs +++ b/tfhe/src/core_crypto/entities/lwe_multi_bit_bootstrap_key.rs @@ -137,7 +137,7 @@ impl> LweMultiBitBootstr /// // computations /// // Define parameters for LweMultiBitBootstrapKey creation /// let glwe_size = GlweSize(2); - /// let polynomial_size = PolynomialSize(1024); + /// let polynomial_size = PolynomialSize::new(1024); /// let decomp_base_log = DecompositionBaseLog(8); /// let decomp_level_count = DecompositionLevelCount(3); /// let input_lwe_dimension = LweDimension(600); @@ -476,7 +476,10 @@ impl> TryFrom> Versionize for FourierLweMultiBitBootstrapKey { - type Versioned<'vers> = FourierLweMultiBitBootstrapKeyVersioned<'vers> where C: 'vers; + type Versioned<'vers> + = FourierLweMultiBitBootstrapKeyVersioned<'vers> + where + C: 'vers; fn versionize(&self) -> Self::Versioned<'_> { self.into() @@ -587,7 +590,7 @@ impl> FourierLweMultiBitBootstrapKey { } pub fn output_lwe_dimension(&self) -> LweDimension { - LweDimension((self.glwe_size.0 - 1) * self.polynomial_size().0) + LweDimension((self.glwe_size.0 - 1) * self.polynomial_size().get()) } pub fn grouping_factor(&self) -> LweBskGroupingFactor { diff --git a/tfhe/src/core_crypto/entities/lwe_packing_keyswitch_key.rs b/tfhe/src/core_crypto/entities/lwe_packing_keyswitch_key.rs index 91505f4d41..920e86a939 100644 --- a/tfhe/src/core_crypto/entities/lwe_packing_keyswitch_key.rs +++ b/tfhe/src/core_crypto/entities/lwe_packing_keyswitch_key.rs @@ -72,7 +72,7 @@ impl> LwePackingKeyswitc /// // Define parameters for LwePackingKeyswitchKey creation /// let input_lwe_dimension = LweDimension(600); /// let output_glwe_dimension = GlweDimension(1); - /// let output_polynomial_size = PolynomialSize(1024); + /// let output_polynomial_size = PolynomialSize::new(1024); /// let decomp_base_log = DecompositionBaseLog(4); /// let decomp_level_count = DecompositionLevelCount(5); /// let ciphertext_modulus = CiphertextModulus::new_native(); @@ -350,7 +350,8 @@ impl> ContiguousEntityCo type EntityViewMetadata = GlweCiphertextListCreationMetadata; - type EntityView<'this> = GlweCiphertextListView<'this, Self::Element> + type EntityView<'this> + = GlweCiphertextListView<'this, Self::Element> where Self: 'this; @@ -358,7 +359,8 @@ impl> ContiguousEntityCo // At the moment it does not make sense to return "sub" keyswitch keys. So we use a dummy // placeholder type here. - type SelfView<'this> = DummyCreateFrom + type SelfView<'this> + = DummyCreateFrom where Self: 'this; @@ -387,13 +389,15 @@ impl> ContiguousEntityCo impl> ContiguousEntityContainerMut for LwePackingKeyswitchKey { - type EntityMutView<'this> = GlweCiphertextListMutView<'this, Self::Element> + type EntityMutView<'this> + = GlweCiphertextListMutView<'this, Self::Element> where Self: 'this; // At the moment it does not make sense to return "sub" keyswitch keys. So we use a dummy // placeholder type here. - type SelfMutView<'this> = DummyCreateFrom + type SelfMutView<'this> + = DummyCreateFrom where Self: 'this; } diff --git a/tfhe/src/core_crypto/entities/lwe_private_functional_packing_keyswitch_key.rs b/tfhe/src/core_crypto/entities/lwe_private_functional_packing_keyswitch_key.rs index 4af1bb91c4..bca8a9ead4 100644 --- a/tfhe/src/core_crypto/entities/lwe_private_functional_packing_keyswitch_key.rs +++ b/tfhe/src/core_crypto/entities/lwe_private_functional_packing_keyswitch_key.rs @@ -49,7 +49,7 @@ pub fn lwe_pfpksk_input_key_element_encrypted_size( output_polynomial_size: PolynomialSize, ) -> usize { // One ciphertext per level encrypted under the output key - decomp_level_count.0 * output_glwe_size.0 * output_polynomial_size.0 + decomp_level_count.0 * output_glwe_size.0 * output_polynomial_size.get() } /// Return the number of elements in an [`LwePrivateFunctionalPackingKeyswitchKey`] given an input @@ -145,7 +145,7 @@ impl> /// // computations /// // Define parameters for LwePrivateFunctionalPackingKeyswitchKey creation /// let glwe_size = GlweSize(2); - /// let polynomial_size = PolynomialSize(1024); + /// let polynomial_size = PolynomialSize::new(1024); /// let decomp_base_log = DecompositionBaseLog(8); /// let decomp_level_count = DecompositionLevelCount(3); /// let input_lwe_dimension = LweDimension(600); @@ -437,13 +437,15 @@ impl> ContiguousEntityCo type EntityViewMetadata = GlweCiphertextListCreationMetadata; - type EntityView<'this> = GlweCiphertextListView<'this, Self::Element> + type EntityView<'this> + = GlweCiphertextListView<'this, Self::Element> where Self: 'this; type SelfViewMetadata = LwePrivateFunctionalPackingKeyswitchKeyCreationMetadata; - type SelfView<'this> = LwePrivateFunctionalPackingKeyswitchKeyView<'this, Self::Element> + type SelfView<'this> + = LwePrivateFunctionalPackingKeyswitchKeyView<'this, Self::Element> where Self: 'this; @@ -473,11 +475,13 @@ impl> ContiguousEntityCo impl> ContiguousEntityContainerMut for LwePrivateFunctionalPackingKeyswitchKey { - type EntityMutView<'this> = GlweCiphertextListMutView<'this, Self::Element> + type EntityMutView<'this> + = GlweCiphertextListMutView<'this, Self::Element> where Self: 'this; - type SelfMutView<'this> = LwePrivateFunctionalPackingKeyswitchKeyMutView<'this, Self::Element> + type SelfMutView<'this> + = LwePrivateFunctionalPackingKeyswitchKeyMutView<'this, Self::Element> where Self: 'this; } diff --git a/tfhe/src/core_crypto/entities/lwe_private_functional_packing_keyswitch_key_list.rs b/tfhe/src/core_crypto/entities/lwe_private_functional_packing_keyswitch_key_list.rs index 31886fe3b2..30afe2bf2b 100644 --- a/tfhe/src/core_crypto/entities/lwe_private_functional_packing_keyswitch_key_list.rs +++ b/tfhe/src/core_crypto/entities/lwe_private_functional_packing_keyswitch_key_list.rs @@ -69,7 +69,7 @@ impl> /// // computations /// // Define parameters for LwePrivateFunctionalPackingKeyswitchKeyList creation /// let glwe_size = GlweSize(2); - /// let polynomial_size = PolynomialSize(1024); + /// let polynomial_size = PolynomialSize::new(1024); /// let decomp_base_log = DecompositionBaseLog(8); /// let decomp_level_count = DecompositionLevelCount(3); /// let input_lwe_dimension = LweDimension(600); @@ -443,14 +443,16 @@ impl> ContiguousEntityCo type EntityViewMetadata = LwePrivateFunctionalPackingKeyswitchKeyCreationMetadata; - type EntityView<'this> = LwePrivateFunctionalPackingKeyswitchKey<&'this [Self::Element]> + type EntityView<'this> + = LwePrivateFunctionalPackingKeyswitchKey<&'this [Self::Element]> where Self: 'this; type SelfViewMetadata = LwePrivateFunctionalPackingKeyswitchKeyListCreationMetadata; - type SelfView<'this> = LwePrivateFunctionalPackingKeyswitchKeyList<&'this [Self::Element]> + type SelfView<'this> + = LwePrivateFunctionalPackingKeyswitchKeyList<&'this [Self::Element]> where Self: 'this; @@ -483,11 +485,13 @@ impl> ContiguousEntityCo impl> ContiguousEntityContainerMut for LwePrivateFunctionalPackingKeyswitchKeyList { - type EntityMutView<'this> = LwePrivateFunctionalPackingKeyswitchKey<&'this mut [Self::Element]> + type EntityMutView<'this> + = LwePrivateFunctionalPackingKeyswitchKey<&'this mut [Self::Element]> where Self: 'this; - type SelfMutView<'this> = LwePrivateFunctionalPackingKeyswitchKeyList<&'this mut [Self::Element]> + type SelfMutView<'this> + = LwePrivateFunctionalPackingKeyswitchKeyList<&'this mut [Self::Element]> where Self: 'this; } diff --git a/tfhe/src/core_crypto/entities/ntt_ggsw_ciphertext.rs b/tfhe/src/core_crypto/entities/ntt_ggsw_ciphertext.rs index f7edf035f5..200cbfffa4 100644 --- a/tfhe/src/core_crypto/entities/ntt_ggsw_ciphertext.rs +++ b/tfhe/src/core_crypto/entities/ntt_ggsw_ciphertext.rs @@ -55,7 +55,7 @@ impl> NttGgswCiphertext< /// // computations /// // Define parameters for NttGgswCiphertext creation /// let glwe_size = GlweSize(2); - /// let polynomial_size = PolynomialSize(1024); + /// let polynomial_size = PolynomialSize::new(1024); /// let decomp_base_log = DecompositionBaseLog(8); /// let decomp_level_count = DecompositionLevelCount(3); /// let ciphertext_modulus = CiphertextModulus::try_new((1 << 64) - (1 << 32) + 1).unwrap(); diff --git a/tfhe/src/core_crypto/entities/ntt_ggsw_ciphertext_list.rs b/tfhe/src/core_crypto/entities/ntt_ggsw_ciphertext_list.rs index 84d2e961ac..d21466aef7 100644 --- a/tfhe/src/core_crypto/entities/ntt_ggsw_ciphertext_list.rs +++ b/tfhe/src/core_crypto/entities/ntt_ggsw_ciphertext_list.rs @@ -56,7 +56,7 @@ impl> NttGgswCiphertextL /// // computations /// // Define parameters for NttGgswCiphertextList creation /// let glwe_size = GlweSize(2); - /// let polynomial_size = PolynomialSize(1024); + /// let polynomial_size = PolynomialSize::new(1024); /// let decomp_base_log = DecompositionBaseLog(8); /// let decomp_level_count = DecompositionLevelCount(3); /// let ciphertext_count = GgswCiphertextCount(2); diff --git a/tfhe/src/core_crypto/entities/ntt_lwe_bootstrap_key.rs b/tfhe/src/core_crypto/entities/ntt_lwe_bootstrap_key.rs index 7ad3a00949..79fa1e8db0 100644 --- a/tfhe/src/core_crypto/entities/ntt_lwe_bootstrap_key.rs +++ b/tfhe/src/core_crypto/entities/ntt_lwe_bootstrap_key.rs @@ -40,7 +40,7 @@ impl> NttLweBootstrapKey /// // computations /// // Define parameters for NttLweBootstrapKey creation /// let glwe_size = GlweSize(2); - /// let polynomial_size = PolynomialSize(1024); + /// let polynomial_size = PolynomialSize::new(1024); /// let decomp_base_log = DecompositionBaseLog(8); /// let decomp_level_count = DecompositionLevelCount(3); /// let input_lwe_dimension = LweDimension(600); diff --git a/tfhe/src/core_crypto/entities/polynomial.rs b/tfhe/src/core_crypto/entities/polynomial.rs index 05d64122cc..3ee8febecd 100644 --- a/tfhe/src/core_crypto/entities/polynomial.rs +++ b/tfhe/src/core_crypto/entities/polynomial.rs @@ -55,13 +55,13 @@ impl> Polynomial { /// // DISCLAIMER: these toy example parameters are not guaranteed to be secure or yield correct /// // computations /// // Define parameters for Polynomial creation - /// let polynomial_size = PolynomialSize(1024); + /// let polynomial_size = PolynomialSize::new(1024); /// /// // Create a new Polynomial /// let polynomial = Polynomial::new(0u64, polynomial_size); /// /// assert_eq!(polynomial.polynomial_size(), polynomial_size); - /// assert_eq!(polynomial.degree(), polynomial_size.0 - 1); + /// assert_eq!(polynomial.degree(), polynomial_size.get() - 1); /// /// // Demonstrate how to recover the allocated container /// let underlying_container: Vec = polynomial.into_container(); @@ -70,7 +70,7 @@ impl> Polynomial { /// let polynomial = Polynomial::from_container(underlying_container); /// /// assert_eq!(polynomial.polynomial_size(), polynomial_size); - /// assert_eq!(polynomial.degree(), polynomial_size.0 - 1); + /// assert_eq!(polynomial.degree(), polynomial_size.get() - 1); /// ``` pub fn from_container(container: C) -> Self { assert!( @@ -84,7 +84,7 @@ impl> Polynomial { /// /// See [`Polynomial::from_container`] for usage. pub fn polynomial_size(&self) -> PolynomialSize { - PolynomialSize(self.data.container_len()) + PolynomialSize::new(self.data.container_len()) } /// Return the degree of the [`Polynomial`] as a usize. @@ -93,7 +93,7 @@ impl> Polynomial { /// /// See [`Polynomial::from_container`] for usage. pub fn degree(&self) -> usize { - self.polynomial_size().0 - 1 + self.polynomial_size().get() - 1 } /// Consume the entity and return its underlying container. @@ -148,7 +148,7 @@ where /// /// See [`Polynomial::from_container`] for usage. pub fn new(fill_with: Scalar, polynomial_size: PolynomialSize) -> PolynomialOwned { - PolynomialOwned::from_container(vec![fill_with; polynomial_size.0]) + PolynomialOwned::from_container(vec![fill_with; polynomial_size.get()]) } } diff --git a/tfhe/src/core_crypto/entities/polynomial_list.rs b/tfhe/src/core_crypto/entities/polynomial_list.rs index d6d71916c2..fbed2bc7db 100644 --- a/tfhe/src/core_crypto/entities/polynomial_list.rs +++ b/tfhe/src/core_crypto/entities/polynomial_list.rs @@ -43,7 +43,7 @@ impl> PolynomialList { /// // DISCLAIMER: these toy example parameters are not guaranteed to be secure or yield correct /// // computations /// // Define parameters for PolynomialList creation - /// let polynomial_size = PolynomialSize(1024); + /// let polynomial_size = PolynomialSize::new(1024); /// let polynomial_count = PolynomialCount(3); /// /// // Create a new PolynomialList @@ -63,7 +63,7 @@ impl> PolynomialList { /// ``` pub fn from_container(container: C, polynomial_size: PolynomialSize) -> Self { assert!( - container.container_len() % polynomial_size.0 == 0, + container.container_len() % polynomial_size.get() == 0, "The provided container length is not valid. \ It needs to be dividable by polynomial_size. \ Got container length: {} and polynomial_size: {polynomial_size:?}.", @@ -86,7 +86,7 @@ impl> PolynomialList { /// /// See [`PolynomialList::from_container`] for usage. pub fn polynomial_count(&self) -> PolynomialCount { - PolynomialCount(self.data.container_len() / self.polynomial_size.0) + PolynomialCount(self.data.container_len() / self.polynomial_size.get()) } /// Return a view of the [`PolynomialList`]. This is useful if an algorithm takes a view by @@ -133,7 +133,7 @@ impl PolynomialListOwned { polynomial_count: PolynomialCount, ) -> Self { Self::from_container( - vec![fill_with; polynomial_size.0 * polynomial_count.0], + vec![fill_with; polynomial_size.get() * polynomial_count.0], polynomial_size, ) } @@ -160,13 +160,15 @@ impl ContiguousEntityContainer for PolynomialList { type EntityViewMetadata = PolynomialCreationMetadata; - type EntityView<'this> = PolynomialView<'this, Self::Element> + type EntityView<'this> + = PolynomialView<'this, Self::Element> where Self: 'this; type SelfViewMetadata = PolynomialListCreationMetadata; - type SelfView<'this> = PolynomialListView<'this, Self::Element> + type SelfView<'this> + = PolynomialListView<'this, Self::Element> where Self: 'this; @@ -175,7 +177,7 @@ impl ContiguousEntityContainer for PolynomialList { } fn get_entity_view_pod_size(&self) -> usize { - self.polynomial_size().0 + self.polynomial_size().get() } fn get_self_view_creation_metadata(&self) -> Self::SelfViewMetadata { @@ -186,11 +188,13 @@ impl ContiguousEntityContainer for PolynomialList { } impl ContiguousEntityContainerMut for PolynomialList { - type EntityMutView<'this> = PolynomialMutView<'this, Self::Element> + type EntityMutView<'this> + = PolynomialMutView<'this, Self::Element> where Self: 'this; - type SelfMutView<'this> = PolynomialListMutView<'this, Self::Element> + type SelfMutView<'this> + = PolynomialListMutView<'this, Self::Element> where Self: 'this; } diff --git a/tfhe/src/core_crypto/entities/seeded_ggsw_ciphertext.rs b/tfhe/src/core_crypto/entities/seeded_ggsw_ciphertext.rs index 206d5754dd..05f697a53c 100644 --- a/tfhe/src/core_crypto/entities/seeded_ggsw_ciphertext.rs +++ b/tfhe/src/core_crypto/entities/seeded_ggsw_ciphertext.rs @@ -57,7 +57,7 @@ pub fn seeded_ggsw_level_matrix_size( glwe_size: GlweSize, polynomial_size: PolynomialSize, ) -> usize { - glwe_size.0 * polynomial_size.0 + glwe_size.0 * polynomial_size.get() } impl> SeededGgswCiphertext { @@ -80,7 +80,7 @@ impl> SeededGgswCipherte /// // computations /// // Define parameters for SeededGgswCiphertext creation /// let glwe_size = GlweSize(2); - /// let polynomial_size = PolynomialSize(1024); + /// let polynomial_size = PolynomialSize::new(1024); /// let decomp_base_log = DecompositionBaseLog(8); /// let decomp_level_count = DecompositionLevelCount(3); /// let ciphertext_modulus = CiphertextModulus::new_native(); @@ -165,12 +165,12 @@ impl> SeededGgswCipherte "Got an empty container to create a SeededGgswCiphertext" ); assert!( - container.container_len() % (glwe_size.0 * polynomial_size.0) == 0, + container.container_len() % (glwe_size.0 * polynomial_size.get()) == 0, "The provided container length is not valid. \ It needs to be dividable by glwe_size * polynomial_size: {}. \ Got container length: {} and glwe_size: {glwe_size:?}, \ polynomial_size: {polynomial_size:?}.", - glwe_size.0 * polynomial_size.0, + glwe_size.0 * polynomial_size.get(), container.container_len() ); @@ -505,7 +505,7 @@ impl> SeededGgswLevelMat /// // computations /// // Define parameters for SeededGgswLevelMatrix creation /// let glwe_size = GlweSize(2); - /// let polynomial_size = PolynomialSize(1024); + /// let polynomial_size = PolynomialSize::new(1024); /// let ciphertext_modulus = CiphertextModulus::new_native(); /// /// // Get a seeder @@ -686,13 +686,15 @@ impl> ContiguousEntityCo type EntityViewMetadata = SeededGgswLevelMatrixCreationMetadata; - type EntityView<'this> = SeededGgswLevelMatrix<&'this [Self::Element]> + type EntityView<'this> + = SeededGgswLevelMatrix<&'this [Self::Element]> where Self: 'this; type SelfViewMetadata = (); - type SelfView<'this> = DummyCreateFrom + type SelfView<'this> + = DummyCreateFrom where Self: 'this; @@ -722,11 +724,13 @@ impl> ContiguousEntityCo impl> ContiguousEntityContainerMut for SeededGgswCiphertext { - type EntityMutView<'this> = SeededGgswLevelMatrix<&'this mut [Self::Element]> + type EntityMutView<'this> + = SeededGgswLevelMatrix<&'this mut [Self::Element]> where Self: 'this; - type SelfMutView<'this> = DummyCreateFrom + type SelfMutView<'this> + = DummyCreateFrom where Self: 'this; } diff --git a/tfhe/src/core_crypto/entities/seeded_ggsw_ciphertext_list.rs b/tfhe/src/core_crypto/entities/seeded_ggsw_ciphertext_list.rs index b7dd2f8eef..8db480a338 100644 --- a/tfhe/src/core_crypto/entities/seeded_ggsw_ciphertext_list.rs +++ b/tfhe/src/core_crypto/entities/seeded_ggsw_ciphertext_list.rs @@ -65,7 +65,7 @@ impl> SeededGgswCipherte /// // computations /// // Define parameters for SeededGgswCiphertextList creation /// let glwe_size = GlweSize(2); - /// let polynomial_size = PolynomialSize(1024); + /// let polynomial_size = PolynomialSize::new(1024); /// let decomp_base_log = DecompositionBaseLog(8); /// let decomp_level_count = DecompositionLevelCount(3); /// let ciphertext_count = GgswCiphertextCount(2); @@ -142,13 +142,13 @@ impl> SeededGgswCipherte ); assert!( - container.container_len() % (decomp_level_count.0 * glwe_size.0 * polynomial_size.0) + container.container_len() % (decomp_level_count.0 * glwe_size.0 * polynomial_size.get()) == 0, "The provided container length is not valid. \ It needs to be dividable by decomp_level_count * glwe_size * polynomial_size: \ {}.Got container length: {} and decomp_level_count: {decomp_level_count:?}, \ glwe_size: {glwe_size:?}, polynomial_size: {polynomial_size:?}", - decomp_level_count.0 * glwe_size.0 * polynomial_size.0, + decomp_level_count.0 * glwe_size.0 * polynomial_size.get(), container.container_len() ); @@ -414,13 +414,15 @@ impl> ContiguousEntityCo type EntityViewMetadata = SeededGgswCiphertextCreationMetadata; - type EntityView<'this> = SeededGgswCiphertextView<'this, Self::Element> + type EntityView<'this> + = SeededGgswCiphertextView<'this, Self::Element> where Self: 'this; type SelfViewMetadata = SeededGgswCiphertextListCreationMetadata; - type SelfView<'this> = SeededGgswCiphertextListView<'this, Self::Element> + type SelfView<'this> + = SeededGgswCiphertextListView<'this, Self::Element> where Self: 'this; @@ -459,11 +461,13 @@ impl> ContiguousEntityCo impl> ContiguousEntityContainerMut for SeededGgswCiphertextList { - type EntityMutView<'this> = SeededGgswCiphertextMutView<'this, Self::Element> + type EntityMutView<'this> + = SeededGgswCiphertextMutView<'this, Self::Element> where Self: 'this; - type SelfMutView<'this> = SeededGgswCiphertextListMutView<'this, Self::Element> + type SelfMutView<'this> + = SeededGgswCiphertextListMutView<'this, Self::Element> where Self: 'this; } diff --git a/tfhe/src/core_crypto/entities/seeded_glwe_ciphertext.rs b/tfhe/src/core_crypto/entities/seeded_glwe_ciphertext.rs index be16920e6a..08bcbac0e5 100644 --- a/tfhe/src/core_crypto/entities/seeded_glwe_ciphertext.rs +++ b/tfhe/src/core_crypto/entities/seeded_glwe_ciphertext.rs @@ -54,7 +54,7 @@ impl> SeededGlweCipherte /// // computations /// // Define parameters for SeededGlweCiphertext creation /// let glwe_size = GlweSize(2); - /// let polynomial_size = PolynomialSize(1024); + /// let polynomial_size = PolynomialSize::new(1024); /// let ciphertext_modulus = CiphertextModulus::new_native(); /// /// // Get a seeder @@ -156,7 +156,7 @@ impl> SeededGlweCipherte /// /// See [`SeededGlweCiphertext::from_container`] for usage. pub fn polynomial_size(&self) -> PolynomialSize { - PolynomialSize(self.data.container_len()) + PolynomialSize::new(self.data.container_len()) } /// Return the [`CompressionSeed`] of the [`SeededGlweCiphertext`]. @@ -267,7 +267,7 @@ impl SeededGlweCiphertextOwned { ciphertext_modulus: CiphertextModulus, ) -> Self { Self::from_container( - vec![fill_with; polynomial_size.0], + vec![fill_with; polynomial_size.get()], glwe_size, compression_seed, ciphertext_modulus, @@ -316,9 +316,9 @@ where glwe_size, } = self; - glwe_ct_parameters.polynomial_size.0.is_power_of_two() + glwe_ct_parameters.polynomial_size.get().is_power_of_two() && check_encrypted_content_respects_mod(self, glwe_ct_parameters.ct_modulus) - && data.container_len() == glwe_ct_parameters.polynomial_size.0 + && data.container_len() == glwe_ct_parameters.polynomial_size.get() && *glwe_size == glwe_ct_parameters.glwe_dim.to_glwe_size() && *ciphertext_modulus == glwe_ct_parameters.ct_modulus } diff --git a/tfhe/src/core_crypto/entities/seeded_glwe_ciphertext_list.rs b/tfhe/src/core_crypto/entities/seeded_glwe_ciphertext_list.rs index 99b227eb02..d979076227 100644 --- a/tfhe/src/core_crypto/entities/seeded_glwe_ciphertext_list.rs +++ b/tfhe/src/core_crypto/entities/seeded_glwe_ciphertext_list.rs @@ -54,7 +54,7 @@ impl> SeededGlweCipherte /// // computations /// // Define parameters for SeededGlweCiphertextList creation /// let glwe_size = GlweSize(2); - /// let polynomial_size = PolynomialSize(1024); + /// let polynomial_size = PolynomialSize::new(1024); /// let glwe_ciphertext_count = GlweCiphertextCount(2); /// let ciphertext_modulus = CiphertextModulus::new_native(); /// @@ -163,7 +163,7 @@ impl> SeededGlweCipherte /// /// See [`SeededGlweCiphertextList::from_container`] for usage. pub fn glwe_ciphertext_count(&self) -> GlweCiphertextCount { - GlweCiphertextCount(self.data.container_len() / self.polynomial_size.0) + GlweCiphertextCount(self.data.container_len() / self.polynomial_size.get()) } /// Consume the entity and return its underlying container. @@ -253,7 +253,7 @@ impl SeededGlweCiphertextListOwned { ciphertext_modulus: CiphertextModulus, ) -> Self { Self::from_container( - vec![fill_with; ciphertext_count.0 * polynomial_size.0], + vec![fill_with; ciphertext_count.0 * polynomial_size.get()], glwe_size, polynomial_size, compression_seed, @@ -321,7 +321,7 @@ impl> ContiguousEntityCo } fn get_entity_view_pod_size(&self) -> usize { - self.polynomial_size().0 + self.polynomial_size().get() } /// Unimplemented for [`SeededGlweCiphertextList`]. At the moment it does not make sense to diff --git a/tfhe/src/core_crypto/entities/seeded_lwe_bootstrap_key.rs b/tfhe/src/core_crypto/entities/seeded_lwe_bootstrap_key.rs index d80cfc9399..f6cd8a2265 100644 --- a/tfhe/src/core_crypto/entities/seeded_lwe_bootstrap_key.rs +++ b/tfhe/src/core_crypto/entities/seeded_lwe_bootstrap_key.rs @@ -67,7 +67,7 @@ impl> SeededLweBootstrap /// // computations /// // Define parameters for SeededLweBootstrapKey creation /// let glwe_size = GlweSize(2); - /// let polynomial_size = PolynomialSize(1024); + /// let polynomial_size = PolynomialSize::new(1024); /// let decomp_base_log = DecompositionBaseLog(8); /// let decomp_level_count = DecompositionLevelCount(3); /// let input_lwe_dimension = LweDimension(600); diff --git a/tfhe/src/core_crypto/entities/seeded_lwe_compact_public_key.rs b/tfhe/src/core_crypto/entities/seeded_lwe_compact_public_key.rs index a70c6f9e56..578c85e897 100644 --- a/tfhe/src/core_crypto/entities/seeded_lwe_compact_public_key.rs +++ b/tfhe/src/core_crypto/entities/seeded_lwe_compact_public_key.rs @@ -137,7 +137,7 @@ impl> SeededLweCompactPu /// /// See [`SeededLweCompactPublicKey::from_container`] for usage. pub fn lwe_dimension(&self) -> LweDimension { - LweDimension(self.seeded_glwe_ciphertext.polynomial_size().0) + LweDimension(self.seeded_glwe_ciphertext.polynomial_size().get()) } /// Return the [`CompressionSeed`] of the [`SeededLweCompactPublicKey`]. @@ -248,7 +248,7 @@ where let glwe_ciphertext_conformance_parameters = GlweCiphertextConformanceParameters { glwe_dim: GlweDimension(1), - polynomial_size: PolynomialSize(parameter_set.encryption_lwe_dimension.0), + polynomial_size: PolynomialSize::new(parameter_set.encryption_lwe_dimension.0), ct_modulus: parameter_set.ciphertext_modulus, }; diff --git a/tfhe/src/core_crypto/entities/seeded_lwe_multi_bit_bootstrap_key.rs b/tfhe/src/core_crypto/entities/seeded_lwe_multi_bit_bootstrap_key.rs index 530c34c19d..9072b1fc40 100644 --- a/tfhe/src/core_crypto/entities/seeded_lwe_multi_bit_bootstrap_key.rs +++ b/tfhe/src/core_crypto/entities/seeded_lwe_multi_bit_bootstrap_key.rs @@ -72,7 +72,7 @@ impl> SeededLweMultiBitB /// // computations /// // Define parameters for SeededLweMultiBitBootstrapKey creation /// let glwe_size = GlweSize(2); - /// let polynomial_size = PolynomialSize(1024); + /// let polynomial_size = PolynomialSize::new(1024); /// let decomp_base_log = DecompositionBaseLog(8); /// let decomp_level_count = DecompositionLevelCount(3); /// let input_lwe_dimension = LweDimension(600); diff --git a/tfhe/src/core_crypto/entities/seeded_lwe_packing_keyswitch_key.rs b/tfhe/src/core_crypto/entities/seeded_lwe_packing_keyswitch_key.rs index fbd6b8cb2b..1e4cf8c1c6 100644 --- a/tfhe/src/core_crypto/entities/seeded_lwe_packing_keyswitch_key.rs +++ b/tfhe/src/core_crypto/entities/seeded_lwe_packing_keyswitch_key.rs @@ -47,7 +47,7 @@ pub fn seeded_lwe_packing_keyswitch_key_input_key_element_encrypted_size( output_polynomial_size: PolynomialSize, ) -> usize { // One seeded ciphertext per level - decomp_level_count.0 * output_polynomial_size.0 + decomp_level_count.0 * output_polynomial_size.get() } impl> SeededLwePackingKeyswitchKey { @@ -70,7 +70,7 @@ impl> SeededLwePackingKe /// // Define parameters for SeededLwePackingKeyswitchKey creation /// let input_lwe_dimension = LweDimension(600); /// let output_glwe_dimension = GlweDimension(1); - /// let output_polynomial_size = PolynomialSize(1024); + /// let output_polynomial_size = PolynomialSize::new(1024); /// let decomp_base_log = DecompositionBaseLog(4); /// let decomp_level_count = DecompositionLevelCount(5); /// let ciphertext_modulus = CiphertextModulus::new_native(); @@ -173,12 +173,12 @@ impl> SeededLwePackingKe "Got an empty container to create an SeededLwePackingKeyswitchKey" ); assert!( - container.container_len() % (decomp_level_count.0 * output_polynomial_size.0) == 0, + container.container_len() % (decomp_level_count.0 * output_polynomial_size.get()) == 0, "The provided container length is not valid. \ It needs to be dividable by decomp_level_count * output_polynomial_size: {}. \ Got container length: {} decomp_level_count: {decomp_level_count:?} \ and output_polynomial_size {output_polynomial_size:?}.", - decomp_level_count.0 * output_polynomial_size.0, + decomp_level_count.0 * output_polynomial_size.get(), container.container_len() ); @@ -406,7 +406,8 @@ impl> ContiguousEntityCo type EntityViewMetadata = SeededGlweCiphertextListCreationMetadata; - type EntityView<'this> = SeededGlweCiphertextListView<'this, Self::Element> + type EntityView<'this> + = SeededGlweCiphertextListView<'this, Self::Element> where Self: 'this; @@ -414,7 +415,8 @@ impl> ContiguousEntityCo // At the moment it does not make sense to return "sub" keyswitch keys. So we use a dummy // placeholder type here. - type SelfView<'this> = DummyCreateFrom + type SelfView<'this> + = DummyCreateFrom where Self: 'this; @@ -446,13 +448,15 @@ impl> ContiguousEntityCo impl> ContiguousEntityContainerMut for SeededLwePackingKeyswitchKey { - type EntityMutView<'this> = SeededGlweCiphertextListMutView<'this, Self::Element> + type EntityMutView<'this> + = SeededGlweCiphertextListMutView<'this, Self::Element> where Self: 'this; // At the moment it does not make sense to return "sub" keyswitch keys. So we use a dummy // placeholder type here. - type SelfMutView<'this> = DummyCreateFrom + type SelfMutView<'this> + = DummyCreateFrom where Self: 'this; } diff --git a/tfhe/src/core_crypto/experimental/algorithms/glwe_fast_keyswitch.rs b/tfhe/src/core_crypto/experimental/algorithms/glwe_fast_keyswitch.rs index 10d9ea52a9..2300ddd864 100644 --- a/tfhe/src/core_crypto/experimental/algorithms/glwe_fast_keyswitch.rs +++ b/tfhe/src/core_crypto/experimental/algorithms/glwe_fast_keyswitch.rs @@ -41,7 +41,7 @@ use dyn_stack::{PodStack, ReborrowMut, SizeOverflow, StackReq}; /// // Define parameters for GgswCiphertext creation /// let glwe_size_out = GlweSize(2); /// let glwe_size_in = GlweSize(2); -/// let polynomial_size = PolynomialSize(1024); +/// let polynomial_size = PolynomialSize::new(1024); /// let decomp_base_log = DecompositionBaseLog(8); /// let decomp_level_count = DecompositionLevelCount(2); /// let glwe_noise_distribution = @@ -91,7 +91,7 @@ use dyn_stack::{PodStack, ReborrowMut, SizeOverflow, StackReq}; /// /// let ct_plaintext = Plaintext(3 << 60); /// -/// let mut ct_plaintexts = PlaintextList::new(ct_plaintext.0, PlaintextCount(polynomial_size.0)); +/// let mut ct_plaintexts = PlaintextList::new(ct_plaintext.0, PlaintextCount(polynomial_size.get())); /// let mut ct = GlweCiphertext::new(0u64, glwe_size_in, polynomial_size, ciphertext_modulus); /// /// encrypt_glwe_ciphertext( @@ -186,7 +186,7 @@ pub fn glwe_fast_keyswitch( debug_assert_eq!(ggsw.glwe_size_out(), out.glwe_size()); let align = CACHELINE_ALIGN; - let fourier_poly_size = ggsw.polynomial_size().to_fourier_polynomial_size().0; + let fourier_poly_size = ggsw.polynomial_size().to_fourier_polynomial_size().get(); // we round the input mask and body let decomposer = SignedDecomposer::::new( @@ -325,8 +325,8 @@ pub fn glwe_fast_keyswitch_requirement( ) -> Result { let align = CACHELINE_ALIGN; let standard_scratch = - StackReq::try_new_aligned::(glwe_size_out.0 * polynomial_size.0, align)?; - let fourier_polynomial_size = polynomial_size.to_fourier_polynomial_size().0; + StackReq::try_new_aligned::(glwe_size_out.0 * polynomial_size.get(), align)?; + let fourier_polynomial_size = polynomial_size.to_fourier_polynomial_size().get(); let fourier_scratch = StackReq::try_new_aligned::(glwe_size_out.0 * fourier_polynomial_size, align)?; let fourier_scratch_single = StackReq::try_new_aligned::(fourier_polynomial_size, align)?; diff --git a/tfhe/src/core_crypto/experimental/algorithms/glwe_partial_sample_extraction.rs b/tfhe/src/core_crypto/experimental/algorithms/glwe_partial_sample_extraction.rs index 0a8196bea1..5ef53ec032 100644 --- a/tfhe/src/core_crypto/experimental/algorithms/glwe_partial_sample_extraction.rs +++ b/tfhe/src/core_crypto/experimental/algorithms/glwe_partial_sample_extraction.rs @@ -23,12 +23,12 @@ use crate::core_crypto::entities::*; /// // computations /// // Define parameters for GlweCiphertext creation /// let glwe_size = GlweSize(2); -/// let polynomial_size = PolynomialSize(8); +/// let polynomial_size = PolynomialSize::new(8); /// let glwe_noise_distribution = /// DynamicDistribution::new_gaussian_from_std_dev(StandardDev(8.881784197001252e-16)); /// let ciphertext_modulus = CiphertextModulus::new_native(); /// let phi = PartialGlweSecretKeyRandomCoefCount( -/// glwe_size.to_glwe_dimension().0 * polynomial_size.0 - 4, +/// glwe_size.to_glwe_dimension().0 * polynomial_size.get() - 4, /// ); /// /// // Create the PRNG @@ -50,7 +50,7 @@ use crate::core_crypto::entities::*; /// // Create the plaintext /// let msg = 3u64; /// let encoded_msg = msg << 60; -/// let mut plaintext_list = PlaintextList::new(encoded_msg, PlaintextCount(polynomial_size.0)); +/// let mut plaintext_list = PlaintextList::new(encoded_msg, PlaintextCount(polynomial_size.get())); /// /// let special_value = 15; /// *plaintext_list.get_mut(0).0 = 15 << 60; @@ -144,7 +144,7 @@ pub fn partial_extract_lwe_sample_from_glwe_ciphertext( /// use tfhe::core_crypto::prelude::*; /// /// let glwe_dimension = GlweDimension(1); -/// let polynomial_size = PolynomialSize(8); +/// let polynomial_size = PolynomialSize::new(8); /// let partial_glwe_secret_key_fill = PartialGlweSecretKeyRandomCoefCount(5); /// /// // Create the PRNG diff --git a/tfhe/src/core_crypto/experimental/algorithms/test/lwe_fast_keyswitch.rs b/tfhe/src/core_crypto/experimental/algorithms/test/lwe_fast_keyswitch.rs index 5966d706a2..a94844b880 100644 --- a/tfhe/src/core_crypto/experimental/algorithms/test/lwe_fast_keyswitch.rs +++ b/tfhe/src/core_crypto/experimental/algorithms/test/lwe_fast_keyswitch.rs @@ -29,7 +29,7 @@ pub const PRECISION_4_FAST_KS: FastKSParam = FastKSParam { log_precision: MessageModulusLog(4), _log_mu: 4, glwe_dimension: GlweDimension(2), - polynomial_size: PolynomialSize(1024), + polynomial_size: PolynomialSize::new(1024), bsk_partial_glwe_secret_key_fill: PartialGlweSecretKeyRandomCoefCount(2048), bsk_glwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 3.162026630747649e-16, @@ -42,7 +42,7 @@ pub const PRECISION_4_FAST_KS: FastKSParam = FastKSParam { pbs_base_log: DecompositionBaseLog(23), ks1_level: DecompositionLevelCount(14), ks1_base_log: DecompositionBaseLog(1), - ks1_polynomial_size: PolynomialSize(512), + ks1_polynomial_size: PolynomialSize::new(512), ks_in_glwe_dimension: GlweDimension(3), // Original value // ks_in_glwe_dimension: GlweDimension(4), // Test non square pseudo GGSWs phi_in: 1366, diff --git a/tfhe/src/core_crypto/experimental/algorithms/test/lwe_stair_keyswitch.rs b/tfhe/src/core_crypto/experimental/algorithms/test/lwe_stair_keyswitch.rs index 4216f1a9e0..9f6e66879a 100644 --- a/tfhe/src/core_crypto/experimental/algorithms/test/lwe_stair_keyswitch.rs +++ b/tfhe/src/core_crypto/experimental/algorithms/test/lwe_stair_keyswitch.rs @@ -33,7 +33,7 @@ pub const PRECISION_4_STAIR: StairKSParam = StairKSParam { log_precision: MessageModulusLog(4), _log_mu: 4, glwe_dimension: GlweDimension(2), - polynomial_size: PolynomialSize(1024), + polynomial_size: PolynomialSize::new(1024), partial_glwe_secret_key_fill: PartialGlweSecretKeyRandomCoefCount(2048), bsk_glwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 3.16202663074765e-16, diff --git a/tfhe/src/core_crypto/experimental/entities/pseudo_ggsw_ciphertext.rs b/tfhe/src/core_crypto/experimental/entities/pseudo_ggsw_ciphertext.rs index 90bb0dd8ea..53fe834d39 100644 --- a/tfhe/src/core_crypto/experimental/entities/pseudo_ggsw_ciphertext.rs +++ b/tfhe/src/core_crypto/experimental/entities/pseudo_ggsw_ciphertext.rs @@ -55,7 +55,7 @@ pub fn pseudo_ggsw_level_matrix_size( output_glwe_size: GlweSize, polynomial_size: PolynomialSize, ) -> usize { - input_glwe_size.to_glwe_dimension().0 * output_glwe_size.0 * polynomial_size.0 + input_glwe_size.to_glwe_dimension().0 * output_glwe_size.0 * polynomial_size.get() } /// Return the number of mask samples used during encryption of a [`PseudoGgswCiphertext`] given an @@ -206,7 +206,7 @@ impl> PseudoGgswCipherte /// // Define parameters for PseudoGgswCiphertext creation /// let input_glwe_size = GlweSize(2); /// let output_glwe_size = GlweSize(3); - /// let polynomial_size = PolynomialSize(1024); + /// let polynomial_size = PolynomialSize::new(1024); /// let decomp_base_log = DecompositionBaseLog(8); /// let decomp_level_count = DecompositionLevelCount(3); /// let ciphertext_modulus = CiphertextModulus::new_native(); @@ -271,14 +271,14 @@ impl> PseudoGgswCipherte ); assert!( container.container_len() - % (input_glwe_size.to_glwe_dimension().0 * output_glwe_size.0 * polynomial_size.0) + % (input_glwe_size.to_glwe_dimension().0 * output_glwe_size.0 * polynomial_size.get()) == 0, "The provided container length is not valid. \ It needs to be dividable by glwe_dimension_in * output_glwe_size * polynomial_size: {}. \ Got container length: {} and glwe_dimension_in: {:?}, output_glwe_size: \ {output_glwe_size:?}\ polynomial_size: {polynomial_size:?}.", - input_glwe_size.0 * output_glwe_size.0 * polynomial_size.0, + input_glwe_size.0 * output_glwe_size.0 * polynomial_size.get(), container.container_len(), input_glwe_size.to_glwe_dimension() ); @@ -554,7 +554,7 @@ impl> PseudoGgswLevelMat /// // Define parameters for GgswLevelMatrix creation /// let input_glwe_size = GlweSize(3); /// let output_glwe_size = GlweSize(2); - /// let polynomial_size = PolynomialSize(1024); + /// let polynomial_size = PolynomialSize::new(1024); /// let ciphertext_modulus = CiphertextModulus::new_native(); /// /// let container = @@ -714,13 +714,15 @@ impl> ContiguousEntityCo type EntityViewMetadata = PseudoGgswLevelMatrixCreationMetadata; - type EntityView<'this> = PseudoGgswLevelMatrix<&'this [Self::Element]> + type EntityView<'this> + = PseudoGgswLevelMatrix<&'this [Self::Element]> where Self: 'this; type SelfViewMetadata = (); - type SelfView<'this> = DummyCreateFrom + type SelfView<'this> + = DummyCreateFrom where Self: 'this; @@ -750,11 +752,13 @@ impl> ContiguousEntityCo impl> ContiguousEntityContainerMut for PseudoGgswCiphertext { - type EntityMutView<'this> = PseudoGgswLevelMatrix<&'this mut [Self::Element]> + type EntityMutView<'this> + = PseudoGgswLevelMatrix<&'this mut [Self::Element]> where Self: 'this; - type SelfMutView<'this> = DummyCreateFrom + type SelfMutView<'this> + = DummyCreateFrom where Self: 'this; } diff --git a/tfhe/src/core_crypto/fft_impl/fft128/math/fft/mod.rs b/tfhe/src/core_crypto/fft_impl/fft128/math/fft/mod.rs index e04203fcad..d7f7783ffd 100644 --- a/tfhe/src/core_crypto/fft_impl/fft128/math/fft/mod.rs +++ b/tfhe/src/core_crypto/fft_impl/fft128/math/fft/mod.rs @@ -57,7 +57,7 @@ impl Fft128 { pub fn new(size: PolynomialSize) -> Self { let global_plans = plans(); - let n = size.0; + let n = size.get(); let get_plan = || { let plans = global_plans.read().unwrap(); let plan = plans.get(&n).cloned(); @@ -348,13 +348,13 @@ fn convert_backward_torus( impl<'a> Fft128View<'a> { pub fn polynomial_size(self) -> PolynomialSize { - PolynomialSize(2 * self.plan.fft_size()) + PolynomialSize::new(2 * self.plan.fft_size()) } /// Return the memory required for a backward negacyclic FFT. pub fn backward_scratch(self) -> Result { let one = StackReq::try_new_aligned::( - self.polynomial_size().0 / 2, + self.polynomial_size().get() / 2, aligned_vec::CACHELINE_ALIGN, )?; StackReq::try_all_of([one; 4]) diff --git a/tfhe/src/core_crypto/fft_impl/fft128/math/fft/tests.rs b/tfhe/src/core_crypto/fft_impl/fft128/math/fft/tests.rs index 25fd1b0c93..6f9ed5fb89 100644 --- a/tfhe/src/core_crypto/fft_impl/fft128/math/fft/tests.rs +++ b/tfhe/src/core_crypto/fft_impl/fft128/math/fft/tests.rs @@ -7,9 +7,9 @@ fn test_roundtrip() { let mut generator = new_random_generator(); for size_log in 6..=14 { let size = 1_usize << size_log; - let fourier_size = PolynomialSize(size).to_fourier_polynomial_size().0; + let fourier_size = PolynomialSize::new(size).to_fourier_polynomial_size().get(); - let fft = Fft128::new(PolynomialSize(size)); + let fft = Fft128::new(PolynomialSize::new(size)); let fft = fft.as_view(); let mut poly = avec![Scalar::ZERO; size].into_boxed_slice(); @@ -81,9 +81,9 @@ fn test_product() { for size_log in 6..=14 { for _ in 0..10 { let size = 1_usize << size_log; - let fourier_size = PolynomialSize(size).to_fourier_polynomial_size().0; + let fourier_size = PolynomialSize::new(size).to_fourier_polynomial_size().get(); - let fft = Fft128::new(PolynomialSize(size)); + let fft = Fft128::new(PolynomialSize::new(size)); let fft = fft.as_view(); let mut poly0 = avec![Scalar::ZERO; size].into_boxed_slice(); diff --git a/tfhe/src/core_crypto/fft_impl/fft64/crypto/wop_pbs/tests.rs b/tfhe/src/core_crypto/fft_impl/fft64/crypto/wop_pbs/tests.rs index 74dd3333f3..cc3a5d0266 100644 --- a/tfhe/src/core_crypto/fft_impl/fft64/crypto/wop_pbs/tests.rs +++ b/tfhe/src/core_crypto/fft_impl/fft64/crypto/wop_pbs/tests.rs @@ -93,7 +93,7 @@ pub fn generate_keys< #[test] pub fn test_extract_bits() { // Define settings for an insecure toy example - let polynomial_size = PolynomialSize(1024); + let polynomial_size = PolynomialSize::new(1024); let glwe_dimension = GlweDimension(1); let small_lwe_dimension = LweDimension(585); @@ -253,7 +253,7 @@ pub fn test_extract_bits() { #[test] fn test_circuit_bootstrapping_binary() { // Define settings for an insecure toy example - let polynomial_size = PolynomialSize(512); + let polynomial_size = PolynomialSize::new(512); let glwe_dimension = GlweDimension(2); let small_lwe_dimension = LweDimension(10); @@ -376,24 +376,24 @@ fn test_circuit_bootstrapping_binary() { println!("RLWE secret key:\n{glwe_sk:?}"); let mut decrypted = PlaintextListOwned::new( 0_u64, - PlaintextCount(polynomial_size.0 * level_count_cbs.0 * glwe_size.0), + PlaintextCount(polynomial_size.get() * level_count_cbs.0 * glwe_size.0), ); decrypt_glwe_ciphertext_list(&glwe_sk, &cbs_res.as_glwe_list(), &mut decrypted); - let level_size = polynomial_size.0 * glwe_size.0; + let level_size = polynomial_size.get() * glwe_size.0; println!("\nGGSW decryption:"); for (level_idx, level_decrypted_glwe) in decrypted.chunks_exact_mut(level_size).enumerate() { for (decrypted_glwe, original_polynomial_from_glwe_sk) in level_decrypted_glwe - .chunks_exact(polynomial_size.0) + .chunks_exact(polynomial_size.get()) .take(glwe_dimension.0) .zip(glwe_sk.as_polynomial_list().iter()) { let current_level = level_idx + 1; let mut expected_decryption = PlaintextListOwned::new( 0u64, - PlaintextCount(original_polynomial_from_glwe_sk.polynomial_size().0), + PlaintextCount(original_polynomial_from_glwe_sk.polynomial_size().get()), ); expected_decryption .as_mut() @@ -422,7 +422,7 @@ fn test_circuit_bootstrapping_binary() { assert_eq!(expected_decryption.as_ref(), decoded_glwe.as_ref()); } let last_decrypted_glwe = level_decrypted_glwe - .chunks_exact(polynomial_size.0) + .chunks_exact(polynomial_size.get()) .next_back() .unwrap(); @@ -449,7 +449,7 @@ fn test_circuit_bootstrapping_binary() { #[test] pub fn test_cmux_tree() { // Define settings for an insecure toy example - let polynomial_size = PolynomialSize(512); + let polynomial_size = PolynomialSize::new(512); let glwe_dimension = GlweDimension(1); let std = LogStandardDev::from_log_standard_dev(-60.); let noise_distribution = DynamicDistribution::new_gaussian(std); @@ -509,7 +509,7 @@ pub fn test_cmux_tree() { vec![ c64::default(); nb_ggsw - * polynomial_size.to_fourier_polynomial_size().0 + * polynomial_size.to_fourier_polynomial_size().get() * glwe_size.0 * glwe_size.0 * level.0 @@ -560,7 +560,7 @@ pub fn test_cmux_tree() { PodStack::new(&mut mem), ); let mut decrypted_result = - PlaintextListOwned::new(0u64, PlaintextCount(glwe_sk.polynomial_size().0)); + PlaintextListOwned::new(0u64, PlaintextCount(glwe_sk.polynomial_size().get())); decrypt_glwe_ciphertext(&glwe_sk, &result_cmux_tree, &mut decrypted_result); let decoded_result = decomposer @@ -688,7 +688,7 @@ pub fn test_extract_bit_circuit_bootstrapping_vertical_packing() { // LUT creation let number_of_luts_and_output_vp_ciphertexts = 1; - let mut lut_size = polynomial_size.0; + let mut lut_size = polynomial_size.get(); let lut_poly_list = if run_number % 2 == 0 { // Test with a small lut, only triggering a blind rotate @@ -702,7 +702,7 @@ pub fn test_extract_bit_circuit_bootstrapping_vertical_packing() { } // Here we have a single lut, so store it directly in the polynomial list - PolynomialListOwned::from_container(lut, PolynomialSize(lut_size)) + PolynomialListOwned::from_container(lut, PolynomialSize::new(lut_size)) } else { // Test with a big lut, triggering an actual cmux tree let mut lut_poly_list = PolynomialListOwned::new( @@ -850,7 +850,7 @@ fn test_wop_add_one(params: FftWopPbsTestParams) { // If the polynomial_size < 2^number_of_inputs_bits then we first create a lut with // 2^number_of_inputs_bits values that is then adapted to the right polynomial size via a // polynomial list - let luts_size = (1 << number_of_input_bits).max(polynomial_size.0); + let luts_size = (1 << number_of_input_bits).max(polynomial_size.get()); let luts_length = number_of_luts_and_output_cts * luts_size; let mut lut: Vec = Vec::with_capacity(luts_length); diff --git a/tfhe/src/core_crypto/fft_impl/fft64/math/fft/mod.rs b/tfhe/src/core_crypto/fft_impl/fft64/math/fft/mod.rs index 47738e1cba..4c06f09272 100644 --- a/tfhe/src/core_crypto/fft_impl/fft64/math/fft/mod.rs +++ b/tfhe/src/core_crypto/fft_impl/fft64/math/fft/mod.rs @@ -150,7 +150,7 @@ impl Fft { pub fn new(size: PolynomialSize) -> Self { let global_plans = plans(); - let n = size.0; + let n = size.get(); let get_plan = || { let plans = global_plans.read().unwrap(); let plan = plans.get(&n).cloned(); @@ -332,7 +332,7 @@ fn convert_add_backward_torus( impl<'a> FftView<'a> { /// Return the polynomial size that this FFT was made for. pub fn polynomial_size(self) -> PolynomialSize { - PolynomialSize(2 * self.plan.fft_size()) + PolynomialSize::new(2 * self.plan.fft_size()) } /// Serializes data in the Fourier domain. @@ -363,7 +363,7 @@ impl<'a> FftView<'a> { self.plan .fft_scratch()? .try_and(StackReq::try_new_aligned::( - self.polynomial_size().to_fourier_polynomial_size().0, + self.polynomial_size().to_fourier_polynomial_size().get(), aligned_vec::CACHELINE_ALIGN, )?) } @@ -414,7 +414,7 @@ impl<'a> FftView<'a> { fourier: FourierPolynomialMutView<'_>, degree: usize, ) -> c64 { - let n = self.polynomial_size().0; + let n = self.polynomial_size().get(); let fourier = fourier.data; let negate = (degree / n) % 2 == 1; @@ -570,7 +570,7 @@ pub struct FourierPolynomialList> { impl> FourierPolynomialList { pub fn polynomial_count(&self) -> PolynomialCount { PolynomialCount( - self.data.container_len() / self.polynomial_size.to_fourier_polynomial_size().0, + self.data.container_len() / self.polynomial_size.to_fourier_polynomial_size().get(), ) } } @@ -580,17 +580,21 @@ impl> FourierPolynomialList { &mut self, ) -> impl DoubleEndedIterator> { assert!( - self.data.container_len() % self.polynomial_size.to_fourier_polynomial_size().0 == 0 + self.data.container_len() % self.polynomial_size.to_fourier_polynomial_size().get() + == 0 ); self.data .as_mut() - .chunks_exact_mut(self.polynomial_size.to_fourier_polynomial_size().0) + .chunks_exact_mut(self.polynomial_size.to_fourier_polynomial_size().get()) .map(move |slice| FourierPolynomial { data: slice }) } } impl> Versionize for FourierPolynomialList { - type Versioned<'vers> = FourierPolynomialListVersioned<'vers> where C: 'vers; + type Versioned<'vers> + = FourierPolynomialListVersioned<'vers> + where + C: 'vers; fn versionize(&self) -> Self::Versioned<'_> { self.into() @@ -636,10 +640,10 @@ impl> serde::Serialize for FourierPolynomialList } use serde::ser::SerializeSeq; - let chunk_count = if polynomial_size.0 == 0 { + let chunk_count = if polynomial_size.get() == 0 { 0 } else { - data.len() / (polynomial_size.to_fourier_polynomial_size().0) + data.len() / (polynomial_size.to_fourier_polynomial_size().get()) }; let mut state = serializer.serialize_seq(Some(2 + chunk_count))?; @@ -710,7 +714,7 @@ impl<'de, C: IntoContainerOwned> serde::Deserialize<'de> } let mut data = C::collect( - (0..(polynomial_size.to_fourier_polynomial_size().0 * chunk_count)) + (0..(polynomial_size.to_fourier_polynomial_size().get() * chunk_count)) .map(|_| c64::default()), ); @@ -749,10 +753,10 @@ pub fn par_convert_polynomials_list_to_fourier( polynomial_size: PolynomialSize, fft: FftView<'_>, ) { - assert_eq!(origin.len() % polynomial_size.0, 0); - let nb_polynomial = origin.len() / polynomial_size.0; + assert_eq!(origin.len() % polynomial_size.get(), 0); + let nb_polynomial = origin.len() / polynomial_size.get(); - let f_polynomial_size = polynomial_size.to_fourier_polynomial_size().0; + let f_polynomial_size = polynomial_size.to_fourier_polynomial_size().get(); assert_eq!(nb_polynomial * f_polynomial_size, dest.len()); @@ -761,7 +765,7 @@ pub fn par_convert_polynomials_list_to_fourier( let chunk_size = nb_polynomial.div_ceil(nb_threads); dest.par_chunks_mut(chunk_size * f_polynomial_size) - .zip_eq(origin.par_chunks(chunk_size * polynomial_size.0)) + .zip_eq(origin.par_chunks(chunk_size * polynomial_size.get())) .for_each(|(fourier_poly_chunk, standard_poly_chunk)| { let stack_len = fft .forward_scratch() @@ -774,7 +778,7 @@ pub fn par_convert_polynomials_list_to_fourier( for (fourier_poly, standard_poly) in izip!( fourier_poly_chunk.chunks_exact_mut(f_polynomial_size), - standard_poly_chunk.chunks_exact(polynomial_size.0) + standard_poly_chunk.chunks_exact(polynomial_size.get()) ) { fft.forward_as_torus( FourierPolynomialMutView { data: fourier_poly }, diff --git a/tfhe/src/core_crypto/fft_impl/fft64/math/fft/tests.rs b/tfhe/src/core_crypto/fft_impl/fft64/math/fft/tests.rs index 106e433c9e..0bdcbbfdbd 100644 --- a/tfhe/src/core_crypto/fft_impl/fft64/math/fft/tests.rs +++ b/tfhe/src/core_crypto/fft_impl/fft64/math/fft/tests.rs @@ -9,7 +9,7 @@ fn test_roundtrip() { for size_log in 5..=14 { let size = 1_usize << size_log; - let fft = Fft::new(PolynomialSize(size)); + let fft = Fft::new(PolynomialSize::new(size)); let fft = fft.as_view(); let mut poly = Polynomial::from_container(avec![Scalar::ZERO; size].into_boxed_slice()); @@ -102,7 +102,7 @@ fn test_product() { for _ in 0..100 { let size = 1_usize << size_log; - let fft = Fft::new(PolynomialSize(size)); + let fft = Fft::new(PolynomialSize::new(size)); let fft = fft.as_view(); let mut poly0 = diff --git a/tfhe/src/core_crypto/fft_impl/fft64/math/polynomial.rs b/tfhe/src/core_crypto/fft_impl/fft64/math/polynomial.rs index 31f0dff560..1255048e0b 100644 --- a/tfhe/src/core_crypto/fft_impl/fft64/math/polynomial.rs +++ b/tfhe/src/core_crypto/fft_impl/fft64/math/polynomial.rs @@ -27,7 +27,7 @@ impl FourierPolynomial> { pub fn new(polynomial_size: PolynomialSize) -> Self { let boxed = avec![ c64::default(); - polynomial_size.to_fourier_polynomial_size().0 + polynomial_size.to_fourier_polynomial_size().get() ] .into_boxed_slice(); @@ -52,6 +52,6 @@ impl> FourierPolynomial { } pub fn polynomial_size(&self) -> PolynomialSize { - PolynomialSize(self.data.container_len() * 2) + PolynomialSize::new(self.data.container_len() * 2) } } diff --git a/tfhe/src/integer/parameters/mod.rs b/tfhe/src/integer/parameters/mod.rs index 84bb683037..b8452adaaf 100644 --- a/tfhe/src/integer/parameters/mod.rs +++ b/tfhe/src/integer/parameters/mod.rs @@ -29,7 +29,7 @@ pub const ALL_PARAMETER_VEC_INTEGER_16_BITS: [WopbsParameters; 2] = [ pub const PARAM_MESSAGE_4_CARRY_4_KS_PBS_16_BITS: WopbsParameters = WopbsParameters { lwe_dimension: LweDimension(481), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(2048), + polynomial_size: PolynomialSize::new(2048), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 0.00061200133780220371345, )), @@ -56,7 +56,7 @@ pub const PARAM_MESSAGE_4_CARRY_4_KS_PBS_16_BITS: WopbsParameters = WopbsParamet pub const PARAM_MESSAGE_2_CARRY_2_KS_PBS_16_BITS: WopbsParameters = WopbsParameters { lwe_dimension: LweDimension(493), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(2048), + polynomial_size: PolynomialSize::new(2048), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 0.00049144710341316649172, )), @@ -83,7 +83,7 @@ pub const PARAM_MESSAGE_2_CARRY_2_KS_PBS_16_BITS: WopbsParameters = WopbsParamet pub const PARAM_MESSAGE_4_CARRY_4_KS_PBS_32_BITS: WopbsParameters = WopbsParameters { lwe_dimension: LweDimension(481), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(2048), + polynomial_size: PolynomialSize::new(2048), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 0.00061200133780220371345, )), @@ -110,7 +110,7 @@ pub const PARAM_MESSAGE_4_CARRY_4_KS_PBS_32_BITS: WopbsParameters = WopbsParamet pub const PARAM_MESSAGE_2_CARRY_2_KS_PBS_32_BITS: WopbsParameters = WopbsParameters { lwe_dimension: LweDimension(481), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(2048), + polynomial_size: PolynomialSize::new(2048), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 0.00061200133780220371345, )), @@ -137,7 +137,7 @@ pub const PARAM_MESSAGE_2_CARRY_2_KS_PBS_32_BITS: WopbsParameters = WopbsParamet pub const PARAM_MESSAGE_1_CARRY_1_KS_PBS_32_BITS: WopbsParameters = WopbsParameters { lwe_dimension: LweDimension(493), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(2048), + polynomial_size: PolynomialSize::new(2048), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 0.00049144710341316649172, )), diff --git a/tfhe/src/js_on_wasm_api/boolean.rs b/tfhe/src/js_on_wasm_api/boolean.rs index 3ab3d49d26..5316bd2df6 100644 --- a/tfhe/src/js_on_wasm_api/boolean.rs +++ b/tfhe/src/js_on_wasm_api/boolean.rs @@ -130,7 +130,7 @@ impl Boolean { BooleanParameters(crate::boolean::parameters::BooleanParameters { lwe_dimension: LweDimension(lwe_dimension), glwe_dimension: GlweDimension(glwe_dimension), - polynomial_size: PolynomialSize(polynomial_size), + polynomial_size: PolynomialSize::new(polynomial_size), lwe_noise_distribution: lwe_noise_distribution.0, glwe_noise_distribution: glwe_noise_distribution.0, pbs_base_log: DecompositionBaseLog(pbs_base_log), diff --git a/tfhe/src/js_on_wasm_api/shortint.rs b/tfhe/src/js_on_wasm_api/shortint.rs index 567e8a9dcb..f107228058 100644 --- a/tfhe/src/js_on_wasm_api/shortint.rs +++ b/tfhe/src/js_on_wasm_api/shortint.rs @@ -66,12 +66,12 @@ impl ShortintParameters { #[wasm_bindgen] pub fn polynomial_size(&self) -> usize { - self.0.polynomial_size.0 + self.0.polynomial_size.get() } #[wasm_bindgen] pub fn set_polynomial_size(&mut self, new_value: usize) { - self.0.polynomial_size.0 = new_value; + self.0.polynomial_size.get() = new_value; } #[wasm_bindgen] @@ -543,7 +543,7 @@ impl Shortint { ShortintParameters(crate::shortint::ClassicPBSParameters { lwe_dimension: LweDimension(lwe_dimension), glwe_dimension: GlweDimension(glwe_dimension), - polynomial_size: PolynomialSize(polynomial_size), + polynomial_size: PolynomialSize::new(polynomial_size), lwe_noise_distribution: lwe_noise_distribution.0, glwe_noise_distribution: glwe_noise_distribution.0, pbs_base_log: DecompositionBaseLog(pbs_base_log), diff --git a/tfhe/src/shortint/parameters/classic/compact_pk/gaussian/p_fail_2_minus_64/ks_pbs.rs b/tfhe/src/shortint/parameters/classic/compact_pk/gaussian/p_fail_2_minus_64/ks_pbs.rs index 4a6cb58d5b..a5ada09ece 100644 --- a/tfhe/src/shortint/parameters/classic/compact_pk/gaussian/p_fail_2_minus_64/ks_pbs.rs +++ b/tfhe/src/shortint/parameters/classic/compact_pk/gaussian/p_fail_2_minus_64/ks_pbs.rs @@ -6,7 +6,7 @@ pub const PARAM_MESSAGE_1_CARRY_0_COMPACT_PK_KS_PBS_GAUSSIAN_2M64: ClassicPBSPar ClassicPBSParameters { lwe_dimension: LweDimension(684), glwe_dimension: GlweDimension(2), - polynomial_size: PolynomialSize(512), + polynomial_size: PolynomialSize::new(512), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 4.7280002450549286e-05, )), @@ -29,7 +29,7 @@ pub const PARAM_MESSAGE_1_CARRY_1_COMPACT_PK_KS_PBS_GAUSSIAN_2M64: ClassicPBSPar ClassicPBSParameters { lwe_dimension: LweDimension(781), glwe_dimension: GlweDimension(4), - polynomial_size: PolynomialSize(512), + polynomial_size: PolynomialSize::new(512), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 8.868480365938865e-06, )), @@ -52,7 +52,7 @@ pub const PARAM_MESSAGE_1_CARRY_2_COMPACT_PK_KS_PBS_GAUSSIAN_2M64: ClassicPBSPar ClassicPBSParameters { lwe_dimension: LweDimension(858), glwe_dimension: GlweDimension(2), - polynomial_size: PolynomialSize(1024), + polynomial_size: PolynomialSize::new(1024), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 2.348996819227123e-06, )), @@ -75,7 +75,7 @@ pub const PARAM_MESSAGE_1_CARRY_3_COMPACT_PK_KS_PBS_GAUSSIAN_2M64: ClassicPBSPar ClassicPBSParameters { lwe_dimension: LweDimension(859), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(2048), + polynomial_size: PolynomialSize::new(2048), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 2.3088161607134664e-06, )), @@ -98,7 +98,7 @@ pub const PARAM_MESSAGE_1_CARRY_4_COMPACT_PK_KS_PBS_GAUSSIAN_2M64: ClassicPBSPar ClassicPBSParameters { lwe_dimension: LweDimension(902), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(4096), + polynomial_size: PolynomialSize::new(4096), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 1.0994794733558207e-06, )), @@ -121,7 +121,7 @@ pub const PARAM_MESSAGE_1_CARRY_5_COMPACT_PK_KS_PBS_GAUSSIAN_2M64: ClassicPBSPar ClassicPBSParameters { lwe_dimension: LweDimension(981), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(8192), + polynomial_size: PolynomialSize::new(8192), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 2.8134175707144757e-07, )), @@ -144,7 +144,7 @@ pub const PARAM_MESSAGE_1_CARRY_6_COMPACT_PK_KS_PBS_GAUSSIAN_2M64: ClassicPBSPar ClassicPBSParameters { lwe_dimension: LweDimension(1054), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(16384), + polynomial_size: PolynomialSize::new(16384), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 7.984352743330102e-08, )), @@ -167,7 +167,7 @@ pub const PARAM_MESSAGE_1_CARRY_7_COMPACT_PK_KS_PBS_GAUSSIAN_2M64: ClassicPBSPar ClassicPBSParameters { lwe_dimension: LweDimension(1114), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(32768), + polynomial_size: PolynomialSize::new(32768), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 2.8356668849263424e-08, )), @@ -190,7 +190,7 @@ pub const PARAM_MESSAGE_2_CARRY_0_COMPACT_PK_KS_PBS_GAUSSIAN_2M64: ClassicPBSPar ClassicPBSParameters { lwe_dimension: LweDimension(781), glwe_dimension: GlweDimension(4), - polynomial_size: PolynomialSize(512), + polynomial_size: PolynomialSize::new(512), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 8.868480365938865e-06, )), @@ -213,7 +213,7 @@ pub const PARAM_MESSAGE_2_CARRY_1_COMPACT_PK_KS_PBS_GAUSSIAN_2M64: ClassicPBSPar ClassicPBSParameters { lwe_dimension: LweDimension(857), glwe_dimension: GlweDimension(2), - polynomial_size: PolynomialSize(1024), + polynomial_size: PolynomialSize::new(1024), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 2.389876747499049e-06, )), @@ -236,7 +236,7 @@ pub const PARAM_MESSAGE_2_CARRY_2_COMPACT_PK_KS_PBS_GAUSSIAN_2M64: ClassicPBSPar ClassicPBSParameters { lwe_dimension: LweDimension(834), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(2048), + polynomial_size: PolynomialSize::new(2048), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 3.5539902359442825e-06, )), @@ -259,7 +259,7 @@ pub const PARAM_MESSAGE_2_CARRY_3_COMPACT_PK_KS_PBS_GAUSSIAN_2M64: ClassicPBSPar ClassicPBSParameters { lwe_dimension: LweDimension(902), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(4096), + polynomial_size: PolynomialSize::new(4096), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 1.0994794733558207e-06, )), @@ -282,7 +282,7 @@ pub const PARAM_MESSAGE_2_CARRY_4_COMPACT_PK_KS_PBS_GAUSSIAN_2M64: ClassicPBSPar ClassicPBSParameters { lwe_dimension: LweDimension(977), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(8192), + polynomial_size: PolynomialSize::new(8192), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 3.0144389706858286e-07, )), @@ -305,7 +305,7 @@ pub const PARAM_MESSAGE_2_CARRY_5_COMPACT_PK_KS_PBS_GAUSSIAN_2M64: ClassicPBSPar ClassicPBSParameters { lwe_dimension: LweDimension(1052), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(16384), + polynomial_size: PolynomialSize::new(16384), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 8.264676629436917e-08, )), @@ -328,7 +328,7 @@ pub const PARAM_MESSAGE_2_CARRY_6_COMPACT_PK_KS_PBS_GAUSSIAN_2M64: ClassicPBSPar ClassicPBSParameters { lwe_dimension: LweDimension(1114), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(32768), + polynomial_size: PolynomialSize::new(32768), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 2.8356668849263424e-08, )), @@ -351,7 +351,7 @@ pub const PARAM_MESSAGE_3_CARRY_0_COMPACT_PK_KS_PBS_GAUSSIAN_2M64: ClassicPBSPar ClassicPBSParameters { lwe_dimension: LweDimension(857), glwe_dimension: GlweDimension(2), - polynomial_size: PolynomialSize(1024), + polynomial_size: PolynomialSize::new(1024), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 2.389876747499049e-06, )), @@ -374,7 +374,7 @@ pub const PARAM_MESSAGE_3_CARRY_1_COMPACT_PK_KS_PBS_GAUSSIAN_2M64: ClassicPBSPar ClassicPBSParameters { lwe_dimension: LweDimension(833), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(2048), + polynomial_size: PolynomialSize::new(2048), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 3.6158408373309336e-06, )), @@ -397,7 +397,7 @@ pub const PARAM_MESSAGE_3_CARRY_2_COMPACT_PK_KS_PBS_GAUSSIAN_2M64: ClassicPBSPar ClassicPBSParameters { lwe_dimension: LweDimension(935), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(4096), + polynomial_size: PolynomialSize::new(4096), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 6.221794297398788e-07, )), @@ -420,7 +420,7 @@ pub const PARAM_MESSAGE_3_CARRY_3_COMPACT_PK_KS_PBS_GAUSSIAN_2M64: ClassicPBSPar ClassicPBSParameters { lwe_dimension: LweDimension(977), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(8192), + polynomial_size: PolynomialSize::new(8192), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 3.0144389706858286e-07, )), @@ -443,7 +443,7 @@ pub const PARAM_MESSAGE_3_CARRY_4_COMPACT_PK_KS_PBS_GAUSSIAN_2M64: ClassicPBSPar ClassicPBSParameters { lwe_dimension: LweDimension(1061), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(16384), + polynomial_size: PolynomialSize::new(16384), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 7.07600596055958e-08, )), @@ -466,7 +466,7 @@ pub const PARAM_MESSAGE_3_CARRY_5_COMPACT_PK_KS_PBS_GAUSSIAN_2M64: ClassicPBSPar ClassicPBSParameters { lwe_dimension: LweDimension(1118), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(32768), + polynomial_size: PolynomialSize::new(32768), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 2.6465671112690942e-08, )), @@ -489,7 +489,7 @@ pub const PARAM_MESSAGE_4_CARRY_0_COMPACT_PK_KS_PBS_GAUSSIAN_2M64: ClassicPBSPar ClassicPBSParameters { lwe_dimension: LweDimension(833), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(2048), + polynomial_size: PolynomialSize::new(2048), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 3.6158408373309336e-06, )), @@ -512,7 +512,7 @@ pub const PARAM_MESSAGE_4_CARRY_1_COMPACT_PK_KS_PBS_GAUSSIAN_2M64: ClassicPBSPar ClassicPBSParameters { lwe_dimension: LweDimension(954), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(4096), + polynomial_size: PolynomialSize::new(4096), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 4.482777900525027e-07, )), @@ -535,7 +535,7 @@ pub const PARAM_MESSAGE_4_CARRY_2_COMPACT_PK_KS_PBS_GAUSSIAN_2M64: ClassicPBSPar ClassicPBSParameters { lwe_dimension: LweDimension(977), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(8192), + polynomial_size: PolynomialSize::new(8192), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 3.0144389706858286e-07, )), @@ -558,7 +558,7 @@ pub const PARAM_MESSAGE_4_CARRY_3_COMPACT_PK_KS_PBS_GAUSSIAN_2M64: ClassicPBSPar ClassicPBSParameters { lwe_dimension: LweDimension(1053), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(16384), + polynomial_size: PolynomialSize::new(16384), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 8.123305578333294e-08, )), @@ -581,7 +581,7 @@ pub const PARAM_MESSAGE_4_CARRY_4_COMPACT_PK_KS_PBS_GAUSSIAN_2M64: ClassicPBSPar ClassicPBSParameters { lwe_dimension: LweDimension(1112), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(32768), + polynomial_size: PolynomialSize::new(32768), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 2.935224755982453e-08, )), @@ -604,7 +604,7 @@ pub const PARAM_MESSAGE_5_CARRY_0_COMPACT_PK_KS_PBS_GAUSSIAN_2M64: ClassicPBSPar ClassicPBSParameters { lwe_dimension: LweDimension(946), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(4096), + polynomial_size: PolynomialSize::new(4096), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 5.146261171730886e-07, )), @@ -627,7 +627,7 @@ pub const PARAM_MESSAGE_5_CARRY_1_COMPACT_PK_KS_PBS_GAUSSIAN_2M64: ClassicPBSPar ClassicPBSParameters { lwe_dimension: LweDimension(977), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(8192), + polynomial_size: PolynomialSize::new(8192), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 3.0144389706858286e-07, )), @@ -650,7 +650,7 @@ pub const PARAM_MESSAGE_5_CARRY_2_COMPACT_PK_KS_PBS_GAUSSIAN_2M64: ClassicPBSPar ClassicPBSParameters { lwe_dimension: LweDimension(1052), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(16384), + polynomial_size: PolynomialSize::new(16384), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 8.264676629436917e-08, )), @@ -673,7 +673,7 @@ pub const PARAM_MESSAGE_5_CARRY_3_COMPACT_PK_KS_PBS_GAUSSIAN_2M64: ClassicPBSPar ClassicPBSParameters { lwe_dimension: LweDimension(1109), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(32768), + polynomial_size: PolynomialSize::new(32768), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 3.0911536076507566e-08, )), @@ -696,7 +696,7 @@ pub const PARAM_MESSAGE_6_CARRY_0_COMPACT_PK_KS_PBS_GAUSSIAN_2M64: ClassicPBSPar ClassicPBSParameters { lwe_dimension: LweDimension(1005), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(8192), + polynomial_size: PolynomialSize::new(8192), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 1.859518030726978e-07, )), @@ -719,7 +719,7 @@ pub const PARAM_MESSAGE_6_CARRY_1_COMPACT_PK_KS_PBS_GAUSSIAN_2M64: ClassicPBSPar ClassicPBSParameters { lwe_dimension: LweDimension(1051), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(16384), + polynomial_size: PolynomialSize::new(16384), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 8.40850798120231e-08, )), @@ -742,7 +742,7 @@ pub const PARAM_MESSAGE_6_CARRY_2_COMPACT_PK_KS_PBS_GAUSSIAN_2M64: ClassicPBSPar ClassicPBSParameters { lwe_dimension: LweDimension(1111), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(32768), + polynomial_size: PolynomialSize::new(32768), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 2.986306893048107e-08, )), @@ -765,7 +765,7 @@ pub const PARAM_MESSAGE_7_CARRY_0_COMPACT_PK_KS_PBS_GAUSSIAN_2M64: ClassicPBSPar ClassicPBSParameters { lwe_dimension: LweDimension(1051), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(16384), + polynomial_size: PolynomialSize::new(16384), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 8.40850798120231e-08, )), @@ -788,7 +788,7 @@ pub const PARAM_MESSAGE_7_CARRY_1_COMPACT_PK_KS_PBS_GAUSSIAN_2M64: ClassicPBSPar ClassicPBSParameters { lwe_dimension: LweDimension(1116), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(32768), + polynomial_size: PolynomialSize::new(32768), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 2.7394858488703536e-08, )), @@ -811,7 +811,7 @@ pub const PARAM_MESSAGE_8_CARRY_0_COMPACT_PK_KS_PBS_GAUSSIAN_2M64: ClassicPBSPar ClassicPBSParameters { lwe_dimension: LweDimension(1110), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(32768), + polynomial_size: PolynomialSize::new(32768), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 3.038278019865525e-08, )), diff --git a/tfhe/src/shortint/parameters/classic/compact_pk/gaussian/p_fail_2_minus_64/pbs_ks.rs b/tfhe/src/shortint/parameters/classic/compact_pk/gaussian/p_fail_2_minus_64/pbs_ks.rs index ddc834146b..fba15c2886 100644 --- a/tfhe/src/shortint/parameters/classic/compact_pk/gaussian/p_fail_2_minus_64/pbs_ks.rs +++ b/tfhe/src/shortint/parameters/classic/compact_pk/gaussian/p_fail_2_minus_64/pbs_ks.rs @@ -6,7 +6,7 @@ pub const PARAM_MESSAGE_1_CARRY_1_COMPACT_PK_PBS_KS_GAUSSIAN_2M64: ClassicPBSPar ClassicPBSParameters { lwe_dimension: LweDimension(1024), glwe_dimension: GlweDimension(4), - polynomial_size: PolynomialSize(512), + polynomial_size: PolynomialSize::new(512), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 1.339775301998614e-07, )), @@ -29,7 +29,7 @@ pub const PARAM_MESSAGE_2_CARRY_2_COMPACT_PK_PBS_KS_GAUSSIAN_2M64: ClassicPBSPar ClassicPBSParameters { lwe_dimension: LweDimension(1024), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(2048), + polynomial_size: PolynomialSize::new(2048), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 1.339775301998614e-07, )), @@ -52,7 +52,7 @@ pub const PARAM_MESSAGE_3_CARRY_3_COMPACT_PK_PBS_KS_GAUSSIAN_2M64: ClassicPBSPar ClassicPBSParameters { lwe_dimension: LweDimension(2048), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(16384), + polynomial_size: PolynomialSize::new(16384), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 2.845267479601915e-15, )), @@ -75,7 +75,7 @@ pub const PARAM_MESSAGE_4_CARRY_4_COMPACT_PK_PBS_KS_GAUSSIAN_2M64: ClassicPBSPar ClassicPBSParameters { lwe_dimension: LweDimension(2048), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(65536), + polynomial_size: PolynomialSize::new(65536), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 2.845267479601915e-15, )), diff --git a/tfhe/src/shortint/parameters/classic/gaussian/p_fail_2_minus_64/ks_pbs.rs b/tfhe/src/shortint/parameters/classic/gaussian/p_fail_2_minus_64/ks_pbs.rs index 90cc6ee0b6..970a97ebf2 100644 --- a/tfhe/src/shortint/parameters/classic/gaussian/p_fail_2_minus_64/ks_pbs.rs +++ b/tfhe/src/shortint/parameters/classic/gaussian/p_fail_2_minus_64/ks_pbs.rs @@ -6,7 +6,7 @@ pub const PARAM_MESSAGE_1_CARRY_0_KS_PBS_GAUSSIAN_2M64: ClassicPBSParameters = ClassicPBSParameters { lwe_dimension: LweDimension(720), glwe_dimension: GlweDimension(6), - polynomial_size: PolynomialSize(256), + polynomial_size: PolynomialSize::new(256), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 2.540544392252957e-05, )), @@ -29,7 +29,7 @@ pub const PARAM_MESSAGE_1_CARRY_1_KS_PBS_GAUSSIAN_2M64: ClassicPBSParameters = ClassicPBSParameters { lwe_dimension: LweDimension(781), glwe_dimension: GlweDimension(4), - polynomial_size: PolynomialSize(512), + polynomial_size: PolynomialSize::new(512), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 8.868480365938865e-06, )), @@ -52,7 +52,7 @@ pub const PARAM_MESSAGE_1_CARRY_2_KS_PBS_GAUSSIAN_2M64: ClassicPBSParameters = ClassicPBSParameters { lwe_dimension: LweDimension(858), glwe_dimension: GlweDimension(2), - polynomial_size: PolynomialSize(1024), + polynomial_size: PolynomialSize::new(1024), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 2.348996819227123e-06, )), @@ -75,7 +75,7 @@ pub const PARAM_MESSAGE_1_CARRY_3_KS_PBS_GAUSSIAN_2M64: ClassicPBSParameters = ClassicPBSParameters { lwe_dimension: LweDimension(859), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(2048), + polynomial_size: PolynomialSize::new(2048), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 2.3088161607134664e-06, )), @@ -98,7 +98,7 @@ pub const PARAM_MESSAGE_1_CARRY_4_KS_PBS_GAUSSIAN_2M64: ClassicPBSParameters = ClassicPBSParameters { lwe_dimension: LweDimension(902), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(4096), + polynomial_size: PolynomialSize::new(4096), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 1.0994794733558207e-06, )), @@ -121,7 +121,7 @@ pub const PARAM_MESSAGE_1_CARRY_5_KS_PBS_GAUSSIAN_2M64: ClassicPBSParameters = ClassicPBSParameters { lwe_dimension: LweDimension(981), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(8192), + polynomial_size: PolynomialSize::new(8192), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 2.8134175707144757e-07, )), @@ -144,7 +144,7 @@ pub const PARAM_MESSAGE_1_CARRY_6_KS_PBS_GAUSSIAN_2M64: ClassicPBSParameters = ClassicPBSParameters { lwe_dimension: LweDimension(1054), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(16384), + polynomial_size: PolynomialSize::new(16384), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 7.984352743330102e-08, )), @@ -167,7 +167,7 @@ pub const PARAM_MESSAGE_1_CARRY_7_KS_PBS_GAUSSIAN_2M64: ClassicPBSParameters = ClassicPBSParameters { lwe_dimension: LweDimension(1114), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(32768), + polynomial_size: PolynomialSize::new(32768), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 2.8356668849263424e-08, )), @@ -190,7 +190,7 @@ pub const PARAM_MESSAGE_2_CARRY_0_KS_PBS_GAUSSIAN_2M64: ClassicPBSParameters = ClassicPBSParameters { lwe_dimension: LweDimension(775), glwe_dimension: GlweDimension(3), - polynomial_size: PolynomialSize(512), + polynomial_size: PolynomialSize::new(512), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 9.83575402535913e-06, )), @@ -213,7 +213,7 @@ pub const PARAM_MESSAGE_2_CARRY_1_KS_PBS_GAUSSIAN_2M64: ClassicPBSParameters = ClassicPBSParameters { lwe_dimension: LweDimension(857), glwe_dimension: GlweDimension(2), - polynomial_size: PolynomialSize(1024), + polynomial_size: PolynomialSize::new(1024), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 2.389876747499049e-06, )), @@ -236,7 +236,7 @@ pub const PARAM_MESSAGE_2_CARRY_2_KS_PBS_GAUSSIAN_2M64: ClassicPBSParameters = ClassicPBSParameters { lwe_dimension: LweDimension(834), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(2048), + polynomial_size: PolynomialSize::new(2048), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 3.5539902359442825e-06, )), @@ -259,7 +259,7 @@ pub const PARAM_MESSAGE_2_CARRY_3_KS_PBS_GAUSSIAN_2M64: ClassicPBSParameters = ClassicPBSParameters { lwe_dimension: LweDimension(902), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(4096), + polynomial_size: PolynomialSize::new(4096), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 1.0994794733558207e-06, )), @@ -282,7 +282,7 @@ pub const PARAM_MESSAGE_2_CARRY_4_KS_PBS_GAUSSIAN_2M64: ClassicPBSParameters = ClassicPBSParameters { lwe_dimension: LweDimension(977), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(8192), + polynomial_size: PolynomialSize::new(8192), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 3.0144389706858286e-07, )), @@ -305,7 +305,7 @@ pub const PARAM_MESSAGE_2_CARRY_5_KS_PBS_GAUSSIAN_2M64: ClassicPBSParameters = ClassicPBSParameters { lwe_dimension: LweDimension(1052), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(16384), + polynomial_size: PolynomialSize::new(16384), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 8.264676629436917e-08, )), @@ -328,7 +328,7 @@ pub const PARAM_MESSAGE_2_CARRY_6_KS_PBS_GAUSSIAN_2M64: ClassicPBSParameters = ClassicPBSParameters { lwe_dimension: LweDimension(1114), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(32768), + polynomial_size: PolynomialSize::new(32768), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 2.8356668849263424e-08, )), @@ -351,7 +351,7 @@ pub const PARAM_MESSAGE_3_CARRY_0_KS_PBS_GAUSSIAN_2M64: ClassicPBSParameters = ClassicPBSParameters { lwe_dimension: LweDimension(857), glwe_dimension: GlweDimension(2), - polynomial_size: PolynomialSize(1024), + polynomial_size: PolynomialSize::new(1024), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 2.389876747499049e-06, )), @@ -374,7 +374,7 @@ pub const PARAM_MESSAGE_3_CARRY_1_KS_PBS_GAUSSIAN_2M64: ClassicPBSParameters = ClassicPBSParameters { lwe_dimension: LweDimension(833), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(2048), + polynomial_size: PolynomialSize::new(2048), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 3.6158408373309336e-06, )), @@ -397,7 +397,7 @@ pub const PARAM_MESSAGE_3_CARRY_2_KS_PBS_GAUSSIAN_2M64: ClassicPBSParameters = ClassicPBSParameters { lwe_dimension: LweDimension(935), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(4096), + polynomial_size: PolynomialSize::new(4096), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 6.221794297398788e-07, )), @@ -420,7 +420,7 @@ pub const PARAM_MESSAGE_3_CARRY_3_KS_PBS_GAUSSIAN_2M64: ClassicPBSParameters = ClassicPBSParameters { lwe_dimension: LweDimension(977), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(8192), + polynomial_size: PolynomialSize::new(8192), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 3.0144389706858286e-07, )), @@ -443,7 +443,7 @@ pub const PARAM_MESSAGE_3_CARRY_4_KS_PBS_GAUSSIAN_2M64: ClassicPBSParameters = ClassicPBSParameters { lwe_dimension: LweDimension(1061), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(16384), + polynomial_size: PolynomialSize::new(16384), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 7.07600596055958e-08, )), @@ -466,7 +466,7 @@ pub const PARAM_MESSAGE_3_CARRY_5_KS_PBS_GAUSSIAN_2M64: ClassicPBSParameters = ClassicPBSParameters { lwe_dimension: LweDimension(1118), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(32768), + polynomial_size: PolynomialSize::new(32768), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 2.6465671112690942e-08, )), @@ -489,7 +489,7 @@ pub const PARAM_MESSAGE_4_CARRY_0_KS_PBS_GAUSSIAN_2M64: ClassicPBSParameters = ClassicPBSParameters { lwe_dimension: LweDimension(833), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(2048), + polynomial_size: PolynomialSize::new(2048), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 3.6158408373309336e-06, )), @@ -512,7 +512,7 @@ pub const PARAM_MESSAGE_4_CARRY_1_KS_PBS_GAUSSIAN_2M64: ClassicPBSParameters = ClassicPBSParameters { lwe_dimension: LweDimension(954), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(4096), + polynomial_size: PolynomialSize::new(4096), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 4.482777900525027e-07, )), @@ -535,7 +535,7 @@ pub const PARAM_MESSAGE_4_CARRY_2_KS_PBS_GAUSSIAN_2M64: ClassicPBSParameters = ClassicPBSParameters { lwe_dimension: LweDimension(977), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(8192), + polynomial_size: PolynomialSize::new(8192), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 3.0144389706858286e-07, )), @@ -558,7 +558,7 @@ pub const PARAM_MESSAGE_4_CARRY_3_KS_PBS_GAUSSIAN_2M64: ClassicPBSParameters = ClassicPBSParameters { lwe_dimension: LweDimension(1053), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(16384), + polynomial_size: PolynomialSize::new(16384), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 8.123305578333294e-08, )), @@ -581,7 +581,7 @@ pub const PARAM_MESSAGE_4_CARRY_4_KS_PBS_GAUSSIAN_2M64: ClassicPBSParameters = ClassicPBSParameters { lwe_dimension: LweDimension(1112), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(32768), + polynomial_size: PolynomialSize::new(32768), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 2.935224755982453e-08, )), @@ -604,7 +604,7 @@ pub const PARAM_MESSAGE_5_CARRY_0_KS_PBS_GAUSSIAN_2M64: ClassicPBSParameters = ClassicPBSParameters { lwe_dimension: LweDimension(946), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(4096), + polynomial_size: PolynomialSize::new(4096), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 5.146261171730886e-07, )), @@ -627,7 +627,7 @@ pub const PARAM_MESSAGE_5_CARRY_1_KS_PBS_GAUSSIAN_2M64: ClassicPBSParameters = ClassicPBSParameters { lwe_dimension: LweDimension(977), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(8192), + polynomial_size: PolynomialSize::new(8192), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 3.0144389706858286e-07, )), @@ -650,7 +650,7 @@ pub const PARAM_MESSAGE_5_CARRY_2_KS_PBS_GAUSSIAN_2M64: ClassicPBSParameters = ClassicPBSParameters { lwe_dimension: LweDimension(1052), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(16384), + polynomial_size: PolynomialSize::new(16384), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 8.264676629436917e-08, )), @@ -673,7 +673,7 @@ pub const PARAM_MESSAGE_5_CARRY_3_KS_PBS_GAUSSIAN_2M64: ClassicPBSParameters = ClassicPBSParameters { lwe_dimension: LweDimension(1109), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(32768), + polynomial_size: PolynomialSize::new(32768), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 3.0911536076507566e-08, )), @@ -696,7 +696,7 @@ pub const PARAM_MESSAGE_6_CARRY_0_KS_PBS_GAUSSIAN_2M64: ClassicPBSParameters = ClassicPBSParameters { lwe_dimension: LweDimension(1005), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(8192), + polynomial_size: PolynomialSize::new(8192), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 1.859518030726978e-07, )), @@ -719,7 +719,7 @@ pub const PARAM_MESSAGE_6_CARRY_1_KS_PBS_GAUSSIAN_2M64: ClassicPBSParameters = ClassicPBSParameters { lwe_dimension: LweDimension(1051), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(16384), + polynomial_size: PolynomialSize::new(16384), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 8.40850798120231e-08, )), @@ -742,7 +742,7 @@ pub const PARAM_MESSAGE_6_CARRY_2_KS_PBS_GAUSSIAN_2M64: ClassicPBSParameters = ClassicPBSParameters { lwe_dimension: LweDimension(1111), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(32768), + polynomial_size: PolynomialSize::new(32768), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 2.986306893048107e-08, )), @@ -765,7 +765,7 @@ pub const PARAM_MESSAGE_7_CARRY_0_KS_PBS_GAUSSIAN_2M64: ClassicPBSParameters = ClassicPBSParameters { lwe_dimension: LweDimension(1051), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(16384), + polynomial_size: PolynomialSize::new(16384), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 8.40850798120231e-08, )), @@ -788,7 +788,7 @@ pub const PARAM_MESSAGE_7_CARRY_1_KS_PBS_GAUSSIAN_2M64: ClassicPBSParameters = ClassicPBSParameters { lwe_dimension: LweDimension(1116), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(32768), + polynomial_size: PolynomialSize::new(32768), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 2.7394858488703536e-08, )), @@ -811,7 +811,7 @@ pub const PARAM_MESSAGE_8_CARRY_0_KS_PBS_GAUSSIAN_2M64: ClassicPBSParameters = ClassicPBSParameters { lwe_dimension: LweDimension(1110), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(32768), + polynomial_size: PolynomialSize::new(32768), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 3.038278019865525e-08, )), diff --git a/tfhe/src/shortint/parameters/classic/gaussian/p_fail_2_minus_64/pbs_ks.rs b/tfhe/src/shortint/parameters/classic/gaussian/p_fail_2_minus_64/pbs_ks.rs index 3d28d74191..bd2853e0f7 100644 --- a/tfhe/src/shortint/parameters/classic/gaussian/p_fail_2_minus_64/pbs_ks.rs +++ b/tfhe/src/shortint/parameters/classic/gaussian/p_fail_2_minus_64/pbs_ks.rs @@ -6,7 +6,7 @@ pub const PARAM_MESSAGE_1_CARRY_1_PBS_KS_GAUSSIAN_2M64: ClassicPBSParameters = ClassicPBSParameters { lwe_dimension: LweDimension(884), glwe_dimension: GlweDimension(4), - polynomial_size: PolynomialSize(512), + polynomial_size: PolynomialSize::new(512), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 1.4999005934396873e-06, )), @@ -29,7 +29,7 @@ pub const PARAM_MESSAGE_2_CARRY_2_PBS_KS_GAUSSIAN_2M64: ClassicPBSParameters = ClassicPBSParameters { lwe_dimension: LweDimension(944), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(2048), + polynomial_size: PolynomialSize::new(2048), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 5.326942058078918e-07, )), @@ -52,7 +52,7 @@ pub const PARAM_MESSAGE_3_CARRY_3_PBS_KS_GAUSSIAN_2M64: ClassicPBSParameters = ClassicPBSParameters { lwe_dimension: LweDimension(1121), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(8192), + polynomial_size: PolynomialSize::new(8192), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 2.5130647937194597e-08, )), @@ -75,7 +75,7 @@ pub const PARAM_MESSAGE_4_CARRY_4_PBS_KS_GAUSSIAN_2M64: ClassicPBSParameters = ClassicPBSParameters { lwe_dimension: LweDimension(1254), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(65536), + polynomial_size: PolynomialSize::new(65536), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 2.532938831904281e-09, )), diff --git a/tfhe/src/shortint/parameters/classic/tuniform/p_fail_2_minus_64/ks_pbs.rs b/tfhe/src/shortint/parameters/classic/tuniform/p_fail_2_minus_64/ks_pbs.rs index de7baa030c..6add53618d 100644 --- a/tfhe/src/shortint/parameters/classic/tuniform/p_fail_2_minus_64/ks_pbs.rs +++ b/tfhe/src/shortint/parameters/classic/tuniform/p_fail_2_minus_64/ks_pbs.rs @@ -7,7 +7,7 @@ pub const PARAM_MESSAGE_2_CARRY_2_KS_PBS_TUNIFORM_2M64: ClassicPBSParameters = ClassicPBSParameters { lwe_dimension: LweDimension(887), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(2048), + polynomial_size: PolynomialSize::new(2048), lwe_noise_distribution: DynamicDistribution::new_t_uniform(46), glwe_noise_distribution: DynamicDistribution::new_t_uniform(17), pbs_base_log: DecompositionBaseLog(22), diff --git a/tfhe/src/shortint/parameters/classic/tuniform/p_fail_2_minus_64/pbs_ks.rs b/tfhe/src/shortint/parameters/classic/tuniform/p_fail_2_minus_64/pbs_ks.rs index 943d2f6829..bc65516d30 100644 --- a/tfhe/src/shortint/parameters/classic/tuniform/p_fail_2_minus_64/pbs_ks.rs +++ b/tfhe/src/shortint/parameters/classic/tuniform/p_fail_2_minus_64/pbs_ks.rs @@ -7,7 +7,7 @@ pub const PARAM_MESSAGE_1_CARRY_1_PBS_KS_TUNIFORM_2M64: ClassicPBSParameters = ClassicPBSParameters { lwe_dimension: LweDimension(1024), glwe_dimension: GlweDimension(4), - polynomial_size: PolynomialSize(512), + polynomial_size: PolynomialSize::new(512), lwe_noise_distribution: DynamicDistribution::new_t_uniform(42), glwe_noise_distribution: DynamicDistribution::new_t_uniform(15), pbs_base_log: DecompositionBaseLog(25), @@ -26,7 +26,7 @@ pub const PARAM_MESSAGE_2_CARRY_2_PBS_KS_TUNIFORM_2M64: ClassicPBSParameters = ClassicPBSParameters { lwe_dimension: LweDimension(1024), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(2048), + polynomial_size: PolynomialSize::new(2048), lwe_noise_distribution: DynamicDistribution::new_t_uniform(42), glwe_noise_distribution: DynamicDistribution::new_t_uniform(15), pbs_base_log: DecompositionBaseLog(23), @@ -45,7 +45,7 @@ pub const PARAM_MESSAGE_3_CARRY_3_PBS_KS_TUNIFORM_2M64: ClassicPBSParameters = ClassicPBSParameters { lwe_dimension: LweDimension(2048), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(16384), + polynomial_size: PolynomialSize::new(16384), lwe_noise_distribution: DynamicDistribution::new_t_uniform(15), glwe_noise_distribution: DynamicDistribution::new_t_uniform(3), pbs_base_log: DecompositionBaseLog(19), @@ -64,7 +64,7 @@ pub const PARAM_MESSAGE_4_CARRY_4_PBS_KS_TUNIFORM_2M64: ClassicPBSParameters = ClassicPBSParameters { lwe_dimension: LweDimension(2048), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(65536), + polynomial_size: PolynomialSize::new(65536), lwe_noise_distribution: DynamicDistribution::new_t_uniform(15), glwe_noise_distribution: DynamicDistribution::new_t_uniform(3), pbs_base_log: DecompositionBaseLog(13), diff --git a/tfhe/src/shortint/parameters/coverage_parameters.rs b/tfhe/src/shortint/parameters/coverage_parameters.rs index df44e3495e..384712202f 100644 --- a/tfhe/src/shortint/parameters/coverage_parameters.rs +++ b/tfhe/src/shortint/parameters/coverage_parameters.rs @@ -16,7 +16,7 @@ use crate::shortint::{ pub const COVERAGE_PARAM_MESSAGE_2_CARRY_2_KS_PBS: ClassicPBSParameters = ClassicPBSParameters { lwe_dimension: LweDimension(1), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(256), + polynomial_size: PolynomialSize::new(256), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 0.000007069849454709433, )), @@ -38,7 +38,7 @@ pub const COVERAGE_PARAM_MESSAGE_2_CARRY_2_KS_PBS: ClassicPBSParameters = Classi pub const COVERAGE_PARAM_MESSAGE_2_CARRY_3_KS_PBS: ClassicPBSParameters = ClassicPBSParameters { lwe_dimension: LweDimension(1), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(256), + polynomial_size: PolynomialSize::new(256), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 0.0000008775214009854235, )), @@ -60,7 +60,7 @@ pub const COVERAGE_PARAM_MESSAGE_2_CARRY_3_KS_PBS: ClassicPBSParameters = Classi pub const COVERAGE_PARAM_MESSAGE_5_CARRY_1_KS_PBS: ClassicPBSParameters = ClassicPBSParameters { lwe_dimension: LweDimension(1), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(256), + polynomial_size: PolynomialSize::new(256), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 0.0000006197725091905067, )), @@ -83,7 +83,7 @@ pub const COVERAGE_PARAM_MULTI_BIT_MESSAGE_2_CARRY_2_GROUP_2_KS_PBS: MultiBitPBS MultiBitPBSParameters { lwe_dimension: LweDimension(2), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(256), + polynomial_size: PolynomialSize::new(256), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 0.000002226459789930014, )), @@ -108,7 +108,7 @@ pub const COVERAGE_PARAM_MESSAGE_2_CARRY_2_COMPACT_PK_PBS_KS: ClassicPBSParamete ClassicPBSParameters { lwe_dimension: LweDimension(1), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(256), + polynomial_size: PolynomialSize::new(256), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 4.99029381172945e-8, )), @@ -131,7 +131,7 @@ pub const COVERAGE_PARAM_MESSAGE_2_CARRY_2_COMPACT_PK_KS_PBS: ClassicPBSParamete ClassicPBSParameters { lwe_dimension: LweDimension(1), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(256), + polynomial_size: PolynomialSize::new(256), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 6.983104533665408e-06, )), diff --git a/tfhe/src/shortint/parameters/list_compression.rs b/tfhe/src/shortint/parameters/list_compression.rs index eef5521bf8..9f166d2223 100644 --- a/tfhe/src/shortint/parameters/list_compression.rs +++ b/tfhe/src/shortint/parameters/list_compression.rs @@ -28,7 +28,7 @@ pub const COMP_PARAM_MESSAGE_2_CARRY_2_KS_PBS_TUNIFORM_2M64: CompressionParamete br_base_log: DecompositionBaseLog(25), packing_ks_level: DecompositionLevelCount(2), packing_ks_base_log: DecompositionBaseLog(8), - packing_ks_polynomial_size: PolynomialSize(256), + packing_ks_polynomial_size: PolynomialSize::new(256), packing_ks_glwe_dimension: GlweDimension(5), lwe_per_glwe: LweCiphertextCount(256), storage_log_modulus: CiphertextModulusLog(11), @@ -41,7 +41,7 @@ pub const COMP_PARAM_MESSAGE_2_CARRY_2_KS_PBS_GAUSSIAN_2M64: CompressionParamete br_base_log: DecompositionBaseLog(25), packing_ks_level: DecompositionLevelCount(2), packing_ks_base_log: DecompositionBaseLog(8), - packing_ks_polynomial_size: PolynomialSize(256), + packing_ks_polynomial_size: PolynomialSize::new(256), packing_ks_glwe_dimension: GlweDimension(5), lwe_per_glwe: LweCiphertextCount(256), storage_log_modulus: CiphertextModulusLog(11), diff --git a/tfhe/src/shortint/parameters/multi_bit/p_fail_2_minus_64/ks_pbs.rs b/tfhe/src/shortint/parameters/multi_bit/p_fail_2_minus_64/ks_pbs.rs index 3fb47eaa4e..6d743d869f 100644 --- a/tfhe/src/shortint/parameters/multi_bit/p_fail_2_minus_64/ks_pbs.rs +++ b/tfhe/src/shortint/parameters/multi_bit/p_fail_2_minus_64/ks_pbs.rs @@ -8,7 +8,7 @@ pub const PARAM_MULTI_BIT_GROUP_2_MESSAGE_1_CARRY_0_KS_PBS_GAUSSIAN_2M64: MultiB MultiBitPBSParameters { lwe_dimension: LweDimension(700), glwe_dimension: GlweDimension(3), - polynomial_size: PolynomialSize(512), + polynomial_size: PolynomialSize::new(512), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 3.58747009344789e-05, )), @@ -33,7 +33,7 @@ pub const PARAM_MULTI_BIT_GROUP_2_MESSAGE_1_CARRY_1_KS_PBS_GAUSSIAN_2M64: MultiB MultiBitPBSParameters { lwe_dimension: LweDimension(750), glwe_dimension: GlweDimension(2), - polynomial_size: PolynomialSize(1024), + polynomial_size: PolynomialSize::new(1024), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 1.5140301927925663e-05, )), @@ -58,7 +58,7 @@ pub const PARAM_MULTI_BIT_GROUP_2_MESSAGE_1_CARRY_2_KS_PBS_GAUSSIAN_2M64: MultiB MultiBitPBSParameters { lwe_dimension: LweDimension(862), glwe_dimension: GlweDimension(2), - polynomial_size: PolynomialSize(1024), + polynomial_size: PolynomialSize::new(1024), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 2.192351209970737e-06, )), @@ -83,7 +83,7 @@ pub const PARAM_MULTI_BIT_GROUP_2_MESSAGE_1_CARRY_3_KS_PBS_GAUSSIAN_2M64: MultiB MultiBitPBSParameters { lwe_dimension: LweDimension(840), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(2048), + polynomial_size: PolynomialSize::new(2048), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 3.2044815829012556e-06, )), @@ -108,7 +108,7 @@ pub const PARAM_MULTI_BIT_GROUP_2_MESSAGE_1_CARRY_4_KS_PBS_GAUSSIAN_2M64: MultiB MultiBitPBSParameters { lwe_dimension: LweDimension(950), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(4096), + polynomial_size: PolynomialSize::new(4096), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 4.803076706754256e-07, )), @@ -133,7 +133,7 @@ pub const PARAM_MULTI_BIT_GROUP_2_MESSAGE_1_CARRY_5_KS_PBS_GAUSSIAN_2M64: MultiB MultiBitPBSParameters { lwe_dimension: LweDimension(984), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(8192), + polynomial_size: PolynomialSize::new(8192), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 2.671498718807819e-07, )), @@ -158,7 +158,7 @@ pub const PARAM_MULTI_BIT_GROUP_2_MESSAGE_1_CARRY_6_KS_PBS_GAUSSIAN_2M64: MultiB MultiBitPBSParameters { lwe_dimension: LweDimension(1018), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(16384), + polynomial_size: PolynomialSize::new(16384), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 1.4859028577569142e-07, )), @@ -183,7 +183,7 @@ pub const PARAM_MULTI_BIT_GROUP_2_MESSAGE_2_CARRY_0_KS_PBS_GAUSSIAN_2M64: MultiB MultiBitPBSParameters { lwe_dimension: LweDimension(766), glwe_dimension: GlweDimension(3), - polynomial_size: PolynomialSize(512), + polynomial_size: PolynomialSize::new(512), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 1.1488024017979662e-05, )), @@ -208,7 +208,7 @@ pub const PARAM_MULTI_BIT_GROUP_2_MESSAGE_2_CARRY_1_KS_PBS_GAUSSIAN_2M64: MultiB MultiBitPBSParameters { lwe_dimension: LweDimension(860), glwe_dimension: GlweDimension(2), - polynomial_size: PolynomialSize(1024), + polynomial_size: PolynomialSize::new(1024), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 2.269322810630956e-06, )), @@ -233,7 +233,7 @@ pub const PARAM_MULTI_BIT_GROUP_2_MESSAGE_2_CARRY_2_KS_PBS_GAUSSIAN_2M64: MultiB MultiBitPBSParameters { lwe_dimension: LweDimension(888), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(2048), + polynomial_size: PolynomialSize::new(2048), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 1.3998779623487315e-06, )), @@ -258,7 +258,7 @@ pub const PARAM_MULTI_BIT_GROUP_2_MESSAGE_2_CARRY_3_KS_PBS_GAUSSIAN_2M64: MultiB MultiBitPBSParameters { lwe_dimension: LweDimension(948), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(4096), + polynomial_size: PolynomialSize::new(4096), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 4.971708676181112e-07, )), @@ -283,7 +283,7 @@ pub const PARAM_MULTI_BIT_GROUP_2_MESSAGE_2_CARRY_4_KS_PBS_GAUSSIAN_2M64: MultiB MultiBitPBSParameters { lwe_dimension: LweDimension(990), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(8192), + polynomial_size: PolynomialSize::new(8192), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 2.408776579232607e-07, )), @@ -308,7 +308,7 @@ pub const PARAM_MULTI_BIT_GROUP_2_MESSAGE_2_CARRY_5_KS_PBS_GAUSSIAN_2M64: MultiB MultiBitPBSParameters { lwe_dimension: LweDimension(1020), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(16384), + polynomial_size: PolynomialSize::new(16384), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 1.4355035400171204e-07, )), @@ -333,7 +333,7 @@ pub const PARAM_MULTI_BIT_GROUP_2_MESSAGE_3_CARRY_0_KS_PBS_GAUSSIAN_2M64: MultiB MultiBitPBSParameters { lwe_dimension: LweDimension(860), glwe_dimension: GlweDimension(2), - polynomial_size: PolynomialSize(1024), + polynomial_size: PolynomialSize::new(1024), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 2.269322810630956e-06, )), @@ -358,7 +358,7 @@ pub const PARAM_MULTI_BIT_GROUP_2_MESSAGE_3_CARRY_1_KS_PBS_GAUSSIAN_2M64: MultiB MultiBitPBSParameters { lwe_dimension: LweDimension(910), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(2048), + polynomial_size: PolynomialSize::new(2048), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 9.577287511785255e-07, )), @@ -383,7 +383,7 @@ pub const PARAM_MULTI_BIT_GROUP_2_MESSAGE_3_CARRY_2_KS_PBS_GAUSSIAN_2M64: MultiB MultiBitPBSParameters { lwe_dimension: LweDimension(948), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(4096), + polynomial_size: PolynomialSize::new(4096), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 4.971708676181112e-07, )), @@ -408,7 +408,7 @@ pub const PARAM_MULTI_BIT_GROUP_2_MESSAGE_3_CARRY_3_KS_PBS_GAUSSIAN_2M64: MultiB MultiBitPBSParameters { lwe_dimension: LweDimension(984), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(8192), + polynomial_size: PolynomialSize::new(8192), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 2.671498718807819e-07, )), @@ -433,7 +433,7 @@ pub const PARAM_MULTI_BIT_GROUP_2_MESSAGE_3_CARRY_4_KS_PBS_GAUSSIAN_2M64: MultiB MultiBitPBSParameters { lwe_dimension: LweDimension(1016), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(16384), + polynomial_size: PolynomialSize::new(16384), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 1.5380716530060473e-07, )), @@ -458,7 +458,7 @@ pub const PARAM_MULTI_BIT_GROUP_2_MESSAGE_4_CARRY_0_KS_PBS_GAUSSIAN_2M64: MultiB MultiBitPBSParameters { lwe_dimension: LweDimension(908), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(2048), + polynomial_size: PolynomialSize::new(2048), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 9.913537993191986e-07, )), @@ -483,7 +483,7 @@ pub const PARAM_MULTI_BIT_GROUP_2_MESSAGE_4_CARRY_1_KS_PBS_GAUSSIAN_2M64: MultiB MultiBitPBSParameters { lwe_dimension: LweDimension(926), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(4096), + polynomial_size: PolynomialSize::new(4096), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 7.266969277511613e-07, )), @@ -508,7 +508,7 @@ pub const PARAM_MULTI_BIT_GROUP_2_MESSAGE_4_CARRY_2_KS_PBS_GAUSSIAN_2M64: MultiB MultiBitPBSParameters { lwe_dimension: LweDimension(984), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(8192), + polynomial_size: PolynomialSize::new(8192), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 2.671498718807819e-07, )), @@ -533,7 +533,7 @@ pub const PARAM_MULTI_BIT_GROUP_2_MESSAGE_4_CARRY_3_KS_PBS_GAUSSIAN_2M64: MultiB MultiBitPBSParameters { lwe_dimension: LweDimension(1016), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(16384), + polynomial_size: PolynomialSize::new(16384), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 1.5380716530060473e-07, )), @@ -558,7 +558,7 @@ pub const PARAM_MULTI_BIT_GROUP_2_MESSAGE_5_CARRY_0_KS_PBS_GAUSSIAN_2M64: MultiB MultiBitPBSParameters { lwe_dimension: LweDimension(962), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(4096), + polynomial_size: PolynomialSize::new(4096), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 3.9048344098472363e-07, )), @@ -583,7 +583,7 @@ pub const PARAM_MULTI_BIT_GROUP_2_MESSAGE_5_CARRY_1_KS_PBS_GAUSSIAN_2M64: MultiB MultiBitPBSParameters { lwe_dimension: LweDimension(984), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(8192), + polynomial_size: PolynomialSize::new(8192), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 2.671498718807819e-07, )), @@ -608,7 +608,7 @@ pub const PARAM_MULTI_BIT_GROUP_2_MESSAGE_5_CARRY_2_KS_PBS_GAUSSIAN_2M64: MultiB MultiBitPBSParameters { lwe_dimension: LweDimension(1018), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(16384), + polynomial_size: PolynomialSize::new(16384), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 1.4859028577569142e-07, )), @@ -633,7 +633,7 @@ pub const PARAM_MULTI_BIT_GROUP_2_MESSAGE_6_CARRY_0_KS_PBS_GAUSSIAN_2M64: MultiB MultiBitPBSParameters { lwe_dimension: LweDimension(984), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(8192), + polynomial_size: PolynomialSize::new(8192), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 2.671498718807819e-07, )), @@ -658,7 +658,7 @@ pub const PARAM_MULTI_BIT_GROUP_2_MESSAGE_6_CARRY_1_KS_PBS_GAUSSIAN_2M64: MultiB MultiBitPBSParameters { lwe_dimension: LweDimension(1016), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(16384), + polynomial_size: PolynomialSize::new(16384), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 1.5380716530060473e-07, )), @@ -683,7 +683,7 @@ pub const PARAM_MULTI_BIT_GROUP_2_MESSAGE_7_CARRY_0_KS_PBS_GAUSSIAN_2M64: MultiB MultiBitPBSParameters { lwe_dimension: LweDimension(1016), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(16384), + polynomial_size: PolynomialSize::new(16384), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 1.5380716530060473e-07, )), @@ -737,7 +737,7 @@ pub const PARAM_MULTI_BIT_GROUP_3_MESSAGE_1_CARRY_0_KS_PBS_GAUSSIAN_2M64: MultiB MultiBitPBSParameters { lwe_dimension: LweDimension(702), glwe_dimension: GlweDimension(3), - polynomial_size: PolynomialSize(512), + polynomial_size: PolynomialSize::new(512), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 3.4657891610923056e-05, )), @@ -762,7 +762,7 @@ pub const PARAM_MULTI_BIT_GROUP_3_MESSAGE_1_CARRY_1_KS_PBS_GAUSSIAN_2M64: MultiB MultiBitPBSParameters { lwe_dimension: LweDimension(750), glwe_dimension: GlweDimension(2), - polynomial_size: PolynomialSize(1024), + polynomial_size: PolynomialSize::new(1024), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 1.5140301927925663e-05, )), @@ -787,7 +787,7 @@ pub const PARAM_MULTI_BIT_GROUP_3_MESSAGE_1_CARRY_2_KS_PBS_GAUSSIAN_2M64: MultiB MultiBitPBSParameters { lwe_dimension: LweDimension(864), glwe_dimension: GlweDimension(2), - polynomial_size: PolynomialSize(1024), + polynomial_size: PolynomialSize::new(1024), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 2.117990356129097e-06, )), @@ -812,7 +812,7 @@ pub const PARAM_MULTI_BIT_GROUP_3_MESSAGE_1_CARRY_3_KS_PBS_GAUSSIAN_2M64: MultiB MultiBitPBSParameters { lwe_dimension: LweDimension(840), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(2048), + polynomial_size: PolynomialSize::new(2048), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 3.2044815829012556e-06, )), @@ -837,7 +837,7 @@ pub const PARAM_MULTI_BIT_GROUP_3_MESSAGE_1_CARRY_4_KS_PBS_GAUSSIAN_2M64: MultiB MultiBitPBSParameters { lwe_dimension: LweDimension(951), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(4096), + polynomial_size: PolynomialSize::new(4096), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 4.7209178960699193e-07, )), @@ -862,7 +862,7 @@ pub const PARAM_MULTI_BIT_GROUP_3_MESSAGE_1_CARRY_5_KS_PBS_GAUSSIAN_2M64: MultiB MultiBitPBSParameters { lwe_dimension: LweDimension(987), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(8192), + polynomial_size: PolynomialSize::new(8192), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 2.5367387617400005e-07, )), @@ -887,7 +887,7 @@ pub const PARAM_MULTI_BIT_GROUP_3_MESSAGE_1_CARRY_6_KS_PBS_GAUSSIAN_2M64: MultiB MultiBitPBSParameters { lwe_dimension: LweDimension(1014), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(16384), + polynomial_size: PolynomialSize::new(16384), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 1.592072050626447e-07, )), @@ -912,7 +912,7 @@ pub const PARAM_MULTI_BIT_GROUP_3_MESSAGE_2_CARRY_0_KS_PBS_GAUSSIAN_2M64: MultiB MultiBitPBSParameters { lwe_dimension: LweDimension(765), glwe_dimension: GlweDimension(3), - polynomial_size: PolynomialSize(512), + polynomial_size: PolynomialSize::new(512), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 1.1687951746275051e-05, )), @@ -937,7 +937,7 @@ pub const PARAM_MULTI_BIT_GROUP_3_MESSAGE_2_CARRY_1_KS_PBS_GAUSSIAN_2M64: MultiB MultiBitPBSParameters { lwe_dimension: LweDimension(861), glwe_dimension: GlweDimension(2), - polynomial_size: PolynomialSize(1024), + polynomial_size: PolynomialSize::new(1024), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 2.230505012256408e-06, )), @@ -962,7 +962,7 @@ pub const PARAM_MULTI_BIT_GROUP_3_MESSAGE_2_CARRY_2_KS_PBS_GAUSSIAN_2M64: MultiB MultiBitPBSParameters { lwe_dimension: LweDimension(891), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(2048), + polynomial_size: PolynomialSize::new(2048), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 1.3292631075564801e-06, )), @@ -987,7 +987,7 @@ pub const PARAM_MULTI_BIT_GROUP_3_MESSAGE_2_CARRY_3_KS_PBS_GAUSSIAN_2M64: MultiB MultiBitPBSParameters { lwe_dimension: LweDimension(948), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(4096), + polynomial_size: PolynomialSize::new(4096), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 4.971708676181112e-07, )), @@ -1012,7 +1012,7 @@ pub const PARAM_MULTI_BIT_GROUP_3_MESSAGE_2_CARRY_4_KS_PBS_GAUSSIAN_2M64: MultiB MultiBitPBSParameters { lwe_dimension: LweDimension(996), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(8192), + polynomial_size: PolynomialSize::new(8192), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 2.1718912188918548e-07, )), @@ -1037,7 +1037,7 @@ pub const PARAM_MULTI_BIT_GROUP_3_MESSAGE_2_CARRY_5_KS_PBS_GAUSSIAN_2M64: MultiB MultiBitPBSParameters { lwe_dimension: LweDimension(1014), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(16384), + polynomial_size: PolynomialSize::new(16384), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 1.592072050626447e-07, )), @@ -1062,7 +1062,7 @@ pub const PARAM_MULTI_BIT_GROUP_3_MESSAGE_3_CARRY_0_KS_PBS_GAUSSIAN_2M64: MultiB MultiBitPBSParameters { lwe_dimension: LweDimension(861), glwe_dimension: GlweDimension(2), - polynomial_size: PolynomialSize(1024), + polynomial_size: PolynomialSize::new(1024), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 2.230505012256408e-06, )), @@ -1087,7 +1087,7 @@ pub const PARAM_MULTI_BIT_GROUP_3_MESSAGE_3_CARRY_1_KS_PBS_GAUSSIAN_2M64: MultiB MultiBitPBSParameters { lwe_dimension: LweDimension(912), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(2048), + polynomial_size: PolynomialSize::new(2048), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 9.252442079345288e-07, )), @@ -1112,7 +1112,7 @@ pub const PARAM_MULTI_BIT_GROUP_3_MESSAGE_3_CARRY_2_KS_PBS_GAUSSIAN_2M64: MultiB MultiBitPBSParameters { lwe_dimension: LweDimension(948), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(4096), + polynomial_size: PolynomialSize::new(4096), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 4.971708676181112e-07, )), @@ -1137,7 +1137,7 @@ pub const PARAM_MULTI_BIT_GROUP_3_MESSAGE_3_CARRY_3_KS_PBS_GAUSSIAN_2M64: MultiB MultiBitPBSParameters { lwe_dimension: LweDimension(987), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(8192), + polynomial_size: PolynomialSize::new(8192), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 2.5367387617400005e-07, )), @@ -1162,7 +1162,7 @@ pub const PARAM_MULTI_BIT_GROUP_3_MESSAGE_3_CARRY_4_KS_PBS_GAUSSIAN_2M64: MultiB MultiBitPBSParameters { lwe_dimension: LweDimension(1014), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(16384), + polynomial_size: PolynomialSize::new(16384), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 1.592072050626447e-07, )), @@ -1187,7 +1187,7 @@ pub const PARAM_MULTI_BIT_GROUP_3_MESSAGE_4_CARRY_0_KS_PBS_GAUSSIAN_2M64: MultiB MultiBitPBSParameters { lwe_dimension: LweDimension(909), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(2048), + polynomial_size: PolynomialSize::new(2048), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 9.743962418842052e-07, )), @@ -1212,7 +1212,7 @@ pub const PARAM_MULTI_BIT_GROUP_3_MESSAGE_4_CARRY_1_KS_PBS_GAUSSIAN_2M64: MultiB MultiBitPBSParameters { lwe_dimension: LweDimension(948), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(4096), + polynomial_size: PolynomialSize::new(4096), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 4.971708676181112e-07, )), @@ -1237,7 +1237,7 @@ pub const PARAM_MULTI_BIT_GROUP_3_MESSAGE_4_CARRY_2_KS_PBS_GAUSSIAN_2M64: MultiB MultiBitPBSParameters { lwe_dimension: LweDimension(984), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(8192), + polynomial_size: PolynomialSize::new(8192), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 2.671498718807819e-07, )), @@ -1262,7 +1262,7 @@ pub const PARAM_MULTI_BIT_GROUP_3_MESSAGE_4_CARRY_3_KS_PBS_GAUSSIAN_2M64: MultiB MultiBitPBSParameters { lwe_dimension: LweDimension(1014), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(16384), + polynomial_size: PolynomialSize::new(16384), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 1.592072050626447e-07, )), @@ -1287,7 +1287,7 @@ pub const PARAM_MULTI_BIT_GROUP_3_MESSAGE_5_CARRY_0_KS_PBS_GAUSSIAN_2M64: MultiB MultiBitPBSParameters { lwe_dimension: LweDimension(972), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(4096), + polynomial_size: PolynomialSize::new(4096), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 3.286032625627172e-07, )), @@ -1312,7 +1312,7 @@ pub const PARAM_MULTI_BIT_GROUP_3_MESSAGE_5_CARRY_1_KS_PBS_GAUSSIAN_2M64: MultiB MultiBitPBSParameters { lwe_dimension: LweDimension(984), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(8192), + polynomial_size: PolynomialSize::new(8192), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 2.671498718807819e-07, )), @@ -1337,7 +1337,7 @@ pub const PARAM_MULTI_BIT_GROUP_3_MESSAGE_5_CARRY_2_KS_PBS_GAUSSIAN_2M64: MultiB MultiBitPBSParameters { lwe_dimension: LweDimension(1014), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(16384), + polynomial_size: PolynomialSize::new(16384), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 1.592072050626447e-07, )), @@ -1362,7 +1362,7 @@ pub const PARAM_MULTI_BIT_GROUP_3_MESSAGE_6_CARRY_0_KS_PBS_GAUSSIAN_2M64: MultiB MultiBitPBSParameters { lwe_dimension: LweDimension(984), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(8192), + polynomial_size: PolynomialSize::new(8192), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 2.671498718807819e-07, )), @@ -1387,7 +1387,7 @@ pub const PARAM_MULTI_BIT_GROUP_3_MESSAGE_6_CARRY_1_KS_PBS_GAUSSIAN_2M64: MultiB MultiBitPBSParameters { lwe_dimension: LweDimension(1014), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(16384), + polynomial_size: PolynomialSize::new(16384), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 1.592072050626447e-07, )), @@ -1412,7 +1412,7 @@ pub const PARAM_MULTI_BIT_GROUP_3_MESSAGE_7_CARRY_0_KS_PBS_GAUSSIAN_2M64: MultiB MultiBitPBSParameters { lwe_dimension: LweDimension(1014), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(16384), + polynomial_size: PolynomialSize::new(16384), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 1.592072050626447e-07, )), diff --git a/tfhe/src/shortint/parameters/multi_bit/p_fail_2_minus_64/ks_pbs_gpu.rs b/tfhe/src/shortint/parameters/multi_bit/p_fail_2_minus_64/ks_pbs_gpu.rs index 0e4cf20b4d..0689c8f6ff 100644 --- a/tfhe/src/shortint/parameters/multi_bit/p_fail_2_minus_64/ks_pbs_gpu.rs +++ b/tfhe/src/shortint/parameters/multi_bit/p_fail_2_minus_64/ks_pbs_gpu.rs @@ -10,7 +10,7 @@ pub const PARAM_GPU_MULTI_BIT_GROUP_2_MESSAGE_1_CARRY_1_KS_PBS_GAUSSIAN_2M64: MultiBitPBSParameters = MultiBitPBSParameters { lwe_dimension: LweDimension(718), glwe_dimension: GlweDimension(2), - polynomial_size: PolynomialSize(1024), + polynomial_size: PolynomialSize::new(1024), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 2.62974076167165e-05, )), @@ -35,7 +35,7 @@ pub const PARAM_GPU_MULTI_BIT_GROUP_2_MESSAGE_2_CARRY_2_KS_PBS_GAUSSIAN_2M64: MultiBitPBSParameters = MultiBitPBSParameters { lwe_dimension: LweDimension(836), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(2048), + polynomial_size: PolynomialSize::new(2048), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 3.433444883863949e-06, )), @@ -60,7 +60,7 @@ pub const PARAM_GPU_MULTI_BIT_GROUP_2_MESSAGE_3_CARRY_3_KS_PBS_GAUSSIAN_2M64: MultiBitPBSParameters = MultiBitPBSParameters { lwe_dimension: LweDimension(978), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(8192), + polynomial_size: PolynomialSize::new(8192), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 2.962875621642539e-07, )), @@ -88,7 +88,7 @@ pub const PARAM_GPU_MULTI_BIT_GROUP_3_MESSAGE_1_CARRY_1_KS_PBS_GAUSSIAN_2M64: MultiBitPBSParameters = MultiBitPBSParameters { lwe_dimension: LweDimension(720), glwe_dimension: GlweDimension(2), - polynomial_size: PolynomialSize(1024), + polynomial_size: PolynomialSize::new(1024), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 2.540544392252957e-05, )), @@ -113,7 +113,7 @@ pub const PARAM_GPU_MULTI_BIT_GROUP_3_MESSAGE_2_CARRY_2_KS_PBS_GAUSSIAN_2M64: MultiBitPBSParameters = MultiBitPBSParameters { lwe_dimension: LweDimension(837), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(2048), + polynomial_size: PolynomialSize::new(2048), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 3.3747142481837397e-06, )), @@ -138,7 +138,7 @@ pub const PARAM_GPU_MULTI_BIT_GROUP_3_MESSAGE_3_CARRY_3_KS_PBS_GAUSSIAN_2M64: MultiBitPBSParameters = MultiBitPBSParameters { lwe_dimension: LweDimension(978), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(8192), + polynomial_size: PolynomialSize::new(8192), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 2.962875621642539e-07, )), diff --git a/tfhe/src/shortint/parameters/parameters_wopbs_message_carry.rs b/tfhe/src/shortint/parameters/parameters_wopbs_message_carry.rs index f6f5467263..2666462d19 100644 --- a/tfhe/src/shortint/parameters/parameters_wopbs_message_carry.rs +++ b/tfhe/src/shortint/parameters/parameters_wopbs_message_carry.rs @@ -13,7 +13,7 @@ use crate::shortint::parameters::{ pub const WOPBS_PARAM_MESSAGE_1_CARRY_5_KS_PBS: WopbsParameters = WopbsParameters { lwe_dimension: LweDimension(481), glwe_dimension: GlweDimension(2), - polynomial_size: PolynomialSize(1024), + polynomial_size: PolynomialSize::new(1024), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 0.00061200133780220371345, )), @@ -39,7 +39,7 @@ pub const WOPBS_PARAM_MESSAGE_1_CARRY_5_KS_PBS: WopbsParameters = WopbsParameter pub const WOPBS_PARAM_MESSAGE_1_CARRY_6_KS_PBS: WopbsParameters = WopbsParameters { lwe_dimension: LweDimension(481), glwe_dimension: GlweDimension(2), - polynomial_size: PolynomialSize(1024), + polynomial_size: PolynomialSize::new(1024), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 0.00061200133780220371345, )), @@ -65,7 +65,7 @@ pub const WOPBS_PARAM_MESSAGE_1_CARRY_6_KS_PBS: WopbsParameters = WopbsParameter pub const WOPBS_PARAM_MESSAGE_1_CARRY_7_KS_PBS: WopbsParameters = WopbsParameters { lwe_dimension: LweDimension(481), glwe_dimension: GlweDimension(2), - polynomial_size: PolynomialSize(1024), + polynomial_size: PolynomialSize::new(1024), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 0.00061200133780220371345, )), @@ -91,7 +91,7 @@ pub const WOPBS_PARAM_MESSAGE_1_CARRY_7_KS_PBS: WopbsParameters = WopbsParameter pub const WOPBS_PARAM_MESSAGE_1_CARRY_4_KS_PBS: WopbsParameters = WopbsParameters { lwe_dimension: LweDimension(493), glwe_dimension: GlweDimension(2), - polynomial_size: PolynomialSize(1024), + polynomial_size: PolynomialSize::new(1024), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 0.00049144710341316649172, )), @@ -117,7 +117,7 @@ pub const WOPBS_PARAM_MESSAGE_1_CARRY_4_KS_PBS: WopbsParameters = WopbsParameter pub const WOPBS_PARAM_MESSAGE_1_CARRY_8_KS_PBS: WopbsParameters = WopbsParameters { lwe_dimension: LweDimension(481), glwe_dimension: GlweDimension(2), - polynomial_size: PolynomialSize(1024), + polynomial_size: PolynomialSize::new(1024), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 0.00061200133780220371345, )), @@ -143,7 +143,7 @@ pub const WOPBS_PARAM_MESSAGE_1_CARRY_8_KS_PBS: WopbsParameters = WopbsParameter pub const WOPBS_PARAM_MESSAGE_1_CARRY_3_KS_PBS: WopbsParameters = WopbsParameters { lwe_dimension: LweDimension(497), glwe_dimension: GlweDimension(2), - polynomial_size: PolynomialSize(1024), + polynomial_size: PolynomialSize::new(1024), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 0.00045679174732062467505, )), @@ -169,7 +169,7 @@ pub const WOPBS_PARAM_MESSAGE_1_CARRY_3_KS_PBS: WopbsParameters = WopbsParameter pub const WOPBS_PARAM_MESSAGE_1_CARRY_0_KS_PBS: WopbsParameters = WopbsParameters { lwe_dimension: LweDimension(498), glwe_dimension: GlweDimension(2), - polynomial_size: PolynomialSize(1024), + polynomial_size: PolynomialSize::new(1024), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 0.00044851669823869648209, )), @@ -195,7 +195,7 @@ pub const WOPBS_PARAM_MESSAGE_1_CARRY_0_KS_PBS: WopbsParameters = WopbsParameter pub const WOPBS_PARAM_MESSAGE_1_CARRY_1_KS_PBS: WopbsParameters = WopbsParameters { lwe_dimension: LweDimension(653), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(2048), + polynomial_size: PolynomialSize::new(2048), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 0.00003604499526942373, )), @@ -221,7 +221,7 @@ pub const WOPBS_PARAM_MESSAGE_1_CARRY_1_KS_PBS: WopbsParameters = WopbsParameter pub const WOPBS_PARAM_MESSAGE_1_CARRY_2_KS_PBS: WopbsParameters = WopbsParameters { lwe_dimension: LweDimension(487), glwe_dimension: GlweDimension(3), - polynomial_size: PolynomialSize(512), + polynomial_size: PolynomialSize::new(512), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 0.00054842163045222410337, )), @@ -247,7 +247,7 @@ pub const WOPBS_PARAM_MESSAGE_1_CARRY_2_KS_PBS: WopbsParameters = WopbsParameter pub const WOPBS_PARAM_MESSAGE_2_CARRY_4_KS_PBS: WopbsParameters = WopbsParameters { lwe_dimension: LweDimension(493), glwe_dimension: GlweDimension(2), - polynomial_size: PolynomialSize(1024), + polynomial_size: PolynomialSize::new(1024), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 0.00049144710341316649172, )), @@ -273,7 +273,7 @@ pub const WOPBS_PARAM_MESSAGE_2_CARRY_4_KS_PBS: WopbsParameters = WopbsParameter pub const WOPBS_PARAM_MESSAGE_2_CARRY_5_KS_PBS: WopbsParameters = WopbsParameters { lwe_dimension: LweDimension(481), glwe_dimension: GlweDimension(2), - polynomial_size: PolynomialSize(1024), + polynomial_size: PolynomialSize::new(1024), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 0.00061200133780220371345, )), @@ -299,7 +299,7 @@ pub const WOPBS_PARAM_MESSAGE_2_CARRY_5_KS_PBS: WopbsParameters = WopbsParameter pub const WOPBS_PARAM_MESSAGE_2_CARRY_6_KS_PBS: WopbsParameters = WopbsParameters { lwe_dimension: LweDimension(481), glwe_dimension: GlweDimension(2), - polynomial_size: PolynomialSize(1024), + polynomial_size: PolynomialSize::new(1024), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 0.00061200133780220371345, )), @@ -325,7 +325,7 @@ pub const WOPBS_PARAM_MESSAGE_2_CARRY_6_KS_PBS: WopbsParameters = WopbsParameter pub const WOPBS_PARAM_MESSAGE_2_CARRY_7_KS_PBS: WopbsParameters = WopbsParameters { lwe_dimension: LweDimension(481), glwe_dimension: GlweDimension(2), - polynomial_size: PolynomialSize(1024), + polynomial_size: PolynomialSize::new(1024), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 0.00061200133780220371345, )), @@ -351,7 +351,7 @@ pub const WOPBS_PARAM_MESSAGE_2_CARRY_7_KS_PBS: WopbsParameters = WopbsParameter pub const WOPBS_PARAM_MESSAGE_2_CARRY_3_KS_PBS: WopbsParameters = WopbsParameters { lwe_dimension: LweDimension(497), glwe_dimension: GlweDimension(2), - polynomial_size: PolynomialSize(1024), + polynomial_size: PolynomialSize::new(1024), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 0.00045679174732062467505, )), @@ -377,7 +377,7 @@ pub const WOPBS_PARAM_MESSAGE_2_CARRY_3_KS_PBS: WopbsParameters = WopbsParameter pub const WOPBS_PARAM_MESSAGE_2_CARRY_0_KS_PBS: WopbsParameters = WopbsParameters { lwe_dimension: LweDimension(500), glwe_dimension: GlweDimension(2), - polynomial_size: PolynomialSize(1024), + polynomial_size: PolynomialSize::new(1024), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 0.00043241360644590172285, )), @@ -403,7 +403,7 @@ pub const WOPBS_PARAM_MESSAGE_2_CARRY_0_KS_PBS: WopbsParameters = WopbsParameter pub const WOPBS_PARAM_MESSAGE_2_CARRY_2_KS_PBS: WopbsParameters = WopbsParameters { lwe_dimension: LweDimension(769), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(2048), + polynomial_size: PolynomialSize::new(2048), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 0.0000043131554647504185, )), @@ -429,7 +429,7 @@ pub const WOPBS_PARAM_MESSAGE_2_CARRY_2_KS_PBS: WopbsParameters = WopbsParameter pub const WOPBS_PARAM_MESSAGE_2_CARRY_1_KS_PBS: WopbsParameters = WopbsParameters { lwe_dimension: LweDimension(487), glwe_dimension: GlweDimension(3), - polynomial_size: PolynomialSize(512), + polynomial_size: PolynomialSize::new(512), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 0.00054842163045222410337, )), @@ -455,7 +455,7 @@ pub const WOPBS_PARAM_MESSAGE_2_CARRY_1_KS_PBS: WopbsParameters = WopbsParameter pub const WOPBS_PARAM_MESSAGE_3_CARRY_4_KS_PBS: WopbsParameters = WopbsParameters { lwe_dimension: LweDimension(481), glwe_dimension: GlweDimension(2), - polynomial_size: PolynomialSize(1024), + polynomial_size: PolynomialSize::new(1024), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 0.00061200133780220371345, )), @@ -481,7 +481,7 @@ pub const WOPBS_PARAM_MESSAGE_3_CARRY_4_KS_PBS: WopbsParameters = WopbsParameter pub const WOPBS_PARAM_MESSAGE_3_CARRY_5_KS_PBS: WopbsParameters = WopbsParameters { lwe_dimension: LweDimension(481), glwe_dimension: GlweDimension(2), - polynomial_size: PolynomialSize(1024), + polynomial_size: PolynomialSize::new(1024), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 0.00061200133780220371345, )), @@ -507,7 +507,7 @@ pub const WOPBS_PARAM_MESSAGE_3_CARRY_5_KS_PBS: WopbsParameters = WopbsParameter pub const WOPBS_PARAM_MESSAGE_3_CARRY_3_KS_PBS: WopbsParameters = WopbsParameters { lwe_dimension: LweDimension(873), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(2048), + polynomial_size: PolynomialSize::new(2048), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 0.0000006428797112843789, )), @@ -533,7 +533,7 @@ pub const WOPBS_PARAM_MESSAGE_3_CARRY_3_KS_PBS: WopbsParameters = WopbsParameter pub const WOPBS_PARAM_MESSAGE_3_CARRY_6_KS_PBS: WopbsParameters = WopbsParameters { lwe_dimension: LweDimension(481), glwe_dimension: GlweDimension(2), - polynomial_size: PolynomialSize(1024), + polynomial_size: PolynomialSize::new(1024), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 0.00061200133780220371345, )), @@ -559,7 +559,7 @@ pub const WOPBS_PARAM_MESSAGE_3_CARRY_6_KS_PBS: WopbsParameters = WopbsParameter pub const WOPBS_PARAM_MESSAGE_3_CARRY_2_KS_PBS: WopbsParameters = WopbsParameters { lwe_dimension: LweDimension(497), glwe_dimension: GlweDimension(2), - polynomial_size: PolynomialSize(1024), + polynomial_size: PolynomialSize::new(1024), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 0.00045679174732062467505, )), @@ -585,7 +585,7 @@ pub const WOPBS_PARAM_MESSAGE_3_CARRY_2_KS_PBS: WopbsParameters = WopbsParameter pub const WOPBS_PARAM_MESSAGE_3_CARRY_1_KS_PBS: WopbsParameters = WopbsParameters { lwe_dimension: LweDimension(486), glwe_dimension: GlweDimension(3), - polynomial_size: PolynomialSize(512), + polynomial_size: PolynomialSize::new(512), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 0.00055853990682276860028, )), @@ -611,7 +611,7 @@ pub const WOPBS_PARAM_MESSAGE_3_CARRY_1_KS_PBS: WopbsParameters = WopbsParameter pub const WOPBS_PARAM_MESSAGE_3_CARRY_0_KS_PBS: WopbsParameters = WopbsParameters { lwe_dimension: LweDimension(487), glwe_dimension: GlweDimension(3), - polynomial_size: PolynomialSize(512), + polynomial_size: PolynomialSize::new(512), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 0.00054842163045222410337, )), @@ -637,7 +637,7 @@ pub const WOPBS_PARAM_MESSAGE_3_CARRY_0_KS_PBS: WopbsParameters = WopbsParameter pub const WOPBS_PARAM_MESSAGE_4_CARRY_4_KS_PBS: WopbsParameters = WopbsParameters { lwe_dimension: LweDimension(953), glwe_dimension: GlweDimension(1), - polynomial_size: PolynomialSize(2048), + polynomial_size: PolynomialSize::new(2048), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 0.0000001486733969411098, )), @@ -663,7 +663,7 @@ pub const WOPBS_PARAM_MESSAGE_4_CARRY_4_KS_PBS: WopbsParameters = WopbsParameter pub const WOPBS_PARAM_MESSAGE_4_CARRY_3_KS_PBS: WopbsParameters = WopbsParameters { lwe_dimension: LweDimension(493), glwe_dimension: GlweDimension(2), - polynomial_size: PolynomialSize(1024), + polynomial_size: PolynomialSize::new(1024), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 0.00049144710341316649172, )), @@ -689,7 +689,7 @@ pub const WOPBS_PARAM_MESSAGE_4_CARRY_3_KS_PBS: WopbsParameters = WopbsParameter pub const WOPBS_PARAM_MESSAGE_4_CARRY_5_KS_PBS: WopbsParameters = WopbsParameters { lwe_dimension: LweDimension(481), glwe_dimension: GlweDimension(2), - polynomial_size: PolynomialSize(1024), + polynomial_size: PolynomialSize::new(1024), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 0.00061200133780220371345, )), @@ -715,7 +715,7 @@ pub const WOPBS_PARAM_MESSAGE_4_CARRY_5_KS_PBS: WopbsParameters = WopbsParameter pub const WOPBS_PARAM_MESSAGE_4_CARRY_2_KS_PBS: WopbsParameters = WopbsParameters { lwe_dimension: LweDimension(497), glwe_dimension: GlweDimension(2), - polynomial_size: PolynomialSize(1024), + polynomial_size: PolynomialSize::new(1024), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 0.00045679174732062467505, )), @@ -741,7 +741,7 @@ pub const WOPBS_PARAM_MESSAGE_4_CARRY_2_KS_PBS: WopbsParameters = WopbsParameter pub const WOPBS_PARAM_MESSAGE_4_CARRY_1_KS_PBS: WopbsParameters = WopbsParameters { lwe_dimension: LweDimension(486), glwe_dimension: GlweDimension(3), - polynomial_size: PolynomialSize(512), + polynomial_size: PolynomialSize::new(512), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 0.00055853990682276860028, )), @@ -767,7 +767,7 @@ pub const WOPBS_PARAM_MESSAGE_4_CARRY_1_KS_PBS: WopbsParameters = WopbsParameter pub const WOPBS_PARAM_MESSAGE_4_CARRY_0_KS_PBS: WopbsParameters = WopbsParameters { lwe_dimension: LweDimension(486), glwe_dimension: GlweDimension(3), - polynomial_size: PolynomialSize(512), + polynomial_size: PolynomialSize::new(512), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 0.00055853990682276860028, )), @@ -793,7 +793,7 @@ pub const WOPBS_PARAM_MESSAGE_4_CARRY_0_KS_PBS: WopbsParameters = WopbsParameter pub const WOPBS_PARAM_MESSAGE_5_CARRY_3_KS_PBS: WopbsParameters = WopbsParameters { lwe_dimension: LweDimension(481), glwe_dimension: GlweDimension(2), - polynomial_size: PolynomialSize(1024), + polynomial_size: PolynomialSize::new(1024), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 0.00061200133780220371345, )), @@ -819,7 +819,7 @@ pub const WOPBS_PARAM_MESSAGE_5_CARRY_3_KS_PBS: WopbsParameters = WopbsParameter pub const WOPBS_PARAM_MESSAGE_5_CARRY_4_KS_PBS: WopbsParameters = WopbsParameters { lwe_dimension: LweDimension(481), glwe_dimension: GlweDimension(2), - polynomial_size: PolynomialSize(1024), + polynomial_size: PolynomialSize::new(1024), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 0.00061200133780220371345, )), @@ -845,7 +845,7 @@ pub const WOPBS_PARAM_MESSAGE_5_CARRY_4_KS_PBS: WopbsParameters = WopbsParameter pub const WOPBS_PARAM_MESSAGE_5_CARRY_2_KS_PBS: WopbsParameters = WopbsParameters { lwe_dimension: LweDimension(493), glwe_dimension: GlweDimension(2), - polynomial_size: PolynomialSize(1024), + polynomial_size: PolynomialSize::new(1024), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 0.00049144710341316649172, )), @@ -871,7 +871,7 @@ pub const WOPBS_PARAM_MESSAGE_5_CARRY_2_KS_PBS: WopbsParameters = WopbsParameter pub const WOPBS_PARAM_MESSAGE_5_CARRY_1_KS_PBS: WopbsParameters = WopbsParameters { lwe_dimension: LweDimension(497), glwe_dimension: GlweDimension(2), - polynomial_size: PolynomialSize(1024), + polynomial_size: PolynomialSize::new(1024), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 0.00045679174732062467505, )), @@ -897,7 +897,7 @@ pub const WOPBS_PARAM_MESSAGE_5_CARRY_1_KS_PBS: WopbsParameters = WopbsParameter pub const WOPBS_PARAM_MESSAGE_5_CARRY_0_KS_PBS: WopbsParameters = WopbsParameters { lwe_dimension: LweDimension(486), glwe_dimension: GlweDimension(3), - polynomial_size: PolynomialSize(512), + polynomial_size: PolynomialSize::new(512), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 0.00055853990682276860028, )), @@ -923,7 +923,7 @@ pub const WOPBS_PARAM_MESSAGE_5_CARRY_0_KS_PBS: WopbsParameters = WopbsParameter pub const WOPBS_PARAM_MESSAGE_6_CARRY_3_KS_PBS: WopbsParameters = WopbsParameters { lwe_dimension: LweDimension(481), glwe_dimension: GlweDimension(2), - polynomial_size: PolynomialSize(1024), + polynomial_size: PolynomialSize::new(1024), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 0.00061200133780220371345, )), @@ -949,7 +949,7 @@ pub const WOPBS_PARAM_MESSAGE_6_CARRY_3_KS_PBS: WopbsParameters = WopbsParameter pub const WOPBS_PARAM_MESSAGE_6_CARRY_2_KS_PBS: WopbsParameters = WopbsParameters { lwe_dimension: LweDimension(493), glwe_dimension: GlweDimension(2), - polynomial_size: PolynomialSize(1024), + polynomial_size: PolynomialSize::new(1024), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 0.00049144710341316649172, )), @@ -975,7 +975,7 @@ pub const WOPBS_PARAM_MESSAGE_6_CARRY_2_KS_PBS: WopbsParameters = WopbsParameter pub const WOPBS_PARAM_MESSAGE_6_CARRY_1_KS_PBS: WopbsParameters = WopbsParameters { lwe_dimension: LweDimension(497), glwe_dimension: GlweDimension(2), - polynomial_size: PolynomialSize(1024), + polynomial_size: PolynomialSize::new(1024), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 0.00045679174732062467505, )), @@ -1001,7 +1001,7 @@ pub const WOPBS_PARAM_MESSAGE_6_CARRY_1_KS_PBS: WopbsParameters = WopbsParameter pub const WOPBS_PARAM_MESSAGE_6_CARRY_0_KS_PBS: WopbsParameters = WopbsParameters { lwe_dimension: LweDimension(486), glwe_dimension: GlweDimension(3), - polynomial_size: PolynomialSize(512), + polynomial_size: PolynomialSize::new(512), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 0.00055853990682276860028, )), @@ -1027,7 +1027,7 @@ pub const WOPBS_PARAM_MESSAGE_6_CARRY_0_KS_PBS: WopbsParameters = WopbsParameter pub const WOPBS_PARAM_MESSAGE_7_CARRY_2_KS_PBS: WopbsParameters = WopbsParameters { lwe_dimension: LweDimension(481), glwe_dimension: GlweDimension(2), - polynomial_size: PolynomialSize(1024), + polynomial_size: PolynomialSize::new(1024), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 0.00061200133780220371345, )), @@ -1053,7 +1053,7 @@ pub const WOPBS_PARAM_MESSAGE_7_CARRY_2_KS_PBS: WopbsParameters = WopbsParameter pub const WOPBS_PARAM_MESSAGE_7_CARRY_1_KS_PBS: WopbsParameters = WopbsParameters { lwe_dimension: LweDimension(493), glwe_dimension: GlweDimension(2), - polynomial_size: PolynomialSize(1024), + polynomial_size: PolynomialSize::new(1024), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 0.00049144710341316649172, )), @@ -1079,7 +1079,7 @@ pub const WOPBS_PARAM_MESSAGE_7_CARRY_1_KS_PBS: WopbsParameters = WopbsParameter pub const WOPBS_PARAM_MESSAGE_7_CARRY_0_KS_PBS: WopbsParameters = WopbsParameters { lwe_dimension: LweDimension(497), glwe_dimension: GlweDimension(2), - polynomial_size: PolynomialSize(1024), + polynomial_size: PolynomialSize::new(1024), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 0.00045679174732062467505, )), @@ -1105,7 +1105,7 @@ pub const WOPBS_PARAM_MESSAGE_7_CARRY_0_KS_PBS: WopbsParameters = WopbsParameter pub const WOPBS_PARAM_MESSAGE_8_CARRY_1_KS_PBS: WopbsParameters = WopbsParameters { lwe_dimension: LweDimension(493), glwe_dimension: GlweDimension(2), - polynomial_size: PolynomialSize(1024), + polynomial_size: PolynomialSize::new(1024), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 0.00049144710341316649172, )), @@ -1131,7 +1131,7 @@ pub const WOPBS_PARAM_MESSAGE_8_CARRY_1_KS_PBS: WopbsParameters = WopbsParameter pub const WOPBS_PARAM_MESSAGE_8_CARRY_0_KS_PBS: WopbsParameters = WopbsParameters { lwe_dimension: LweDimension(497), glwe_dimension: GlweDimension(2), - polynomial_size: PolynomialSize(1024), + polynomial_size: PolynomialSize::new(1024), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 0.00045679174732062467505, )), diff --git a/tfhe/src/shortint/parameters/parameters_wopbs_only.rs b/tfhe/src/shortint/parameters/parameters_wopbs_only.rs index 10261bcdf6..8a147bf1ff 100644 --- a/tfhe/src/shortint/parameters/parameters_wopbs_only.rs +++ b/tfhe/src/shortint/parameters/parameters_wopbs_only.rs @@ -11,7 +11,7 @@ use crate::shortint::parameters::{ pub const WOPBS_ONLY_8_BLOCKS_PARAM_MESSAGE_1_CARRY_0_KS_PBS: WopbsParameters = WopbsParameters { lwe_dimension: LweDimension(637), glwe_dimension: GlweDimension(4), - polynomial_size: PolynomialSize(512), + polynomial_size: PolynomialSize::new(512), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 6.27510880527384e-05, )), @@ -37,7 +37,7 @@ pub const WOPBS_ONLY_8_BLOCKS_PARAM_MESSAGE_1_CARRY_0_KS_PBS: WopbsParameters = pub const WOPBS_ONLY_8_BLOCKS_PARAM_MESSAGE_1_CARRY_1_KS_PBS: WopbsParameters = WopbsParameters { lwe_dimension: LweDimension(637), glwe_dimension: GlweDimension(4), - polynomial_size: PolynomialSize(512), + polynomial_size: PolynomialSize::new(512), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 6.27510880527384e-05, )), @@ -63,7 +63,7 @@ pub const WOPBS_ONLY_8_BLOCKS_PARAM_MESSAGE_1_CARRY_1_KS_PBS: WopbsParameters = pub const WOPBS_ONLY_4_BLOCKS_PARAM_MESSAGE_1_CARRY_2_KS_PBS: WopbsParameters = WopbsParameters { lwe_dimension: LweDimension(589), glwe_dimension: GlweDimension(2), - polynomial_size: PolynomialSize(1024), + polynomial_size: PolynomialSize::new(1024), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 0.00015133150634020836, )), @@ -89,7 +89,7 @@ pub const WOPBS_ONLY_4_BLOCKS_PARAM_MESSAGE_1_CARRY_2_KS_PBS: WopbsParameters = pub const WOPBS_ONLY_4_BLOCKS_PARAM_MESSAGE_1_CARRY_3_KS_PBS: WopbsParameters = WopbsParameters { lwe_dimension: LweDimension(589), glwe_dimension: GlweDimension(2), - polynomial_size: PolynomialSize(1024), + polynomial_size: PolynomialSize::new(1024), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 0.00015133150634020836, )), @@ -115,7 +115,7 @@ pub const WOPBS_ONLY_4_BLOCKS_PARAM_MESSAGE_1_CARRY_3_KS_PBS: WopbsParameters = pub const WOPBS_ONLY_2_BLOCKS_PARAM_MESSAGE_1_CARRY_4_KS_PBS: WopbsParameters = WopbsParameters { lwe_dimension: LweDimension(568), glwe_dimension: GlweDimension(2), - polynomial_size: PolynomialSize(1024), + polynomial_size: PolynomialSize::new(1024), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 0.00022310338140366212, )), @@ -141,7 +141,7 @@ pub const WOPBS_ONLY_2_BLOCKS_PARAM_MESSAGE_1_CARRY_4_KS_PBS: WopbsParameters = pub const WOPBS_ONLY_2_BLOCKS_PARAM_MESSAGE_1_CARRY_5_KS_PBS: WopbsParameters = WopbsParameters { lwe_dimension: LweDimension(568), glwe_dimension: GlweDimension(2), - polynomial_size: PolynomialSize(1024), + polynomial_size: PolynomialSize::new(1024), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 0.00022310338140366212, )), @@ -167,7 +167,7 @@ pub const WOPBS_ONLY_2_BLOCKS_PARAM_MESSAGE_1_CARRY_5_KS_PBS: WopbsParameters = pub const WOPBS_ONLY_2_BLOCKS_PARAM_MESSAGE_1_CARRY_6_KS_PBS: WopbsParameters = WopbsParameters { lwe_dimension: LweDimension(568), glwe_dimension: GlweDimension(2), - polynomial_size: PolynomialSize(1024), + polynomial_size: PolynomialSize::new(1024), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 0.00022310338140366212, )), @@ -193,7 +193,7 @@ pub const WOPBS_ONLY_2_BLOCKS_PARAM_MESSAGE_1_CARRY_6_KS_PBS: WopbsParameters = pub const WOPBS_ONLY_2_BLOCKS_PARAM_MESSAGE_1_CARRY_7_KS_PBS: WopbsParameters = WopbsParameters { lwe_dimension: LweDimension(568), glwe_dimension: GlweDimension(2), - polynomial_size: PolynomialSize(1024), + polynomial_size: PolynomialSize::new(1024), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 0.00022310338140366212, )), @@ -219,7 +219,7 @@ pub const WOPBS_ONLY_2_BLOCKS_PARAM_MESSAGE_1_CARRY_7_KS_PBS: WopbsParameters = pub const WOPBS_ONLY_8_BLOCKS_PARAM_MESSAGE_2_CARRY_0_KS_PBS: WopbsParameters = WopbsParameters { lwe_dimension: LweDimension(637), glwe_dimension: GlweDimension(4), - polynomial_size: PolynomialSize(512), + polynomial_size: PolynomialSize::new(512), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 6.27510880527384e-05, )), @@ -245,7 +245,7 @@ pub const WOPBS_ONLY_8_BLOCKS_PARAM_MESSAGE_2_CARRY_0_KS_PBS: WopbsParameters = pub const WOPBS_ONLY_4_BLOCKS_PARAM_MESSAGE_2_CARRY_1_KS_PBS: WopbsParameters = WopbsParameters { lwe_dimension: LweDimension(589), glwe_dimension: GlweDimension(2), - polynomial_size: PolynomialSize(1024), + polynomial_size: PolynomialSize::new(1024), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 0.00015133150634020836, )), @@ -271,7 +271,7 @@ pub const WOPBS_ONLY_4_BLOCKS_PARAM_MESSAGE_2_CARRY_1_KS_PBS: WopbsParameters = pub const WOPBS_ONLY_4_BLOCKS_PARAM_MESSAGE_2_CARRY_2_KS_PBS: WopbsParameters = WopbsParameters { lwe_dimension: LweDimension(589), glwe_dimension: GlweDimension(2), - polynomial_size: PolynomialSize(1024), + polynomial_size: PolynomialSize::new(1024), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 0.00015133150634020836, )), @@ -297,7 +297,7 @@ pub const WOPBS_ONLY_4_BLOCKS_PARAM_MESSAGE_2_CARRY_2_KS_PBS: WopbsParameters = pub const WOPBS_ONLY_2_BLOCKS_PARAM_MESSAGE_2_CARRY_3_KS_PBS: WopbsParameters = WopbsParameters { lwe_dimension: LweDimension(568), glwe_dimension: GlweDimension(2), - polynomial_size: PolynomialSize(1024), + polynomial_size: PolynomialSize::new(1024), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 0.00022310338140366212, )), @@ -323,7 +323,7 @@ pub const WOPBS_ONLY_2_BLOCKS_PARAM_MESSAGE_2_CARRY_3_KS_PBS: WopbsParameters = pub const WOPBS_ONLY_2_BLOCKS_PARAM_MESSAGE_2_CARRY_4_KS_PBS: WopbsParameters = WopbsParameters { lwe_dimension: LweDimension(568), glwe_dimension: GlweDimension(2), - polynomial_size: PolynomialSize(1024), + polynomial_size: PolynomialSize::new(1024), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 0.00022310338140366212, )), @@ -349,7 +349,7 @@ pub const WOPBS_ONLY_2_BLOCKS_PARAM_MESSAGE_2_CARRY_4_KS_PBS: WopbsParameters = pub const WOPBS_ONLY_2_BLOCKS_PARAM_MESSAGE_2_CARRY_5_KS_PBS: WopbsParameters = WopbsParameters { lwe_dimension: LweDimension(568), glwe_dimension: GlweDimension(2), - polynomial_size: PolynomialSize(1024), + polynomial_size: PolynomialSize::new(1024), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 0.00022310338140366212, )), @@ -375,7 +375,7 @@ pub const WOPBS_ONLY_2_BLOCKS_PARAM_MESSAGE_2_CARRY_5_KS_PBS: WopbsParameters = pub const WOPBS_ONLY_2_BLOCKS_PARAM_MESSAGE_2_CARRY_6_KS_PBS: WopbsParameters = WopbsParameters { lwe_dimension: LweDimension(568), glwe_dimension: GlweDimension(2), - polynomial_size: PolynomialSize(1024), + polynomial_size: PolynomialSize::new(1024), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 0.00022310338140366212, )), @@ -401,7 +401,7 @@ pub const WOPBS_ONLY_2_BLOCKS_PARAM_MESSAGE_2_CARRY_6_KS_PBS: WopbsParameters = pub const WOPBS_ONLY_4_BLOCKS_PARAM_MESSAGE_3_CARRY_0_KS_PBS: WopbsParameters = WopbsParameters { lwe_dimension: LweDimension(589), glwe_dimension: GlweDimension(2), - polynomial_size: PolynomialSize(1024), + polynomial_size: PolynomialSize::new(1024), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 0.00015133150634020836, )), @@ -427,7 +427,7 @@ pub const WOPBS_ONLY_4_BLOCKS_PARAM_MESSAGE_3_CARRY_0_KS_PBS: WopbsParameters = pub const WOPBS_ONLY_4_BLOCKS_PARAM_MESSAGE_3_CARRY_1_KS_PBS: WopbsParameters = WopbsParameters { lwe_dimension: LweDimension(589), glwe_dimension: GlweDimension(2), - polynomial_size: PolynomialSize(1024), + polynomial_size: PolynomialSize::new(1024), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 0.00015133150634020836, )), @@ -453,7 +453,7 @@ pub const WOPBS_ONLY_4_BLOCKS_PARAM_MESSAGE_3_CARRY_1_KS_PBS: WopbsParameters = pub const WOPBS_ONLY_2_BLOCKS_PARAM_MESSAGE_3_CARRY_2_KS_PBS: WopbsParameters = WopbsParameters { lwe_dimension: LweDimension(568), glwe_dimension: GlweDimension(2), - polynomial_size: PolynomialSize(1024), + polynomial_size: PolynomialSize::new(1024), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 0.00022310338140366212, )), @@ -479,7 +479,7 @@ pub const WOPBS_ONLY_2_BLOCKS_PARAM_MESSAGE_3_CARRY_2_KS_PBS: WopbsParameters = pub const WOPBS_ONLY_2_BLOCKS_PARAM_MESSAGE_3_CARRY_3_KS_PBS: WopbsParameters = WopbsParameters { lwe_dimension: LweDimension(568), glwe_dimension: GlweDimension(2), - polynomial_size: PolynomialSize(1024), + polynomial_size: PolynomialSize::new(1024), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 0.00022310338140366212, )), @@ -505,7 +505,7 @@ pub const WOPBS_ONLY_2_BLOCKS_PARAM_MESSAGE_3_CARRY_3_KS_PBS: WopbsParameters = pub const WOPBS_ONLY_2_BLOCKS_PARAM_MESSAGE_3_CARRY_4_KS_PBS: WopbsParameters = WopbsParameters { lwe_dimension: LweDimension(568), glwe_dimension: GlweDimension(2), - polynomial_size: PolynomialSize(1024), + polynomial_size: PolynomialSize::new(1024), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 0.00022310338140366212, )), @@ -531,7 +531,7 @@ pub const WOPBS_ONLY_2_BLOCKS_PARAM_MESSAGE_3_CARRY_4_KS_PBS: WopbsParameters = pub const WOPBS_ONLY_2_BLOCKS_PARAM_MESSAGE_3_CARRY_5_KS_PBS: WopbsParameters = WopbsParameters { lwe_dimension: LweDimension(568), glwe_dimension: GlweDimension(2), - polynomial_size: PolynomialSize(1024), + polynomial_size: PolynomialSize::new(1024), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 0.00022310338140366212, )), @@ -557,7 +557,7 @@ pub const WOPBS_ONLY_2_BLOCKS_PARAM_MESSAGE_3_CARRY_5_KS_PBS: WopbsParameters = pub const WOPBS_ONLY_4_BLOCKS_PARAM_MESSAGE_4_CARRY_0_KS_PBS: WopbsParameters = WopbsParameters { lwe_dimension: LweDimension(589), glwe_dimension: GlweDimension(2), - polynomial_size: PolynomialSize(1024), + polynomial_size: PolynomialSize::new(1024), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 0.00015133150634020836, )), @@ -583,7 +583,7 @@ pub const WOPBS_ONLY_4_BLOCKS_PARAM_MESSAGE_4_CARRY_0_KS_PBS: WopbsParameters = pub const WOPBS_ONLY_2_BLOCKS_PARAM_MESSAGE_4_CARRY_1_KS_PBS: WopbsParameters = WopbsParameters { lwe_dimension: LweDimension(568), glwe_dimension: GlweDimension(2), - polynomial_size: PolynomialSize(1024), + polynomial_size: PolynomialSize::new(1024), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 0.00022310338140366212, )), @@ -609,7 +609,7 @@ pub const WOPBS_ONLY_2_BLOCKS_PARAM_MESSAGE_4_CARRY_1_KS_PBS: WopbsParameters = pub const WOPBS_ONLY_2_BLOCKS_PARAM_MESSAGE_4_CARRY_2_KS_PBS: WopbsParameters = WopbsParameters { lwe_dimension: LweDimension(568), glwe_dimension: GlweDimension(2), - polynomial_size: PolynomialSize(1024), + polynomial_size: PolynomialSize::new(1024), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 0.00022310338140366212, )), @@ -635,7 +635,7 @@ pub const WOPBS_ONLY_2_BLOCKS_PARAM_MESSAGE_4_CARRY_2_KS_PBS: WopbsParameters = pub const WOPBS_ONLY_2_BLOCKS_PARAM_MESSAGE_4_CARRY_3_KS_PBS: WopbsParameters = WopbsParameters { lwe_dimension: LweDimension(568), glwe_dimension: GlweDimension(2), - polynomial_size: PolynomialSize(1024), + polynomial_size: PolynomialSize::new(1024), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 0.00022310338140366212, )), @@ -661,7 +661,7 @@ pub const WOPBS_ONLY_2_BLOCKS_PARAM_MESSAGE_4_CARRY_3_KS_PBS: WopbsParameters = pub const WOPBS_ONLY_2_BLOCKS_PARAM_MESSAGE_4_CARRY_4_KS_PBS: WopbsParameters = WopbsParameters { lwe_dimension: LweDimension(568), glwe_dimension: GlweDimension(2), - polynomial_size: PolynomialSize(1024), + polynomial_size: PolynomialSize::new(1024), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 0.00022310338140366212, )), @@ -687,7 +687,7 @@ pub const WOPBS_ONLY_2_BLOCKS_PARAM_MESSAGE_4_CARRY_4_KS_PBS: WopbsParameters = pub const WOPBS_ONLY_2_BLOCKS_PARAM_MESSAGE_5_CARRY_0_KS_PBS: WopbsParameters = WopbsParameters { lwe_dimension: LweDimension(568), glwe_dimension: GlweDimension(2), - polynomial_size: PolynomialSize(1024), + polynomial_size: PolynomialSize::new(1024), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 0.00022310338140366212, )), @@ -713,7 +713,7 @@ pub const WOPBS_ONLY_2_BLOCKS_PARAM_MESSAGE_5_CARRY_0_KS_PBS: WopbsParameters = pub const WOPBS_ONLY_2_BLOCKS_PARAM_MESSAGE_5_CARRY_1_KS_PBS: WopbsParameters = WopbsParameters { lwe_dimension: LweDimension(568), glwe_dimension: GlweDimension(2), - polynomial_size: PolynomialSize(1024), + polynomial_size: PolynomialSize::new(1024), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 0.00022310338140366212, )), @@ -739,7 +739,7 @@ pub const WOPBS_ONLY_2_BLOCKS_PARAM_MESSAGE_5_CARRY_1_KS_PBS: WopbsParameters = pub const WOPBS_ONLY_2_BLOCKS_PARAM_MESSAGE_5_CARRY_2_KS_PBS: WopbsParameters = WopbsParameters { lwe_dimension: LweDimension(568), glwe_dimension: GlweDimension(2), - polynomial_size: PolynomialSize(1024), + polynomial_size: PolynomialSize::new(1024), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 0.00022310338140366212, )), @@ -765,7 +765,7 @@ pub const WOPBS_ONLY_2_BLOCKS_PARAM_MESSAGE_5_CARRY_2_KS_PBS: WopbsParameters = pub const WOPBS_ONLY_2_BLOCKS_PARAM_MESSAGE_5_CARRY_3_KS_PBS: WopbsParameters = WopbsParameters { lwe_dimension: LweDimension(568), glwe_dimension: GlweDimension(2), - polynomial_size: PolynomialSize(1024), + polynomial_size: PolynomialSize::new(1024), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 0.00022310338140366212, )), @@ -791,7 +791,7 @@ pub const WOPBS_ONLY_2_BLOCKS_PARAM_MESSAGE_5_CARRY_3_KS_PBS: WopbsParameters = pub const WOPBS_ONLY_2_BLOCKS_PARAM_MESSAGE_6_CARRY_0_KS_PBS: WopbsParameters = WopbsParameters { lwe_dimension: LweDimension(568), glwe_dimension: GlweDimension(2), - polynomial_size: PolynomialSize(1024), + polynomial_size: PolynomialSize::new(1024), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 0.00022310338140366212, )), @@ -817,7 +817,7 @@ pub const WOPBS_ONLY_2_BLOCKS_PARAM_MESSAGE_6_CARRY_0_KS_PBS: WopbsParameters = pub const WOPBS_ONLY_2_BLOCKS_PARAM_MESSAGE_6_CARRY_1_KS_PBS: WopbsParameters = WopbsParameters { lwe_dimension: LweDimension(568), glwe_dimension: GlweDimension(2), - polynomial_size: PolynomialSize(1024), + polynomial_size: PolynomialSize::new(1024), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 0.00022310338140366212, )), @@ -843,7 +843,7 @@ pub const WOPBS_ONLY_2_BLOCKS_PARAM_MESSAGE_6_CARRY_1_KS_PBS: WopbsParameters = pub const WOPBS_ONLY_2_BLOCKS_PARAM_MESSAGE_6_CARRY_2_KS_PBS: WopbsParameters = WopbsParameters { lwe_dimension: LweDimension(568), glwe_dimension: GlweDimension(2), - polynomial_size: PolynomialSize(1024), + polynomial_size: PolynomialSize::new(1024), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 0.00022310338140366212, )), @@ -869,7 +869,7 @@ pub const WOPBS_ONLY_2_BLOCKS_PARAM_MESSAGE_6_CARRY_2_KS_PBS: WopbsParameters = pub const WOPBS_ONLY_2_BLOCKS_PARAM_MESSAGE_7_CARRY_0_KS_PBS: WopbsParameters = WopbsParameters { lwe_dimension: LweDimension(568), glwe_dimension: GlweDimension(2), - polynomial_size: PolynomialSize(1024), + polynomial_size: PolynomialSize::new(1024), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 0.00022310338140366212, )), @@ -895,7 +895,7 @@ pub const WOPBS_ONLY_2_BLOCKS_PARAM_MESSAGE_7_CARRY_0_KS_PBS: WopbsParameters = pub const WOPBS_ONLY_2_BLOCKS_PARAM_MESSAGE_7_CARRY_1_KS_PBS: WopbsParameters = WopbsParameters { lwe_dimension: LweDimension(568), glwe_dimension: GlweDimension(2), - polynomial_size: PolynomialSize(1024), + polynomial_size: PolynomialSize::new(1024), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 0.00022310338140366212, )), @@ -921,7 +921,7 @@ pub const WOPBS_ONLY_2_BLOCKS_PARAM_MESSAGE_7_CARRY_1_KS_PBS: WopbsParameters = pub const WOPBS_ONLY_2_BLOCKS_PARAM_MESSAGE_8_CARRY_0_KS_PBS: WopbsParameters = WopbsParameters { lwe_dimension: LweDimension(568), glwe_dimension: GlweDimension(2), - polynomial_size: PolynomialSize(1024), + polynomial_size: PolynomialSize::new(1024), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 0.00022310338140366212, )), diff --git a/tfhe/tests/backward_compatibility/shortint.rs b/tfhe/tests/backward_compatibility/shortint.rs index 0f267e6d28..08c506305a 100644 --- a/tfhe/tests/backward_compatibility/shortint.rs +++ b/tfhe/tests/backward_compatibility/shortint.rs @@ -27,7 +27,7 @@ pub fn load_params(test_params: &TestParameterSet) -> ClassicPBSParameters { ClassicPBSParameters { lwe_dimension: LweDimension(test_params.lwe_dimension), glwe_dimension: GlweDimension(test_params.glwe_dimension), - polynomial_size: PolynomialSize(test_params.polynomial_size), + polynomial_size: PolynomialSize::new(test_params.polynomial_size), lwe_noise_distribution: convert_distribution(&test_params.lwe_noise_distribution), glwe_noise_distribution: convert_distribution(&test_params.glwe_noise_distribution), pbs_base_log: DecompositionBaseLog(test_params.pbs_base_log),