pub struct LwePrivateFunctionalPackingKeyswitchKey64(pub LwePrivateFunctionalPackingKeyswitchKey<Vec<u64>>);Expand description
A structure representing a private functional packing keyswitch key with 64 bits of precision.
Tuple Fields§
§0: LwePrivateFunctionalPackingKeyswitchKey<Vec<u64>>Trait Implementations§
Source§impl AbstractEntity for LwePrivateFunctionalPackingKeyswitchKey64
impl AbstractEntity for LwePrivateFunctionalPackingKeyswitchKey64
Source§type Kind = LwePrivateFunctionalPackingKeyswitchKeyKind
type Kind = LwePrivateFunctionalPackingKeyswitchKeyKind
The kind of the entity.
Source§impl Clone for LwePrivateFunctionalPackingKeyswitchKey64
impl Clone for LwePrivateFunctionalPackingKeyswitchKey64
Source§fn clone(&self) -> LwePrivateFunctionalPackingKeyswitchKey64
fn clone(&self) -> LwePrivateFunctionalPackingKeyswitchKey64
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<LwePrivateFunctionalPackingKeyswitchKey64, LweCiphertextVector64, GlweCiphertext64> for DefaultEngine
§Description:
Implementation of
LweCiphertextVectorGlweCiphertextDiscardingPrivateFunctionalPackingKeyswitchEngine for
DefaultEngine that operates on 64 bits integers.
impl LweCiphertextVectorGlweCiphertextDiscardingPrivateFunctionalPackingKeyswitchEngine<LwePrivateFunctionalPackingKeyswitchKey64, LweCiphertextVector64, GlweCiphertext64> for DefaultEngine
§Description:
Implementation of
LweCiphertextVectorGlweCiphertextDiscardingPrivateFunctionalPackingKeyswitchEngine for
DefaultEngine that operates on 64 bits integers.
Source§fn discard_private_functional_packing_keyswitch_lwe_ciphertext_vector(
&mut self,
output: &mut GlweCiphertext64,
input: &LweCiphertextVector64,
pfpksk: &LwePrivateFunctionalPackingKeyswitchKey64,
) -> Result<(), LweCiphertextVectorGlweCiphertextDiscardingPrivateFunctionalPackingKeyswitchError<Self::EngineError>>
fn discard_private_functional_packing_keyswitch_lwe_ciphertext_vector( &mut self, output: &mut GlweCiphertext64, input: &LweCiphertextVector64, pfpksk: &LwePrivateFunctionalPackingKeyswitchKey64, ) -> 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 50 bits)
let input_vector = vec![3_u64 << 50, 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: 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 val = vec![1_u64; output_key.polynomial_size().0];
let polynomial: CleartextVector64 = 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 GlweCiphertext64,
input: &LweCiphertextVector64,
pfpksk: &LwePrivateFunctionalPackingKeyswitchKey64,
)
unsafe fn discard_private_functional_packing_keyswitch_lwe_ciphertext_vector_unchecked( &mut self, output: &mut GlweCiphertext64, input: &LweCiphertextVector64, pfpksk: &LwePrivateFunctionalPackingKeyswitchKey64, )
Unsafely keyswitches an LWE ciphertext vector using a private functional packing
keyswitch key. Read more
Source§impl LwePrivateFunctionalLwePackingKeyswitchKeyGenerationEngine<LweSecretKey64, GlweSecretKey64, LwePrivateFunctionalPackingKeyswitchKey64, CleartextVector64, u64> for DefaultEngine
§Description:
Implementation of LwePrivateFunctionalLwePackingKeyswitchKeyGenerationEngine for
DefaultEngine that operates on 64 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<LweSecretKey64, GlweSecretKey64, LwePrivateFunctionalPackingKeyswitchKey64, CleartextVector64, u64> for DefaultEngine
§Description:
Implementation of LwePrivateFunctionalLwePackingKeyswitchKeyGenerationEngine for
DefaultEngine that operates on 64 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: &LweSecretKey64,
output_key: &GlweSecretKey64,
decomposition_level_count: DecompositionLevelCount,
decomposition_base_log: DecompositionBaseLog,
noise: StandardDev,
f: &dyn Fn(u64) -> u64,
polynomial: &CleartextVector64,
) -> Result<LwePrivateFunctionalPackingKeyswitchKey64, LwePrivateFunctionalLwePackingKeyswitchKeyGenerationError<Self::EngineError>>
fn generate_new_lwe_private_functional_packing_keyswitch_key( &mut self, input_key: &LweSecretKey64, output_key: &GlweSecretKey64, decomposition_level_count: DecompositionLevelCount, decomposition_base_log: DecompositionBaseLog, noise: StandardDev, f: &dyn Fn(u64) -> u64, polynomial: &CleartextVector64, ) -> Result<LwePrivateFunctionalPackingKeyswitchKey64, 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(6);
let output_glwe_dimension = GlweDimension(3);
let polynomial_size = PolynomialSize(256);
let decomposition_level_count = DecompositionLevelCount(2);
let decomposition_base_log = DecompositionBaseLog(8);
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 val = vec![1_u64; output_key.polynomial_size().0];
let polynomial: CleartextVector64 = 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: &LweSecretKey64,
output_key: &GlweSecretKey64,
decomposition_level_count: DecompositionLevelCount,
decomposition_base_log: DecompositionBaseLog,
noise: StandardDev,
f: &dyn Fn(u64) -> u64,
polynomial: &CleartextVector64,
) -> LwePrivateFunctionalPackingKeyswitchKey64
unsafe fn generate_new_lwe_private_functional_packing_keyswitch_key_unchecked( &mut self, input_key: &LweSecretKey64, output_key: &GlweSecretKey64, decomposition_level_count: DecompositionLevelCount, decomposition_base_log: DecompositionBaseLog, noise: StandardDev, f: &dyn Fn(u64) -> u64, polynomial: &CleartextVector64, ) -> LwePrivateFunctionalPackingKeyswitchKey64
Unsafely generates a new private functional packing keyswitch key. Read more
Source§impl LwePrivateFunctionalPackingKeyswitchKeyEntity for LwePrivateFunctionalPackingKeyswitchKey64
impl LwePrivateFunctionalPackingKeyswitchKeyEntity for LwePrivateFunctionalPackingKeyswitchKey64
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 LwePrivateFunctionalPackingKeyswitchKey64
impl PartialEq for LwePrivateFunctionalPackingKeyswitchKey64
Source§fn eq(&self, other: &LwePrivateFunctionalPackingKeyswitchKey64) -> bool
fn eq(&self, other: &LwePrivateFunctionalPackingKeyswitchKey64) -> bool
Tests for
self and other values to be equal, and is used by ==.impl Eq for LwePrivateFunctionalPackingKeyswitchKey64
impl StructuralPartialEq for LwePrivateFunctionalPackingKeyswitchKey64
Auto Trait Implementations§
impl Freeze for LwePrivateFunctionalPackingKeyswitchKey64
impl RefUnwindSafe for LwePrivateFunctionalPackingKeyswitchKey64
impl Send for LwePrivateFunctionalPackingKeyswitchKey64
impl Sync for LwePrivateFunctionalPackingKeyswitchKey64
impl Unpin for LwePrivateFunctionalPackingKeyswitchKey64
impl UnwindSafe for LwePrivateFunctionalPackingKeyswitchKey64
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