FunctionalPackingKeyswitchKey64

Struct FunctionalPackingKeyswitchKey64 

Source
pub struct FunctionalPackingKeyswitchKey64(pub FunctionalPackingKeyswitchKey<Vec<u64>>);
Expand description

A structure representing a functional packing keyswitch key with 64 bits of precision.

Tuple Fields§

§0: FunctionalPackingKeyswitchKey<Vec<u64>>

Trait Implementations§

Source§

impl AbstractEntity for FunctionalPackingKeyswitchKey64

Source§

type Kind = FunctionalPackingKeyswitchKeyKind

The kind of the entity.
Source§

impl Clone for FunctionalPackingKeyswitchKey64

Source§

fn clone(&self) -> FunctionalPackingKeyswitchKey64

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for FunctionalPackingKeyswitchKey64

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl DestructionEngine<FunctionalPackingKeyswitchKey64> for CoreEngine

Source§

fn destroy( &mut self, entity: FunctionalPackingKeyswitchKey64, ) -> Result<(), DestructionError<Self::EngineError>>

Destroys an entity.
Source§

unsafe fn destroy_unchecked( &mut self, entity: &mut FunctionalPackingKeyswitchKey64, )

Unsafely destroys an entity. Read more
Source§

impl FunctionalPackingKeyswitchKeyCreationEngine<LweSecretKey64, GlweSecretKey64, FunctionalPackingKeyswitchKey64, CleartextVector64, u64> for CoreEngine

§Description:

Implementation of FunctionalPackingKeyswitchKeyCreationEngine for CoreEngine that operates on 64 bits integers.

Source§

fn create_functional_packing_keyswitch_key<F: Fn(u64) -> u64>( &mut self, input_key: &LweSecretKey64, output_key: &GlweSecretKey64, decomposition_level_count: DecompositionLevelCount, decomposition_base_log: DecompositionBaseLog, noise: StandardDev, f: F, polynomial: &CleartextVector64, ) -> Result<FunctionalPackingKeyswitchKey64, FunctionalPackingKeyswitchKeyCreationError<Self::EngineError>>

Creates a functional packing keyswitch key.
Source§

unsafe fn create_functional_packing_keyswitch_key_unchecked<F: Fn(u64) -> u64>( &mut self, input_key: &LweSecretKey64, output_key: &GlweSecretKey64, decomposition_level_count: DecompositionLevelCount, decomposition_base_log: DecompositionBaseLog, noise: StandardDev, f: F, polynomial: &CleartextVector64, ) -> FunctionalPackingKeyswitchKey64

Unsafely creates a functional packing keyswitch key. Read more
Source§

impl FunctionalPackingKeyswitchKeyEntity for FunctionalPackingKeyswitchKey64

Source§

type InputKeyDistribution = BinaryKeyDistribution

The distribution of the key the input ciphertext is encrypted with.
Source§

type OutputKeyDistribution = BinaryKeyDistribution

The distribution of the key the output ciphertext is encrypted with.
Source§

fn input_lwe_dimension(&self) -> LweDimension

Returns the input LWE dimension of the key.
Source§

fn output_glwe_dimension(&self) -> GlweDimension

Returns the output GLWE dimension of the key.
Source§

fn output_polynomial_size(&self) -> PolynomialSize

Returns the output polynomial degree of the key.
Source§

fn decomposition_level_count(&self) -> DecompositionLevelCount

Returns the number of decomposition levels of the key.
Source§

fn decomposition_base_log(&self) -> DecompositionBaseLog

Returns the logarithm of the base used in the key.
Source§

impl LweCiphertextVectorGlweCiphertextDiscardingFunctionalPackingKeyswitchEngine<FunctionalPackingKeyswitchKey64, LweCiphertextVector64, GlweCiphertext64> for CoreEngine

§Description:

Implementation of LweCiphertextVectorGlweCiphertextDiscardingFunctionalPackingKeyswitchEngine for CoreEngine that operates on 64 bits integers.

Source§

fn discard_functional_packing_keyswitch_lwe_ciphertext_vector( &mut self, output: &mut GlweCiphertext64, input: &LweCiphertextVector64, ksk: &FunctionalPackingKeyswitchKey64, ) -> 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 50 bits)
let input_vector = vec![3_u64 << 50, 256];

let mut engine = CoreEngine::new(())?;
let input_key: LweSecretKey64 = engine.create_lwe_secret_key(input_lwe_dimension)?;
let output_key: GlweSecretKey64 =
    engine.create_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(&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 GlweCiphertext64, input: &LweCiphertextVector64, ksk: &FunctionalPackingKeyswitchKey64, )

Unsafely functional packing keyswitches an LWE ciphertext vector. Read more
Source§

impl PartialEq for FunctionalPackingKeyswitchKey64

Source§

fn eq(&self, other: &FunctionalPackingKeyswitchKey64) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for FunctionalPackingKeyswitchKey64

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<Input, Output> CastInto<Output> for Input
where Output: CastFrom<Input>,

Source§

fn cast_into(self) -> Output

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.