pub struct LwePrivateFunctionalPackingKeyswitchKey32(/* private fields */);Expand description
A structure representing a private functional packing keyswitch key with 32 bits of precision.
Trait Implementations§
Source§impl AbstractEntity for LwePrivateFunctionalPackingKeyswitchKey32
impl AbstractEntity for LwePrivateFunctionalPackingKeyswitchKey32
Source§type Kind = LwePrivateFunctionalPackingKeyswitchKeyKind
type Kind = LwePrivateFunctionalPackingKeyswitchKeyKind
The kind of the entity.
Source§impl Clone for LwePrivateFunctionalPackingKeyswitchKey32
impl Clone for LwePrivateFunctionalPackingKeyswitchKey32
Source§fn clone(&self) -> LwePrivateFunctionalPackingKeyswitchKey32
fn clone(&self) -> LwePrivateFunctionalPackingKeyswitchKey32
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 LweCiphertextVectorGlweCiphertextDiscardingPrivateFunctionalPackingKeyswitchEngine<LwePrivateFunctionalPackingKeyswitchKey32, LweCiphertextVector32, GlweCiphertext32> for DefaultEngine
§Description:
Implementation of
LweCiphertextVectorGlweCiphertextDiscardingPrivateFunctionalPackingKeyswitchEngine for
DefaultEngine that operates on 32 bits integers.
impl LweCiphertextVectorGlweCiphertextDiscardingPrivateFunctionalPackingKeyswitchEngine<LwePrivateFunctionalPackingKeyswitchKey32, LweCiphertextVector32, GlweCiphertext32> for DefaultEngine
§Description:
Implementation of
LweCiphertextVectorGlweCiphertextDiscardingPrivateFunctionalPackingKeyswitchEngine for
DefaultEngine that operates on 32 bits integers.
Source§fn discard_private_functional_packing_keyswitch_lwe_ciphertext_vector(
&mut self,
output: &mut GlweCiphertext32,
input: &LweCiphertextVector32,
pfpksk: &LwePrivateFunctionalPackingKeyswitchKey32,
) -> Result<(), LweCiphertextVectorGlweCiphertextDiscardingPrivateFunctionalPackingKeyswitchError<Self::EngineError>>
fn discard_private_functional_packing_keyswitch_lwe_ciphertext_vector( &mut self, output: &mut GlweCiphertext32, input: &LweCiphertextVector32, pfpksk: &LwePrivateFunctionalPackingKeyswitchKey32, ) -> Result<(), LweCiphertextVectorGlweCiphertextDiscardingPrivateFunctionalPackingKeyswitchError<Self::EngineError>>
§Example:
use concrete_core::prelude::{
DecompositionBaseLog, DecompositionLevelCount, LweDimension, Variance, *,
};
// 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];
// 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 val = vec![1_u32; output_key.polynomial_size().0];
let polynomial: CleartextVector32 = engine.create_cleartext_vector_from(&val)?;
let private_functional_packing_keyswitch_key = engine
.generate_new_lwe_private_functional_packing_keyswitch_key(
&input_key,
&output_key,
decomposition_level_count,
decomposition_base_log,
StandardDev(noise.get_standard_dev()),
&|x| x,
&polynomial,
)?;
let plaintext_vector = engine.create_plaintext_vector_from(&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_private_functional_packing_keyswitch_lwe_ciphertext_vector(
&mut ciphertext_output,
&ciphertext_vector,
&private_functional_packing_keyswitch_key,
)?;
assert_eq!(ciphertext_output.glwe_dimension(), output_glwe_dimension);
Source§unsafe fn discard_private_functional_packing_keyswitch_lwe_ciphertext_vector_unchecked(
&mut self,
output: &mut GlweCiphertext32,
input: &LweCiphertextVector32,
pfpksk: &LwePrivateFunctionalPackingKeyswitchKey32,
)
unsafe fn discard_private_functional_packing_keyswitch_lwe_ciphertext_vector_unchecked( &mut self, output: &mut GlweCiphertext32, input: &LweCiphertextVector32, pfpksk: &LwePrivateFunctionalPackingKeyswitchKey32, )
Unsafely keyswitches an LWE ciphertext vector using a private functional packing
keyswitch key. Read more
Source§impl LwePrivateFunctionalLwePackingKeyswitchKeyGenerationEngine<LweSecretKey32, GlweSecretKey32, LwePrivateFunctionalPackingKeyswitchKey32, CleartextVector32, u32> for DefaultEngine
§Description:
Implementation of LwePrivateFunctionalLwePackingKeyswitchKeyGenerationEngine for
DefaultEngine that operates on 32 bits integers.
Note that the function applied during keyswitching is of the form m -> m * pol for a polynomial
pol. The input polynomial should be a cleartext vector containing the coefficients of pol
starting with the constant term.
impl LwePrivateFunctionalLwePackingKeyswitchKeyGenerationEngine<LweSecretKey32, GlweSecretKey32, LwePrivateFunctionalPackingKeyswitchKey32, CleartextVector32, u32> for DefaultEngine
§Description:
Implementation of LwePrivateFunctionalLwePackingKeyswitchKeyGenerationEngine for
DefaultEngine that operates on 32 bits integers.
Note that the function applied during keyswitching is of the form m -> m * pol for a polynomial
pol. The input polynomial should be a cleartext vector containing the coefficients of pol
starting with the constant term.
Source§fn generate_new_lwe_private_functional_packing_keyswitch_key(
&mut self,
input_key: &LweSecretKey32,
output_key: &GlweSecretKey32,
decomposition_level_count: DecompositionLevelCount,
decomposition_base_log: DecompositionBaseLog,
noise: StandardDev,
f: &dyn Fn(u32) -> u32,
polynomial: &CleartextVector32,
) -> Result<LwePrivateFunctionalPackingKeyswitchKey32, LwePrivateFunctionalLwePackingKeyswitchKeyGenerationError<Self::EngineError>>
fn generate_new_lwe_private_functional_packing_keyswitch_key( &mut self, input_key: &LweSecretKey32, output_key: &GlweSecretKey32, decomposition_level_count: DecompositionLevelCount, decomposition_base_log: DecompositionBaseLog, noise: StandardDev, f: &dyn Fn(u32) -> u32, polynomial: &CleartextVector32, ) -> Result<LwePrivateFunctionalPackingKeyswitchKey32, LwePrivateFunctionalLwePackingKeyswitchKeyGenerationError<Self::EngineError>>
§Example:
use concrete_core::prelude::Variance;
use concrete_core::prelude::{
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.));
// 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 val = vec![1_u32; output_key.polynomial_size().0];
let polynomial: CleartextVector32 = engine.create_cleartext_vector_from(&val)?;
let private_functional_packing_keyswitch_key = engine
.generate_new_lwe_private_functional_packing_keyswitch_key(
&input_key,
&output_key,
decomposition_level_count,
decomposition_base_log,
StandardDev(noise.get_standard_dev()),
&|x|x,
&polynomial,
)?;
assert_eq!(
assert_eq!(
assert_eq!(private_functional_packing_keyswitch_key.input_lwe_dimension(),
input_lwe_dimension);
assert_eq!(private_functional_packing_keyswitch_key.output_glwe_dimension(),
output_glwe_dimension);
Source§unsafe fn generate_new_lwe_private_functional_packing_keyswitch_key_unchecked(
&mut self,
input_key: &LweSecretKey32,
output_key: &GlweSecretKey32,
decomposition_level_count: DecompositionLevelCount,
decomposition_base_log: DecompositionBaseLog,
noise: StandardDev,
f: &dyn Fn(u32) -> u32,
polynomial: &CleartextVector32,
) -> LwePrivateFunctionalPackingKeyswitchKey32
unsafe fn generate_new_lwe_private_functional_packing_keyswitch_key_unchecked( &mut self, input_key: &LweSecretKey32, output_key: &GlweSecretKey32, decomposition_level_count: DecompositionLevelCount, decomposition_base_log: DecompositionBaseLog, noise: StandardDev, f: &dyn Fn(u32) -> u32, polynomial: &CleartextVector32, ) -> LwePrivateFunctionalPackingKeyswitchKey32
Unsafely generates a new private functional packing keyswitch key. Read more
Source§impl LwePrivateFunctionalPackingKeyswitchKeyEntity for LwePrivateFunctionalPackingKeyswitchKey32
impl LwePrivateFunctionalPackingKeyswitchKeyEntity for LwePrivateFunctionalPackingKeyswitchKey32
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 PartialEq for LwePrivateFunctionalPackingKeyswitchKey32
impl PartialEq for LwePrivateFunctionalPackingKeyswitchKey32
Source§fn eq(&self, other: &LwePrivateFunctionalPackingKeyswitchKey32) -> bool
fn eq(&self, other: &LwePrivateFunctionalPackingKeyswitchKey32) -> bool
Tests for
self and other values to be equal, and is used by ==.impl Eq for LwePrivateFunctionalPackingKeyswitchKey32
impl StructuralPartialEq for LwePrivateFunctionalPackingKeyswitchKey32
Auto Trait Implementations§
impl Freeze for LwePrivateFunctionalPackingKeyswitchKey32
impl RefUnwindSafe for LwePrivateFunctionalPackingKeyswitchKey32
impl Send for LwePrivateFunctionalPackingKeyswitchKey32
impl Sync for LwePrivateFunctionalPackingKeyswitchKey32
impl Unpin for LwePrivateFunctionalPackingKeyswitchKey32
impl UnwindSafe for LwePrivateFunctionalPackingKeyswitchKey32
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
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>
Converts
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>
Converts
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