Struct concrete_core::backends::core::entities::LweBootstrapKey64
source · [−]pub struct LweBootstrapKey64(_);
Expand description
A structure representing an LWE bootstrap key with 64 bits of precision.
Trait Implementations
type Kind = LweBootstrapKeyKind
type Kind = LweBootstrapKeyKind
The kind of the entity.
fn destroy(
&mut self,
entity: LweBootstrapKey64
) -> Result<(), DestructionError<Self::EngineError>>
fn destroy(
&mut self,
entity: LweBootstrapKey64
) -> Result<(), DestructionError<Self::EngineError>>
Destroys an entity.
Unsafely destroys an entity. Read more
Description:
Implementation of LweBootstrapKeyConversionEngine
for CoreEngine
that operates on
64 bits integers. It converts a bootstrap key from the standard to the Fourier domain.
fn convert_lwe_bootstrap_key(
&mut self,
input: &LweBootstrapKey64
) -> Result<FourierLweBootstrapKey64, LweBootstrapKeyConversionError<Self::EngineError>>
fn convert_lwe_bootstrap_key(
&mut self,
input: &LweBootstrapKey64
) -> Result<FourierLweBootstrapKey64, LweBootstrapKeyConversionError<Self::EngineError>>
Example
use concrete_commons::dispersion::Variance;
use concrete_commons::parameters::{
DecompositionBaseLog, DecompositionLevelCount, GlweDimension, LweDimension, PolynomialSize,
};
use concrete_core::prelude::*;
// DISCLAIMER: the parameters used here are only for test purpose, and are not secure.
let (lwe_dim, glwe_dim, poly_size) = (LweDimension(4), GlweDimension(6), PolynomialSize(256));
let (dec_lc, dec_bl) = (DecompositionLevelCount(3), DecompositionBaseLog(5));
let noise = Variance(2_f64.powf(-25.));
let mut engine = CoreEngine::new()?;
let lwe_sk: LweSecretKey64 = engine.create_lwe_secret_key(lwe_dim)?;
let glwe_sk: GlweSecretKey64 = engine.create_glwe_secret_key(glwe_dim, poly_size)?;
let bsk: LweBootstrapKey64 =
engine.create_lwe_bootstrap_key(&lwe_sk, &glwe_sk, dec_bl, dec_lc, noise)?;
let fourier_bsk: FourierLweBootstrapKey64 = engine.convert_lwe_bootstrap_key(&bsk)?;
assert_eq!(fourier_bsk.glwe_dimension(), glwe_dim);
assert_eq!(fourier_bsk.polynomial_size(), poly_size);
assert_eq!(fourier_bsk.input_lwe_dimension(), lwe_dim);
assert_eq!(fourier_bsk.decomposition_base_log(), dec_bl);
assert_eq!(fourier_bsk.decomposition_level_count(), dec_lc);
engine.destroy(lwe_sk)?;
engine.destroy(glwe_sk)?;
engine.destroy(bsk)?;
engine.destroy(fourier_bsk)?;
unsafe fn convert_lwe_bootstrap_key_unchecked(
&mut self,
input: &LweBootstrapKey64
) -> FourierLweBootstrapKey64
unsafe fn convert_lwe_bootstrap_key_unchecked(
&mut self,
input: &LweBootstrapKey64
) -> FourierLweBootstrapKey64
Unsafely converts an LWE bootstrap key. Read more
Description:
Implementation of LweBootstrapKeyCreationEngine
for CoreEngine
that operates on
64 bits integers. It outputs a bootstrap key in the standard domain.
fn create_lwe_bootstrap_key(
&mut self,
input_key: &LweSecretKey64,
output_key: &GlweSecretKey64,
decomposition_base_log: DecompositionBaseLog,
decomposition_level_count: DecompositionLevelCount,
noise: Variance
) -> Result<LweBootstrapKey64, LweBootstrapKeyCreationError<Self::EngineError>>
fn create_lwe_bootstrap_key(
&mut self,
input_key: &LweSecretKey64,
output_key: &GlweSecretKey64,
decomposition_base_log: DecompositionBaseLog,
decomposition_level_count: DecompositionLevelCount,
noise: Variance
) -> Result<LweBootstrapKey64, LweBootstrapKeyCreationError<Self::EngineError>>
Example
use concrete_commons::dispersion::Variance;
use concrete_commons::parameters::{
DecompositionBaseLog, DecompositionLevelCount, GlweDimension, LweDimension, PolynomialSize,
};
use concrete_core::prelude::*;
// DISCLAIMER: the parameters used here are only for test purpose, and are not secure.
let (lwe_dim, glwe_dim, poly_size) = (LweDimension(4), GlweDimension(6), PolynomialSize(256));
let (dec_lc, dec_bl) = (DecompositionLevelCount(3), DecompositionBaseLog(5));
let noise = Variance(2_f64.powf(-25.));
let mut engine = CoreEngine::new()?;
let lwe_sk: LweSecretKey64 = engine.create_lwe_secret_key(lwe_dim)?;
let glwe_sk: GlweSecretKey64 = engine.create_glwe_secret_key(glwe_dim, poly_size)?;
let bsk: LweBootstrapKey64 =
engine.create_lwe_bootstrap_key(&lwe_sk, &glwe_sk, dec_bl, dec_lc, noise)?;
assert_eq!(bsk.glwe_dimension(), glwe_dim);
assert_eq!(bsk.polynomial_size(), poly_size);
assert_eq!(bsk.input_lwe_dimension(), lwe_dim);
assert_eq!(bsk.decomposition_base_log(), dec_bl);
assert_eq!(bsk.decomposition_level_count(), dec_lc);
engine.destroy(lwe_sk)?;
engine.destroy(glwe_sk)?;
engine.destroy(bsk)?;
unsafe fn create_lwe_bootstrap_key_unchecked(
&mut self,
input_key: &LweSecretKey64,
output_key: &GlweSecretKey64,
decomposition_base_log: DecompositionBaseLog,
decomposition_level_count: DecompositionLevelCount,
noise: Variance
) -> LweBootstrapKey64
unsafe fn create_lwe_bootstrap_key_unchecked(
&mut self,
input_key: &LweSecretKey64,
output_key: &GlweSecretKey64,
decomposition_base_log: DecompositionBaseLog,
decomposition_level_count: DecompositionLevelCount,
noise: Variance
) -> LweBootstrapKey64
Unsafely creates an LWE bootstrap key. Read more
The distribution of key the input ciphertext is encrypted with.
The distribution of the key the output ciphertext is encrypted with.
Returns the GLWE dimension of the key.
Returns the polynomial size of the key.
Returns the input LWE dimension of the key.
Returns the number of decomposition levels of the key.
Returns the logarithm of the base used in the key.
Returns the output LWE dimension of the key.
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
This method tests for !=
.
Auto Trait Implementations
impl RefUnwindSafe for LweBootstrapKey64
impl Send for LweBootstrapKey64
impl Sync for LweBootstrapKey64
impl Unpin for LweBootstrapKey64
impl UnwindSafe for LweBootstrapKey64
Blanket Implementations
Mutably borrows from an owned value. Read more