pub struct LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeys32(/* private fields */);Expand description
A structure representing a vector of private functional packing keyswitch keys used for a circuit bootsrap with 32 bits of precision.
Trait Implementations§
Source§impl AbstractEntity for LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeys32
impl AbstractEntity for LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeys32
Source§type Kind = LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeysKind
type Kind = LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeysKind
Source§impl Clone for LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeys32
impl Clone for LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeys32
Source§fn clone(&self) -> LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeys32
fn clone(&self) -> LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeys32
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl EntityDeserializationEngine<&[u8], LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeys32> for DefaultSerializationEngine
§Description:
Implementation of EntityDeserializationEngine for DefaultSerializationEngine that
operates on 32 bits integers. It deserializes an LWE circuit bootstrap private functional
packing keyswitch vector.
impl EntityDeserializationEngine<&[u8], LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeys32> for DefaultSerializationEngine
§Description:
Implementation of EntityDeserializationEngine for DefaultSerializationEngine that
operates on 32 bits integers. It deserializes an LWE circuit bootstrap private functional
packing keyswitch vector.
Source§fn deserialize(
&mut self,
serialized: &[u8],
) -> Result<LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeys32, EntityDeserializationError<Self::EngineError>>
fn deserialize( &mut self, serialized: &[u8], ) -> Result<LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeys32, EntityDeserializationError<Self::EngineError>>
§Example:
use concrete_core::prelude::{
DecompositionBaseLog, DecompositionLevelCount, FunctionalPackingKeyswitchKeyCount,
GlweDimension, LweDimension, Variance, *,
};
// DISCLAIMER: the parameters used here are only for test purpose, and are not secure.
let input_lwe_dimension = LweDimension(10);
let output_glwe_dimension = GlweDimension(3);
let polynomial_size = PolynomialSize(256);
let decomposition_base_log = DecompositionBaseLog(3);
let decomposition_level_count = DecompositionLevelCount(5);
let noise = Variance(2_f64.powf(-25.));
// Unix seeder must be given a secret input.
// Here we just give it 0, which is totally unsafe.
const UNSAFE_SECRET: u128 = 0;
let mut engine = DefaultEngine::new(Box::new(UnixSeeder::new(UNSAFE_SECRET)))?;
let input_key: LweSecretKey32 = engine.generate_new_lwe_secret_key(input_lwe_dimension)?;
let output_key: GlweSecretKey32 =
engine.generate_new_glwe_secret_key(output_glwe_dimension, polynomial_size)?;
let cbs_private_functional_packing_keyswitch_key:
LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeys32 =
engine
.generate_new_lwe_circuit_bootstrap_private_functional_packing_keyswitch_keys(
&input_key,
&output_key,
decomposition_base_log,
decomposition_level_count,
noise,
)?;
let mut serialization_engine = DefaultSerializationEngine::new(())?;
let serialized =
serialization_engine.serialize(&cbs_private_functional_packing_keyswitch_key)?;
let recovered = serialization_engine.deserialize(serialized.as_slice())?;
assert_eq!(cbs_private_functional_packing_keyswitch_key, recovered);
Source§unsafe fn deserialize_unchecked(
&mut self,
serialized: &[u8],
) -> LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeys32
unsafe fn deserialize_unchecked( &mut self, serialized: &[u8], ) -> LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeys32
Source§impl EntitySerializationEngine<LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeys32, Vec<u8>> for DefaultSerializationEngine
§Description:
Implementation of EntitySerializationEngine for DefaultSerializationEngine that operates
on 32 bits integers. It serializes an LWE circuit bootstrap private functional packing keyswitch
vector.
impl EntitySerializationEngine<LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeys32, Vec<u8>> for DefaultSerializationEngine
§Description:
Implementation of EntitySerializationEngine for DefaultSerializationEngine that operates
on 32 bits integers. It serializes an LWE circuit bootstrap private functional packing keyswitch
vector.
Source§fn serialize(
&mut self,
entity: &LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeys32,
) -> Result<Vec<u8>, EntitySerializationError<Self::EngineError>>
fn serialize( &mut self, entity: &LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeys32, ) -> Result<Vec<u8>, EntitySerializationError<Self::EngineError>>
§Example:
use concrete_core::prelude::{
DecompositionBaseLog, DecompositionLevelCount, FunctionalPackingKeyswitchKeyCount,
GlweDimension, LweDimension, Variance, *,
};
// DISCLAIMER: the parameters used here are only for test purpose, and are not secure.
let input_lwe_dimension = LweDimension(10);
let output_glwe_dimension = GlweDimension(3);
let polynomial_size = PolynomialSize(256);
let decomposition_base_log = DecompositionBaseLog(3);
let decomposition_level_count = DecompositionLevelCount(5);
let noise = Variance(2_f64.powf(-25.));
// Unix seeder must be given a secret input.
// Here we just give it 0, which is totally unsafe.
const UNSAFE_SECRET: u128 = 0;
let mut engine = DefaultEngine::new(Box::new(UnixSeeder::new(UNSAFE_SECRET)))?;
let input_key: LweSecretKey32 = engine.generate_new_lwe_secret_key(input_lwe_dimension)?;
let output_key: GlweSecretKey32 =
engine.generate_new_glwe_secret_key(output_glwe_dimension, polynomial_size)?;
let cbs_private_functional_packing_keyswitch_key:
LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeys32 =
engine
.generate_new_lwe_circuit_bootstrap_private_functional_packing_keyswitch_keys(
&input_key,
&output_key,
decomposition_base_log,
decomposition_level_count,
noise,
)?;
let mut serialization_engine = DefaultSerializationEngine::new(())?;
let serialized =
serialization_engine.serialize(&cbs_private_functional_packing_keyswitch_key)?;
let recovered = serialization_engine.deserialize(serialized.as_slice())?;
assert_eq!(cbs_private_functional_packing_keyswitch_key, recovered);
Source§unsafe fn serialize_unchecked(
&mut self,
entity: &LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeys32,
) -> Vec<u8> ⓘ
unsafe fn serialize_unchecked( &mut self, entity: &LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeys32, ) -> Vec<u8> ⓘ
Source§impl LweCiphertextDiscardingCircuitBootstrapBooleanEngine<LweCiphertext32, GgswCiphertext32, FftFourierLweBootstrapKey32, LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeys32> for FftEngine
§Description:
Implementation of LweCiphertextDiscardingCircuitBootstrapBooleanEngine for FftEngine
that operates on 32 bits integers.
impl LweCiphertextDiscardingCircuitBootstrapBooleanEngine<LweCiphertext32, GgswCiphertext32, FftFourierLweBootstrapKey32, LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeys32> for FftEngine
§Description:
Implementation of LweCiphertextDiscardingCircuitBootstrapBooleanEngine for FftEngine
that operates on 32 bits integers.
Source§fn discard_circuit_bootstrap_boolean_lwe_ciphertext(
&mut self,
output: &mut GgswCiphertext32,
input: &LweCiphertext32,
delta_log: DeltaLog,
bsk: &FftFourierLweBootstrapKey32,
cbs_pfpksk: &LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeys32,
) -> Result<(), LweCiphertextDiscardingCircuitBootstrapBooleanError<Self::EngineError>>
fn discard_circuit_bootstrap_boolean_lwe_ciphertext( &mut self, output: &mut GgswCiphertext32, input: &LweCiphertext32, delta_log: DeltaLog, bsk: &FftFourierLweBootstrapKey32, cbs_pfpksk: &LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeys32, ) -> Result<(), LweCiphertextDiscardingCircuitBootstrapBooleanError<Self::EngineError>>
§Example
use concrete_core::prelude::*;
// Define settings for an insecure toy example
let polynomial_size = PolynomialSize(512);
let glwe_dimension = GlweDimension(2);
let small_lwe_dimension = LweDimension(10);
// The following sets of decomposition parameters are independant and can be adapted for
// your use case, having identical parameters for some of them here is a coincidence
let level_bsk = DecompositionLevelCount(2);
let base_log_bsk = DecompositionBaseLog(15);
let level_pfpksk = DecompositionLevelCount(2);
let base_log_pfpksk = DecompositionBaseLog(15);
let level_count_cbs = DecompositionLevelCount(1);
let base_log_cbs = DecompositionBaseLog(10);
let std = LogStandardDev::from_log_standard_dev(-60.);
let noise = Variance(std.get_variance());
const UNSAFE_SECRET: u128 = 0;
let mut default_engine = DefaultEngine::new(Box::new(UnixSeeder::new(UNSAFE_SECRET)))?;
let mut default_parallel_engine = DefaultEngine::new(Box::new(UnixSeeder::new(UNSAFE_SECRET)))?;
let mut fft_engine = FftEngine::new(())?;
let glwe_sk: GlweSecretKey32 =
default_engine.generate_new_glwe_secret_key(glwe_dimension, polynomial_size)?;
let small_lwe_sk: LweSecretKey32 =
default_engine.generate_new_lwe_secret_key(small_lwe_dimension)?;
let big_lwe_sk: LweSecretKey32 =
default_engine.transform_glwe_secret_key_to_lwe_secret_key(glwe_sk.clone())?;
let std_bsk: LweBootstrapKey32 = default_parallel_engine.generate_new_lwe_bootstrap_key(
&small_lwe_sk,
&glwe_sk,
base_log_bsk,
level_bsk,
noise,
)?;
let fbsk: FftFourierLweBootstrapKey32 = fft_engine.convert_lwe_bootstrap_key(&std_bsk)?;
let cbs_pfpksk: LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeys32 = default_engine
.generate_new_lwe_circuit_bootstrap_private_functional_packing_keyswitch_keys(
&big_lwe_sk,
&glwe_sk,
base_log_pfpksk,
level_pfpksk,
noise,
)?;
// delta_log indicates where the information bit is stored in the input LWE ciphertext, here
// we put it in the most significant bit, which corresponds to 2 ^ 31
let delta_log = DeltaLog(31);
let value = 1u32;
// Encryption of 'value' in an LWE ciphertext using delta_log for the encoding
let plaintext: Plaintext32 = default_engine.create_plaintext_from(&(value << delta_log.0))?;
let lwe_in: LweCiphertext32 =
default_engine.encrypt_lwe_ciphertext(&small_lwe_sk, &plaintext, noise)?;
// Create an empty GGSW ciphertext with a trivial encryption of 0
let zero_plaintext: Plaintext32 = default_engine.create_plaintext_from(&0u32)?;
let mut output_ggsw: GgswCiphertext32 = default_engine
.trivially_encrypt_scalar_ggsw_ciphertext(
polynomial_size,
glwe_dimension.to_glwe_size(),
level_count_cbs,
base_log_cbs,
&zero_plaintext,
)?;
fft_engine.discard_circuit_bootstrap_boolean_lwe_ciphertext(
&mut output_ggsw,
&lwe_in,
delta_log,
&fbsk,
&cbs_pfpksk,
)?;
Source§unsafe fn discard_circuit_bootstrap_boolean_lwe_ciphertext_unchecked(
&mut self,
output: &mut GgswCiphertext32,
input: &LweCiphertext32,
delta_log: DeltaLog,
bsk: &FftFourierLweBootstrapKey32,
cbs_pfpksk: &LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeys32,
)
unsafe fn discard_circuit_bootstrap_boolean_lwe_ciphertext_unchecked( &mut self, output: &mut GgswCiphertext32, input: &LweCiphertext32, delta_log: DeltaLog, bsk: &FftFourierLweBootstrapKey32, cbs_pfpksk: &LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeys32, )
Source§impl LweCiphertextVectorDiscardingCircuitBootstrapBooleanVerticalPackingEngine<LweCiphertextVectorView32<'_>, LweCiphertextVectorMutView32<'_>, FftFourierLweBootstrapKey32, PlaintextVector32, LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeys32> for FftEngine
impl LweCiphertextVectorDiscardingCircuitBootstrapBooleanVerticalPackingEngine<LweCiphertextVectorView32<'_>, LweCiphertextVectorMutView32<'_>, FftFourierLweBootstrapKey32, PlaintextVector32, LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeys32> for FftEngine
Source§fn discard_circuit_bootstrap_boolean_vertical_packing_lwe_ciphertext_vector(
&mut self,
output: &mut LweCiphertextVectorMutView32<'_>,
input: &LweCiphertextVectorView32<'_>,
bsk: &FftFourierLweBootstrapKey32,
luts: &PlaintextVector32,
cbs_level_count: DecompositionLevelCount,
cbs_base_log: DecompositionBaseLog,
cbs_pfpksk: &LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeys32,
) -> Result<(), LweCiphertextVectorDiscardingCircuitBootstrapBooleanVerticalPackingError<Self::EngineError>>
fn discard_circuit_bootstrap_boolean_vertical_packing_lwe_ciphertext_vector( &mut self, output: &mut LweCiphertextVectorMutView32<'_>, input: &LweCiphertextVectorView32<'_>, bsk: &FftFourierLweBootstrapKey32, luts: &PlaintextVector32, cbs_level_count: DecompositionLevelCount, cbs_base_log: DecompositionBaseLog, cbs_pfpksk: &LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeys32, ) -> Result<(), LweCiphertextVectorDiscardingCircuitBootstrapBooleanVerticalPackingError<Self::EngineError>>
§Example:
use concrete_core::prelude::*;
// DISCLAIMER: the parameters used here are only for test purpose, and are not secure.
let polynomial_size = PolynomialSize(1024);
let glwe_dimension = GlweDimension(1);
let lwe_dimension = LweDimension(481);
let var_small = Variance::from_variance(2f64.powf(-70.0));
let var_big = Variance::from_variance(2f64.powf(-60.0));
const UNSAFE_SECRET: u128 = 0;
let mut default_engine = DefaultEngine::new(Box::new(UnixSeeder::new(UNSAFE_SECRET)))?;
let mut default_parallel_engine =
DefaultParallelEngine::new(Box::new(UnixSeeder::new(UNSAFE_SECRET)))?;
let mut fft_engine = FftEngine::new(())?;
let glwe_sk: GlweSecretKey32 =
default_engine.generate_new_glwe_secret_key(glwe_dimension, polynomial_size)?;
let lwe_small_sk: LweSecretKey32 = default_engine.generate_new_lwe_secret_key(lwe_dimension)?;
let lwe_big_sk: LweSecretKey32 =
default_engine.transform_glwe_secret_key_to_lwe_secret_key(glwe_sk.clone())?;
let bsk_level_count = DecompositionLevelCount(7);
let bsk_base_log = DecompositionBaseLog(4);
let std_bsk: LweBootstrapKey32 = default_parallel_engine.generate_new_lwe_bootstrap_key(
&lwe_small_sk,
&glwe_sk,
bsk_base_log,
bsk_level_count,
var_small,
)?;
let fourier_bsk: FftFourierLweBootstrapKey32 =
fft_engine.convert_lwe_bootstrap_key(&std_bsk)?;
let ksk_level_count = DecompositionLevelCount(9);
let ksk_base_log = DecompositionBaseLog(1);
let ksk_big_to_small: LweKeyswitchKey32 = default_engine.generate_new_lwe_keyswitch_key(
&lwe_big_sk,
&lwe_small_sk,
ksk_level_count,
ksk_base_log,
var_big,
)?;
let pfpksk_level_count = DecompositionLevelCount(7);
let pfpksk_base_log = DecompositionBaseLog(4);
let cbs_pfpksk: LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeys32 = default_engine
.generate_new_lwe_circuit_bootstrap_private_functional_packing_keyswitch_keys(
&lwe_big_sk,
&glwe_sk,
pfpksk_base_log,
pfpksk_level_count,
var_small,
)?;
// We will have a message with 10 bits of information
let message_bits = 10;
let bits_to_extract = ExtractedBitsCount(message_bits);
// The value we encrypt is 42, we will extract the bits of this value and apply the
// circuit bootstrapping followed by the vertical packing on the extracted bits.
let cleartext = 42;
let delta_log_msg = DeltaLog(32 - message_bits);
let encoded_message = default_engine.create_plaintext_from(&(cleartext << delta_log_msg.0))?;
let lwe_in = default_engine.encrypt_lwe_ciphertext(&lwe_big_sk, &encoded_message, var_big)?;
// Bit extraction output, use the zero_encrypt engine to allocate a ciphertext vector
let mut bit_extraction_output = default_engine.zero_encrypt_lwe_ciphertext_vector(
&lwe_small_sk,
var_small,
LweCiphertextCount(bits_to_extract.0),
)?;
fft_engine.discard_extract_bits_lwe_ciphertext(
&mut bit_extraction_output,
&lwe_in,
&fourier_bsk,
&ksk_big_to_small,
bits_to_extract,
delta_log_msg,
)?;
// Though the delta log here is the same as the message delta log, in the general case they
// are different, so we create two DeltaLog parameters
let delta_log_lut = DeltaLog(32 - message_bits);
// Create a look-up table we want to apply during vertical packing, here just the identity
// with the proper encoding.
// Note that this particular table will not trigger the cmux tree from the vertical packing,
// adapt the LUT generation to your usage.
// Here we apply a single look-up table as we output a single ciphertext.
let number_of_luts_and_output_vp_ciphertexts = 1;
let lut_size = 1 << bits_to_extract.0;
let mut lut: Vec<u32> = Vec::with_capacity(lut_size);
for i in 0..lut_size {
lut.push((i as u32 % (1 << message_bits)) << delta_log_lut.0);
}
let lut_as_plaintext_vector = default_engine.create_plaintext_vector_from(lut.as_slice())?;
// We run on views, so we need a container for the output
let mut output_cbs_vp_ct_container = vec![
0u32;
lwe_big_sk.lwe_dimension().to_lwe_size().0
* number_of_luts_and_output_vp_ciphertexts
];
let mut output_cbs_vp_ct_mut_view: LweCiphertextVectorMutView32 = default_engine
.create_lwe_ciphertext_vector_from(
output_cbs_vp_ct_container.as_mut_slice(),
lwe_big_sk.lwe_dimension().to_lwe_size(),
)?;
// And we need to get a view on the bits extracted earlier that serve as inputs to the
// circuit bootstrap + vertical packing
let extracted_bits_lwe_size = bit_extraction_output.lwe_dimension().to_lwe_size();
let extracted_bits_container =
default_engine.consume_retrieve_lwe_ciphertext_vector(bit_extraction_output)?;
let cbs_vp_input_vector_view: LweCiphertextVectorView32 = default_engine
.create_lwe_ciphertext_vector_from(
extracted_bits_container.as_slice(),
extracted_bits_lwe_size,
)?;
let cbs_level_count = DecompositionLevelCount(4);
let cbs_base_log = DecompositionBaseLog(6);
fft_engine.discard_circuit_bootstrap_boolean_vertical_packing_lwe_ciphertext_vector(
&mut output_cbs_vp_ct_mut_view,
&cbs_vp_input_vector_view,
&fourier_bsk,
&lut_as_plaintext_vector,
cbs_level_count,
cbs_base_log,
&cbs_pfpksk,
)?;
assert_eq!(output_cbs_vp_ct_mut_view.lwe_ciphertext_count().0, 1);
assert_eq!(
output_cbs_vp_ct_mut_view.lwe_dimension(),
LweDimension(glwe_dimension.0 * polynomial_size.0)
);
Source§unsafe fn discard_circuit_bootstrap_boolean_vertical_packing_lwe_ciphertext_vector_unchecked(
&mut self,
output: &mut LweCiphertextVectorMutView32<'_>,
input: &LweCiphertextVectorView32<'_>,
bsk: &FftFourierLweBootstrapKey32,
luts: &PlaintextVector32,
cbs_level_count: DecompositionLevelCount,
cbs_base_log: DecompositionBaseLog,
cbs_pfpksk: &LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeys32,
)
unsafe fn discard_circuit_bootstrap_boolean_vertical_packing_lwe_ciphertext_vector_unchecked( &mut self, output: &mut LweCiphertextVectorMutView32<'_>, input: &LweCiphertextVectorView32<'_>, bsk: &FftFourierLweBootstrapKey32, luts: &PlaintextVector32, cbs_level_count: DecompositionLevelCount, cbs_base_log: DecompositionBaseLog, cbs_pfpksk: &LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeys32, )
Source§impl LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeysEntity for LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeys32
impl LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeysEntity for LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeys32
Source§fn input_lwe_dimension(&self) -> LweDimension
fn input_lwe_dimension(&self) -> LweDimension
Source§fn output_glwe_dimension(&self) -> GlweDimension
fn output_glwe_dimension(&self) -> GlweDimension
Source§fn output_polynomial_size(&self) -> PolynomialSize
fn output_polynomial_size(&self) -> PolynomialSize
Source§fn decomposition_level_count(&self) -> DecompositionLevelCount
fn decomposition_level_count(&self) -> DecompositionLevelCount
Source§fn decomposition_base_log(&self) -> DecompositionBaseLog
fn decomposition_base_log(&self) -> DecompositionBaseLog
Source§fn key_count(&self) -> FunctionalPackingKeyswitchKeyCount
fn key_count(&self) -> FunctionalPackingKeyswitchKeyCount
Source§impl LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeysGenerationEngine<LweSecretKey32, GlweSecretKey32, LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeys32> for DefaultEngine
§Description:
Implementation of LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeysGenerationEngine
for DefaultEngine that operates on 32 bits integers.
impl LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeysGenerationEngine<LweSecretKey32, GlweSecretKey32, LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeys32> for DefaultEngine
§Description:
Implementation of LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeysGenerationEngine
for DefaultEngine that operates on 32 bits integers.
Source§fn generate_new_lwe_circuit_bootstrap_private_functional_packing_keyswitch_keys(
&mut self,
input_lwe_key: &LweSecretKey32,
output_glwe_key: &GlweSecretKey32,
decomposition_base_log: DecompositionBaseLog,
decomposition_level_count: DecompositionLevelCount,
noise: Variance,
) -> Result<LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeys32, LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeysGenerationError<Self::EngineError>>
fn generate_new_lwe_circuit_bootstrap_private_functional_packing_keyswitch_keys( &mut self, input_lwe_key: &LweSecretKey32, output_glwe_key: &GlweSecretKey32, decomposition_base_log: DecompositionBaseLog, decomposition_level_count: DecompositionLevelCount, noise: Variance, ) -> Result<LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeys32, LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeysGenerationError<Self::EngineError>>
§Example:
use concrete_core::prelude::Variance;
use concrete_core::prelude::{
DecompositionBaseLog, DecompositionLevelCount, LweDimension, GlweDimension,FunctionalPackingKeyswitchKeyCount
};
use concrete_core::prelude::*;
// DISCLAIMER: the parameters used here are only for test purpose, and are not secure.
let input_lwe_dimension = LweDimension(10);
let output_glwe_dimension = GlweDimension(3);
let polynomial_size = PolynomialSize(256);
let decomposition_base_log = DecompositionBaseLog(3);
let decomposition_level_count = DecompositionLevelCount(5);
let noise = Variance(2_f64.powf(-25.));
// Unix seeder must be given a secret input.
// Here we just give it 0, which is totally unsafe.
const UNSAFE_SECRET: u128 = 0;
let mut engine = DefaultEngine::new(Box::new(UnixSeeder::new(UNSAFE_SECRET)))?;
let input_key: LweSecretKey32 = engine.generate_new_lwe_secret_key(input_lwe_dimension)?;
let output_key: GlweSecretKey32 = engine.generate_new_glwe_secret_key(output_glwe_dimension,
polynomial_size)?;
let cbs_private_functional_packing_keyswitch_key:
LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeys32 =
engine
.generate_new_lwe_circuit_bootstrap_private_functional_packing_keyswitch_keys(
&input_key,
&output_key,
decomposition_base_log,
decomposition_level_count,
noise,
)?;
assert_eq!(
assert_eq!(
assert_eq!(cbs_private_functional_packing_keyswitch_key.input_lwe_dimension(),
input_lwe_dimension);
assert_eq!(cbs_private_functional_packing_keyswitch_key.output_glwe_dimension(),
output_glwe_dimension);
assert_eq!(cbs_private_functional_packing_keyswitch_key.key_count().0,
output_glwe_dimension.to_glwe_size().0);
Source§unsafe fn generate_new_lwe_circuit_bootstrap_private_functional_packing_keyswitch_keys_unchecked(
&mut self,
input_lwe_key: &LweSecretKey32,
output_glwe_key: &GlweSecretKey32,
decomposition_base_log: DecompositionBaseLog,
decomposition_level_count: DecompositionLevelCount,
noise: Variance,
) -> LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeys32
unsafe fn generate_new_lwe_circuit_bootstrap_private_functional_packing_keyswitch_keys_unchecked( &mut self, input_lwe_key: &LweSecretKey32, output_glwe_key: &GlweSecretKey32, decomposition_base_log: DecompositionBaseLog, decomposition_level_count: DecompositionLevelCount, noise: Variance, ) -> LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeys32
Source§impl LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeysGenerationEngine<LweSecretKey32, GlweSecretKey32, LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeys32> for DefaultParallelEngine
§Description:
Implementation of LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeysGenerationEngine
for DefaultParallelEngine that operates on 32 bits integers.
impl LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeysGenerationEngine<LweSecretKey32, GlweSecretKey32, LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeys32> for DefaultParallelEngine
§Description:
Implementation of LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeysGenerationEngine
for DefaultParallelEngine that operates on 32 bits integers.
Source§fn generate_new_lwe_circuit_bootstrap_private_functional_packing_keyswitch_keys(
&mut self,
input_lwe_key: &LweSecretKey32,
output_glwe_key: &GlweSecretKey32,
decomposition_base_log: DecompositionBaseLog,
decomposition_level_count: DecompositionLevelCount,
noise: Variance,
) -> Result<LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeys32, LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeysGenerationError<Self::EngineError>>
fn generate_new_lwe_circuit_bootstrap_private_functional_packing_keyswitch_keys( &mut self, input_lwe_key: &LweSecretKey32, output_glwe_key: &GlweSecretKey32, decomposition_base_log: DecompositionBaseLog, decomposition_level_count: DecompositionLevelCount, noise: Variance, ) -> Result<LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeys32, LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeysGenerationError<Self::EngineError>>
§Example:
use concrete_core::prelude::Variance;
use concrete_core::prelude::{
DecompositionBaseLog, DecompositionLevelCount, LweDimension, GlweDimension,FunctionalPackingKeyswitchKeyCount
};
use concrete_core::prelude::*;
// DISCLAIMER: the parameters used here are only for test purpose, and are not secure.
let input_lwe_dimension = LweDimension(10);
let output_glwe_dimension = GlweDimension(3);
let polynomial_size = PolynomialSize(256);
let decomposition_base_log = DecompositionBaseLog(3);
let decomposition_level_count = DecompositionLevelCount(5);
let noise = Variance(2_f64.powf(-25.));
// Unix seeder must be given a secret input.
// Here we just give it 0, which is totally unsafe.
const UNSAFE_SECRET: u128 = 0;
let mut default_engine = DefaultEngine::new(Box::new(UnixSeeder::new(UNSAFE_SECRET)))?;
let mut default_parallel_engine =
DefaultParallelEngine::new(Box::new(UnixSeeder::new(UNSAFE_SECRET)))?;
let input_key: LweSecretKey32 = default_engine.generate_new_lwe_secret_key(input_lwe_dimension)?;
let output_key: GlweSecretKey32 = default_engine.generate_new_glwe_secret_key(output_glwe_dimension,
polynomial_size)?;
let cbs_private_functional_packing_keyswitch_key:
LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeys32 =
default_engine
.generate_new_lwe_circuit_bootstrap_private_functional_packing_keyswitch_keys(
&input_key,
&output_key,
decomposition_base_log,
decomposition_level_count,
noise,
)?;
assert_eq!(
assert_eq!(
assert_eq!(cbs_private_functional_packing_keyswitch_key.input_lwe_dimension(),
input_lwe_dimension);
assert_eq!(cbs_private_functional_packing_keyswitch_key.output_glwe_dimension(),
output_glwe_dimension);
assert_eq!(cbs_private_functional_packing_keyswitch_key.key_count().0,
output_glwe_dimension.to_glwe_size().0);
Source§unsafe fn generate_new_lwe_circuit_bootstrap_private_functional_packing_keyswitch_keys_unchecked(
&mut self,
input_lwe_key: &LweSecretKey32,
output_glwe_key: &GlweSecretKey32,
decomposition_base_log: DecompositionBaseLog,
decomposition_level_count: DecompositionLevelCount,
noise: Variance,
) -> LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeys32
unsafe fn generate_new_lwe_circuit_bootstrap_private_functional_packing_keyswitch_keys_unchecked( &mut self, input_lwe_key: &LweSecretKey32, output_glwe_key: &GlweSecretKey32, decomposition_base_log: DecompositionBaseLog, decomposition_level_count: DecompositionLevelCount, noise: Variance, ) -> LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeys32
Source§impl PartialEq for LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeys32
impl PartialEq for LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeys32
Source§fn eq(
&self,
other: &LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeys32,
) -> bool
fn eq( &self, other: &LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeys32, ) -> bool
self and other values to be equal, and is used by ==.impl Eq for LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeys32
impl StructuralPartialEq for LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeys32
Auto Trait Implementations§
impl Freeze for LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeys32
impl RefUnwindSafe for LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeys32
impl Send for LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeys32
impl Sync for LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeys32
impl Unpin for LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeys32
impl UnwindSafe for LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeys32
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more