Struct concrete_core::backends::default::entities::LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeys64
source · [−]pub struct LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeys64(pub ImplLwePrivateFunctionalPackingKeyswitchKeyList<Vec<u64>>);Expand description
A structure representing a vector of private functional packing keyswitch keys used for a circuit bootsrap with 64 bits of precision.
Tuple Fields
0: ImplLwePrivateFunctionalPackingKeyswitchKeyList<Vec<u64>>Trait Implementations
sourceimpl AbstractEntity for LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeys64
impl AbstractEntity for LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeys64
type Kind = LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeysKind
type Kind = LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeysKind
sourceimpl Clone for LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeys64
impl Clone for LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeys64
sourcefn clone(&self) -> LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeys64
fn clone(&self) -> LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeys64
1.0.0 · sourceconst fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
source. Read moresourceimpl EntityDeserializationEngine<&[u8], LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeys64> for DefaultSerializationEngine
impl EntityDeserializationEngine<&[u8], LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeys64> for DefaultSerializationEngine
Description:
Implementation of EntityDeserializationEngine for DefaultSerializationEngine that
operates on 64 bits integers. It deserializes an LWE circuit bootstrap private functional
packing keyswitch vector.
sourcefn deserialize(
&mut self,
serialized: &[u8]
) -> Result<LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeys64, EntityDeserializationError<Self::EngineError>>
fn deserialize(
&mut self,
serialized: &[u8]
) -> Result<LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeys64, 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: LweSecretKey64 = engine.generate_new_lwe_secret_key(input_lwe_dimension)?;
let output_key: GlweSecretKey64 =
engine.generate_new_glwe_secret_key(output_glwe_dimension, polynomial_size)?;
let cbs_private_functional_packing_keyswitch_key:
LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeys64 =
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);
sourceunsafe fn deserialize_unchecked(
&mut self,
serialized: &[u8]
) -> LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeys64
unsafe fn deserialize_unchecked(
&mut self,
serialized: &[u8]
) -> LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeys64
sourceimpl EntitySerializationEngine<LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeys64, Vec<u8, Global>> for DefaultSerializationEngine
impl EntitySerializationEngine<LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeys64, Vec<u8, Global>> for DefaultSerializationEngine
Description:
Implementation of EntitySerializationEngine for DefaultSerializationEngine that operates
on 64 bits integers. It serializes an LWE circuit bootstrap private functional packing keyswitch
vector.
sourcefn serialize(
&mut self,
entity: &LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeys64
) -> Result<Vec<u8>, EntitySerializationError<Self::EngineError>>
fn serialize(
&mut self,
entity: &LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeys64
) -> 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: LweSecretKey64 = engine.generate_new_lwe_secret_key(input_lwe_dimension)?;
let output_key: GlweSecretKey64 =
engine.generate_new_glwe_secret_key(output_glwe_dimension, polynomial_size)?;
let cbs_private_functional_packing_keyswitch_key:
LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeys64 =
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);
sourceunsafe fn serialize_unchecked(
&mut self,
entity: &LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeys64
) -> Vec<u8>
unsafe fn serialize_unchecked(
&mut self,
entity: &LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeys64
) -> Vec<u8>
sourceimpl LweCiphertextDiscardingCircuitBootstrapBooleanEngine<LweCiphertext64, GgswCiphertext64, FftFourierLweBootstrapKey64, LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeys64> for FftEngine
impl LweCiphertextDiscardingCircuitBootstrapBooleanEngine<LweCiphertext64, GgswCiphertext64, FftFourierLweBootstrapKey64, LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeys64> for FftEngine
Description:
Implementation of LweCiphertextDiscardingCircuitBootstrapBooleanEngine for FftEngine
that operates on 64 bits integers.
sourcefn discard_circuit_bootstrap_boolean_lwe_ciphertext(
&mut self,
output: &mut GgswCiphertext64,
input: &LweCiphertext64,
delta_log: DeltaLog,
bsk: &FftFourierLweBootstrapKey64,
cbs_pfpksk: &LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeys64
) -> Result<(), LweCiphertextDiscardingCircuitBootstrapBooleanError<Self::EngineError>>
fn discard_circuit_bootstrap_boolean_lwe_ciphertext(
&mut self,
output: &mut GgswCiphertext64,
input: &LweCiphertext64,
delta_log: DeltaLog,
bsk: &FftFourierLweBootstrapKey64,
cbs_pfpksk: &LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeys64
) -> 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: GlweSecretKey64 =
default_engine.generate_new_glwe_secret_key(glwe_dimension, polynomial_size)?;
let small_lwe_sk: LweSecretKey64 =
default_engine.generate_new_lwe_secret_key(small_lwe_dimension)?;
let big_lwe_sk: LweSecretKey64 =
default_engine.transform_glwe_secret_key_to_lwe_secret_key(glwe_sk.clone())?;
let std_bsk: LweBootstrapKey64 = default_parallel_engine.generate_new_lwe_bootstrap_key(
&small_lwe_sk,
&glwe_sk,
base_log_bsk,
level_bsk,
noise,
)?;
let fbsk: FftFourierLweBootstrapKey64 = fft_engine.convert_lwe_bootstrap_key(&std_bsk)?;
let cbs_pfpksk: LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeys64 = 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 ^ 63
let delta_log = DeltaLog(63);
let value = 1u64;
// Encryption of 'value' in an LWE ciphertext using delta_log for the encoding
let plaintext: Plaintext64 = default_engine.create_plaintext_from(&(value << delta_log.0))?;
let lwe_in: LweCiphertext64 =
default_engine.encrypt_lwe_ciphertext(&small_lwe_sk, &plaintext, noise)?;
// Create an empty GGSW ciphertext with a trivial encryption of 0
let zero_plaintext: Plaintext64 = default_engine.create_plaintext_from(&0u64)?;
let mut output_ggsw: GgswCiphertext64 = 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,
)?;
sourceunsafe fn discard_circuit_bootstrap_boolean_lwe_ciphertext_unchecked(
&mut self,
output: &mut GgswCiphertext64,
input: &LweCiphertext64,
delta_log: DeltaLog,
bsk: &FftFourierLweBootstrapKey64,
cbs_pfpksk: &LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeys64
)
unsafe fn discard_circuit_bootstrap_boolean_lwe_ciphertext_unchecked(
&mut self,
output: &mut GgswCiphertext64,
input: &LweCiphertext64,
delta_log: DeltaLog,
bsk: &FftFourierLweBootstrapKey64,
cbs_pfpksk: &LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeys64
)
sourceimpl LweCiphertextVectorDiscardingCircuitBootstrapBooleanVerticalPackingEngine<LweCiphertextVectorView64<'_>, LweCiphertextVectorMutView64<'_>, FftFourierLweBootstrapKey64, PlaintextVector64, LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeys64> for FftEngine
impl LweCiphertextVectorDiscardingCircuitBootstrapBooleanVerticalPackingEngine<LweCiphertextVectorView64<'_>, LweCiphertextVectorMutView64<'_>, FftFourierLweBootstrapKey64, PlaintextVector64, LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeys64> for FftEngine
sourcefn discard_circuit_bootstrap_boolean_vertical_packing_lwe_ciphertext_vector(
&mut self,
output: &mut LweCiphertextVectorMutView64<'_>,
input: &LweCiphertextVectorView64<'_>,
bsk: &FftFourierLweBootstrapKey64,
luts: &PlaintextVector64,
cbs_level_count: DecompositionLevelCount,
cbs_base_log: DecompositionBaseLog,
cbs_pfpksk: &LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeys64
) -> Result<(), LweCiphertextVectorDiscardingCircuitBootstrapBooleanVerticalPackingError<Self::EngineError>>
fn discard_circuit_bootstrap_boolean_vertical_packing_lwe_ciphertext_vector(
&mut self,
output: &mut LweCiphertextVectorMutView64<'_>,
input: &LweCiphertextVectorView64<'_>,
bsk: &FftFourierLweBootstrapKey64,
luts: &PlaintextVector64,
cbs_level_count: DecompositionLevelCount,
cbs_base_log: DecompositionBaseLog,
cbs_pfpksk: &LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeys64
) -> 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(-80.0));
let var_big = Variance::from_variance(2f64.powf(-70.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: GlweSecretKey64 =
default_engine.generate_new_glwe_secret_key(glwe_dimension, polynomial_size)?;
let lwe_small_sk: LweSecretKey64 = default_engine.generate_new_lwe_secret_key(lwe_dimension)?;
let lwe_big_sk: LweSecretKey64 =
default_engine.transform_glwe_secret_key_to_lwe_secret_key(glwe_sk.clone())?;
let bsk_level_count = DecompositionLevelCount(9);
let bsk_base_log = DecompositionBaseLog(4);
let std_bsk: LweBootstrapKey64 = default_parallel_engine.generate_new_lwe_bootstrap_key(
&lwe_small_sk,
&glwe_sk,
bsk_base_log,
bsk_level_count,
var_small,
)?;
let fourier_bsk: FftFourierLweBootstrapKey64 =
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: LweKeyswitchKey64 = 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(9);
let pfpksk_base_log = DecompositionBaseLog(4);
let cbs_pfpksk: LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeys64 = 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(64 - 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(64 - 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<u64> = Vec::with_capacity(lut_size);
for i in 0..lut_size {
lut.push((i as u64 % (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![
0u64;
lwe_big_sk.lwe_dimension().to_lwe_size().0
* number_of_luts_and_output_vp_ciphertexts
];
let mut output_cbs_vp_ct_mut_view: LweCiphertextVectorMutView64 = 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: LweCiphertextVectorView64 = 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)
);
sourceunsafe fn discard_circuit_bootstrap_boolean_vertical_packing_lwe_ciphertext_vector_unchecked(
&mut self,
output: &mut LweCiphertextVectorMutView64<'_>,
input: &LweCiphertextVectorView64<'_>,
bsk: &FftFourierLweBootstrapKey64,
luts: &PlaintextVector64,
cbs_level_count: DecompositionLevelCount,
cbs_base_log: DecompositionBaseLog,
cbs_pfpksk: &LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeys64
)
unsafe fn discard_circuit_bootstrap_boolean_vertical_packing_lwe_ciphertext_vector_unchecked(
&mut self,
output: &mut LweCiphertextVectorMutView64<'_>,
input: &LweCiphertextVectorView64<'_>,
bsk: &FftFourierLweBootstrapKey64,
luts: &PlaintextVector64,
cbs_level_count: DecompositionLevelCount,
cbs_base_log: DecompositionBaseLog,
cbs_pfpksk: &LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeys64
)
sourceimpl LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeysEntity for LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeys64
impl LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeysEntity for LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeys64
sourcefn input_lwe_dimension(&self) -> LweDimension
fn input_lwe_dimension(&self) -> LweDimension
sourcefn output_glwe_dimension(&self) -> GlweDimension
fn output_glwe_dimension(&self) -> GlweDimension
sourcefn output_polynomial_size(&self) -> PolynomialSize
fn output_polynomial_size(&self) -> PolynomialSize
sourcefn decomposition_level_count(&self) -> DecompositionLevelCount
fn decomposition_level_count(&self) -> DecompositionLevelCount
sourcefn decomposition_base_log(&self) -> DecompositionBaseLog
fn decomposition_base_log(&self) -> DecompositionBaseLog
sourcefn key_count(&self) -> FunctionalPackingKeyswitchKeyCount
fn key_count(&self) -> FunctionalPackingKeyswitchKeyCount
sourceimpl LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeysGenerationEngine<LweSecretKey64, GlweSecretKey64, LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeys64> for DefaultEngine
impl LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeysGenerationEngine<LweSecretKey64, GlweSecretKey64, LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeys64> for DefaultEngine
Description:
Implementation of LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeysGenerationEngine
for DefaultEngine that operates on 64 bits integers.
sourcefn generate_new_lwe_circuit_bootstrap_private_functional_packing_keyswitch_keys(
&mut self,
input_lwe_key: &LweSecretKey64,
output_glwe_key: &GlweSecretKey64,
decomposition_base_log: DecompositionBaseLog,
decomposition_level_count: DecompositionLevelCount,
noise: Variance
) -> Result<LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeys64, LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeysGenerationError<Self::EngineError>>
fn generate_new_lwe_circuit_bootstrap_private_functional_packing_keyswitch_keys(
&mut self,
input_lwe_key: &LweSecretKey64,
output_glwe_key: &GlweSecretKey64,
decomposition_base_log: DecompositionBaseLog,
decomposition_level_count: DecompositionLevelCount,
noise: Variance
) -> Result<LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeys64, 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: LweSecretKey64 = engine.generate_new_lwe_secret_key(input_lwe_dimension)?;
let output_key: GlweSecretKey64 = engine.generate_new_glwe_secret_key(output_glwe_dimension,
polynomial_size)?;
let cbs_private_functional_packing_keyswitch_key:
LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeys64 =
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);
sourceunsafe fn generate_new_lwe_circuit_bootstrap_private_functional_packing_keyswitch_keys_unchecked(
&mut self,
input_lwe_key: &LweSecretKey64,
output_glwe_key: &GlweSecretKey64,
decomposition_base_log: DecompositionBaseLog,
decomposition_level_count: DecompositionLevelCount,
noise: Variance
) -> LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeys64
unsafe fn generate_new_lwe_circuit_bootstrap_private_functional_packing_keyswitch_keys_unchecked(
&mut self,
input_lwe_key: &LweSecretKey64,
output_glwe_key: &GlweSecretKey64,
decomposition_base_log: DecompositionBaseLog,
decomposition_level_count: DecompositionLevelCount,
noise: Variance
) -> LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeys64
sourceimpl LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeysGenerationEngine<LweSecretKey64, GlweSecretKey64, LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeys64> for DefaultParallelEngine
impl LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeysGenerationEngine<LweSecretKey64, GlweSecretKey64, LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeys64> for DefaultParallelEngine
Description:
Implementation of LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeysGenerationEngine
for DefaultParallelEngine that operates on 64 bits integers.
sourcefn generate_new_lwe_circuit_bootstrap_private_functional_packing_keyswitch_keys(
&mut self,
input_lwe_key: &LweSecretKey64,
output_glwe_key: &GlweSecretKey64,
decomposition_base_log: DecompositionBaseLog,
decomposition_level_count: DecompositionLevelCount,
noise: Variance
) -> Result<LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeys64, LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeysGenerationError<Self::EngineError>>
fn generate_new_lwe_circuit_bootstrap_private_functional_packing_keyswitch_keys(
&mut self,
input_lwe_key: &LweSecretKey64,
output_glwe_key: &GlweSecretKey64,
decomposition_base_log: DecompositionBaseLog,
decomposition_level_count: DecompositionLevelCount,
noise: Variance
) -> Result<LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeys64, 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: LweSecretKey64 = default_engine.generate_new_lwe_secret_key(input_lwe_dimension)?;
let output_key: GlweSecretKey64 = default_engine.generate_new_glwe_secret_key(output_glwe_dimension,
polynomial_size)?;
let cbs_private_functional_packing_keyswitch_key:
LweCircuitBootstrapPrivateFunctionalPackingKeyswitchKeys64 =
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);