pub struct FunctionalPackingKeyswitchKey32(/* private fields */);Expand description
A structure representing a functional packing keyswitch key with 32 bits of precision.
Trait Implementations§
Source§impl AbstractEntity for FunctionalPackingKeyswitchKey32
impl AbstractEntity for FunctionalPackingKeyswitchKey32
Source§type Kind = FunctionalPackingKeyswitchKeyKind
type Kind = FunctionalPackingKeyswitchKeyKind
The kind of the entity.
Source§impl Clone for FunctionalPackingKeyswitchKey32
impl Clone for FunctionalPackingKeyswitchKey32
Source§fn clone(&self) -> FunctionalPackingKeyswitchKey32
fn clone(&self) -> FunctionalPackingKeyswitchKey32
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl DestructionEngine<FunctionalPackingKeyswitchKey32> for CoreEngine
impl DestructionEngine<FunctionalPackingKeyswitchKey32> for CoreEngine
Source§fn destroy(
&mut self,
entity: FunctionalPackingKeyswitchKey32,
) -> Result<(), DestructionError<Self::EngineError>>
fn destroy( &mut self, entity: FunctionalPackingKeyswitchKey32, ) -> Result<(), DestructionError<Self::EngineError>>
Destroys an entity.
Source§unsafe fn destroy_unchecked(
&mut self,
entity: &mut FunctionalPackingKeyswitchKey32,
)
unsafe fn destroy_unchecked( &mut self, entity: &mut FunctionalPackingKeyswitchKey32, )
Unsafely destroys an entity. Read more
Source§impl FunctionalPackingKeyswitchKeyCreationEngine<LweSecretKey32, GlweSecretKey32, FunctionalPackingKeyswitchKey32, CleartextVector32, u32> for CoreEngine
§Description:
Implementation of FunctionalPackingKeyswitchKeyCreationEngine for CoreEngine that
operates on 32 bits integers.
impl FunctionalPackingKeyswitchKeyCreationEngine<LweSecretKey32, GlweSecretKey32, FunctionalPackingKeyswitchKey32, CleartextVector32, u32> for CoreEngine
§Description:
Implementation of FunctionalPackingKeyswitchKeyCreationEngine for CoreEngine that
operates on 32 bits integers.
Source§fn create_functional_packing_keyswitch_key<F: Fn(u32) -> u32>(
&mut self,
input_key: &LweSecretKey32,
output_key: &GlweSecretKey32,
decomposition_level_count: DecompositionLevelCount,
decomposition_base_log: DecompositionBaseLog,
noise: StandardDev,
f: F,
polynomial: &CleartextVector32,
) -> Result<FunctionalPackingKeyswitchKey32, FunctionalPackingKeyswitchKeyCreationError<Self::EngineError>>
fn create_functional_packing_keyswitch_key<F: Fn(u32) -> u32>( &mut self, input_key: &LweSecretKey32, output_key: &GlweSecretKey32, decomposition_level_count: DecompositionLevelCount, decomposition_base_log: DecompositionBaseLog, noise: StandardDev, f: F, polynomial: &CleartextVector32, ) -> Result<FunctionalPackingKeyswitchKey32, FunctionalPackingKeyswitchKeyCreationError<Self::EngineError>>
§Example:
use concrete_commons::dispersion::Variance;
use concrete_commons::parameters::{
DecompositionBaseLog, DecompositionLevelCount, LweDimension, GlweDimension
};
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.));
let mut engine = CoreEngine::new(())?;
let input_key: LweSecretKey32 = engine.create_lwe_secret_key(input_lwe_dimension)?;
let output_key: GlweSecretKey32 = engine.create_glwe_secret_key(output_glwe_dimension,
polynomial_size)?;
let val = vec![1_u32; output_key.polynomial_size().0];
let polynomial: CleartextVector32 = engine.create_cleartext_vector(&val)?;
let functional_packing_keyswitch_key = engine.create_functional_packing_keyswitch_key(
&input_key,
&output_key,
decomposition_level_count,
decomposition_base_log,
noise,
|x|x,
&polynomial,
)?;
assert_eq!(
assert_eq!(
assert_eq!(functional_packing_keyswitch_key.input_lwe_dimension(), input_lwe_dimension);
assert_eq!(functional_packing_keyswitch_key.output_glwe_dimension(), output_glwe_dimension);
engine.destroy(input_key)?;
engine.destroy(output_key)?;
engine.destroy(functional_packing_keyswitch_key)?;Source§unsafe fn create_functional_packing_keyswitch_key_unchecked<F: Fn(u32) -> u32>(
&mut self,
input_key: &LweSecretKey32,
output_key: &GlweSecretKey32,
decomposition_level_count: DecompositionLevelCount,
decomposition_base_log: DecompositionBaseLog,
noise: StandardDev,
f: F,
polynomial: &CleartextVector32,
) -> FunctionalPackingKeyswitchKey32
unsafe fn create_functional_packing_keyswitch_key_unchecked<F: Fn(u32) -> u32>( &mut self, input_key: &LweSecretKey32, output_key: &GlweSecretKey32, decomposition_level_count: DecompositionLevelCount, decomposition_base_log: DecompositionBaseLog, noise: StandardDev, f: F, polynomial: &CleartextVector32, ) -> FunctionalPackingKeyswitchKey32
Unsafely creates a functional packing keyswitch key. Read more
Source§impl FunctionalPackingKeyswitchKeyEntity for FunctionalPackingKeyswitchKey32
impl FunctionalPackingKeyswitchKeyEntity for FunctionalPackingKeyswitchKey32
Source§type InputKeyDistribution = BinaryKeyDistribution
type InputKeyDistribution = BinaryKeyDistribution
The distribution of the key the input ciphertext is encrypted with.
Source§type OutputKeyDistribution = BinaryKeyDistribution
type OutputKeyDistribution = BinaryKeyDistribution
The distribution of the key the output ciphertext is encrypted with.
Source§fn input_lwe_dimension(&self) -> LweDimension
fn input_lwe_dimension(&self) -> LweDimension
Returns the input LWE dimension of the key.
Source§fn output_glwe_dimension(&self) -> GlweDimension
fn output_glwe_dimension(&self) -> GlweDimension
Returns the output GLWE dimension of the key.
Source§fn output_polynomial_size(&self) -> PolynomialSize
fn output_polynomial_size(&self) -> PolynomialSize
Returns the output polynomial degree of the key.
Source§fn decomposition_level_count(&self) -> DecompositionLevelCount
fn decomposition_level_count(&self) -> DecompositionLevelCount
Returns the number of decomposition levels of the key.
Source§fn decomposition_base_log(&self) -> DecompositionBaseLog
fn decomposition_base_log(&self) -> DecompositionBaseLog
Returns the logarithm of the base used in the key.
Source§impl LweCiphertextVectorGlweCiphertextDiscardingFunctionalPackingKeyswitchEngine<FunctionalPackingKeyswitchKey32, LweCiphertextVector32, GlweCiphertext32> for CoreEngine
§Description:
Implementation of
LweCiphertextVectorGlweCiphertextDiscardingFunctionalPackingKeyswitchEngine for
CoreEngine that operates on 32 bits integers.
impl LweCiphertextVectorGlweCiphertextDiscardingFunctionalPackingKeyswitchEngine<FunctionalPackingKeyswitchKey32, LweCiphertextVector32, GlweCiphertext32> for CoreEngine
§Description:
Implementation of
LweCiphertextVectorGlweCiphertextDiscardingFunctionalPackingKeyswitchEngine for
CoreEngine that operates on 32 bits integers.
Source§fn discard_functional_packing_keyswitch_lwe_ciphertext_vector(
&mut self,
output: &mut GlweCiphertext32,
input: &LweCiphertextVector32,
ksk: &FunctionalPackingKeyswitchKey32,
) -> Result<(), LweCiphertextVectorGlweCiphertextDiscardingFunctionalPackingKeyswitchError<Self::EngineError>>
fn discard_functional_packing_keyswitch_lwe_ciphertext_vector( &mut self, output: &mut GlweCiphertext32, input: &LweCiphertextVector32, ksk: &FunctionalPackingKeyswitchKey32, ) -> Result<(), LweCiphertextVectorGlweCiphertextDiscardingFunctionalPackingKeyswitchError<Self::EngineError>>
§Example:
use concrete_commons::dispersion::Variance;
use concrete_commons::parameters::{
DecompositionBaseLog, DecompositionLevelCount, LweDimension,
};
use concrete_core::prelude::*;
// DISCLAIMER: the parameters used here are only for test purpose, and are not secure.
let input_lwe_dimension = LweDimension(6);
let output_glwe_dimension = GlweDimension(3);
let decomposition_level_count = DecompositionLevelCount(2);
let decomposition_base_log = DecompositionBaseLog(8);
let polynomial_size = PolynomialSize(256);
let noise = Variance(2_f64.powf(-25.));
// Here a hard-set encoding is applied (shift by 20 bits)
let input_vector = vec![3_u32 << 20, 256];
let mut engine = CoreEngine::new(())?;
let input_key: LweSecretKey32 = engine.create_lwe_secret_key(input_lwe_dimension)?;
let output_key: GlweSecretKey32 =
engine.create_glwe_secret_key(output_glwe_dimension, polynomial_size)?;
let val = vec![1_u32; output_key.polynomial_size().0];
let polynomial: CleartextVector32 = engine.create_cleartext_vector(&val)?;
let functional_packing_keyswitch_key = engine.create_functional_packing_keyswitch_key(
&input_key,
&output_key,
decomposition_level_count,
decomposition_base_log,
noise,
|x|x,
&polynomial,
)?;
let plaintext_vector = engine.create_plaintext_vector(&input_vector)?;
let ciphertext_vector =
engine.encrypt_lwe_ciphertext_vector(&input_key, &plaintext_vector, noise)?;
let mut ciphertext_output = engine.zero_encrypt_glwe_ciphertext(&output_key, noise)?;
engine.discard_functional_packing_keyswitch_lwe_ciphertext_vector(
&mut ciphertext_output,
&ciphertext_vector,
&functional_packing_keyswitch_key,
)?;
assert_eq!(ciphertext_output.glwe_dimension(), output_glwe_dimension);
engine.destroy(input_key)?;
engine.destroy(output_key)?;
engine.destroy(functional_packing_keyswitch_key)?;
engine.destroy(plaintext_vector)?;
engine.destroy(ciphertext_vector)?;
engine.destroy(ciphertext_output)?;Source§unsafe fn discard_functional_packing_keyswitch_lwe_ciphertext_vector_unchecked(
&mut self,
output: &mut GlweCiphertext32,
input: &LweCiphertextVector32,
ksk: &FunctionalPackingKeyswitchKey32,
)
unsafe fn discard_functional_packing_keyswitch_lwe_ciphertext_vector_unchecked( &mut self, output: &mut GlweCiphertext32, input: &LweCiphertextVector32, ksk: &FunctionalPackingKeyswitchKey32, )
Unsafely functional packing keyswitches an LWE ciphertext vector. Read more
Source§impl PartialEq for FunctionalPackingKeyswitchKey32
impl PartialEq for FunctionalPackingKeyswitchKey32
Source§fn eq(&self, other: &FunctionalPackingKeyswitchKey32) -> bool
fn eq(&self, other: &FunctionalPackingKeyswitchKey32) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for FunctionalPackingKeyswitchKey32
Auto Trait Implementations§
impl Freeze for FunctionalPackingKeyswitchKey32
impl RefUnwindSafe for FunctionalPackingKeyswitchKey32
impl Send for FunctionalPackingKeyswitchKey32
impl Sync for FunctionalPackingKeyswitchKey32
impl Unpin for FunctionalPackingKeyswitchKey32
impl UnwindSafe for FunctionalPackingKeyswitchKey32
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
Mutably borrows from an owned value. Read more