pub struct LweBootstrapKeyView64<'a>(/* private fields */);Expand description
A structure representing an LWE bootstrap key with 64 bits of precision.
By view here, we mean that the entity does not own the data, but immutably borrows it.
§Notes:
This view is not Clone as Clone for a slice is not defined. It is not Deserialize either, as Deserialize of a slice is not defined. Immutable variant.
Trait Implementations§
Source§impl AbstractEntity for LweBootstrapKeyView64<'_>
impl AbstractEntity for LweBootstrapKeyView64<'_>
Source§type Kind = LweBootstrapKeyKind
type Kind = LweBootstrapKeyKind
The kind of the entity.
Source§impl<'a> Debug for LweBootstrapKeyView64<'a>
impl<'a> Debug for LweBootstrapKeyView64<'a>
Source§impl<'data> LweBootstrapKeyConsumingRetrievalEngine<LweBootstrapKeyView64<'data>, &'data [u64]> for DefaultEngine
impl<'data> LweBootstrapKeyConsumingRetrievalEngine<LweBootstrapKeyView64<'data>, &'data [u64]> for DefaultEngine
Source§fn consume_retrieve_lwe_bootstrap_key(
&mut self,
bootstrap_key: LweBootstrapKeyView64<'data>,
) -> Result<&'data [u64], LweBootstrapKeyConsumingRetrievalError<Self::EngineError>>
fn consume_retrieve_lwe_bootstrap_key( &mut self, bootstrap_key: LweBootstrapKeyView64<'data>, ) -> Result<&'data [u64], LweBootstrapKeyConsumingRetrievalError<Self::EngineError>>
§Example:
use concrete_core::prelude::{
DecompositionBaseLog, DecompositionLevelCount, GlweDimension, LweDimension, PolynomialSize,
*,
};
// DISCLAIMER: the parameters used here are only for test purpose, and are not secure.
let lwe_dimension = LweDimension(2);
let glwe_size = GlweSize(2);
let polynomial_size = PolynomialSize(256);
let level = DecompositionLevelCount(2);
let base_log = DecompositionBaseLog(1);
// 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 owned_container =
vec![0_u64; lwe_dimension.0 * level.0 * glwe_size.0 * glwe_size.0 * polynomial_size.0];
let slice = owned_container.as_slice();
let lwe_bootstrap_key: LweBootstrapKeyView64 =
engine.create_lwe_bootstrap_key_from(slice, glwe_size, polynomial_size, base_log, level)?;
let retrieved_slice = engine.consume_retrieve_lwe_bootstrap_key(lwe_bootstrap_key)?;
assert_eq!(slice, retrieved_slice);Source§unsafe fn consume_retrieve_lwe_bootstrap_key_unchecked(
&mut self,
bootstrap_key: LweBootstrapKeyView64<'data>,
) -> &'data [u64]
unsafe fn consume_retrieve_lwe_bootstrap_key_unchecked( &mut self, bootstrap_key: LweBootstrapKeyView64<'data>, ) -> &'data [u64]
Unsafely retrieves the content of the container from an LWE bootstrap key, consuming it in
the process. Read more
Source§impl<'data> LweBootstrapKeyCreationEngine<&'data [u64], LweBootstrapKeyView64<'data>> for DefaultEngine
impl<'data> LweBootstrapKeyCreationEngine<&'data [u64], LweBootstrapKeyView64<'data>> for DefaultEngine
Source§fn create_lwe_bootstrap_key_from(
&mut self,
container: &'data [u64],
glwe_size: GlweSize,
poly_size: PolynomialSize,
decomposition_base_log: DecompositionBaseLog,
decomposition_level_count: DecompositionLevelCount,
) -> Result<LweBootstrapKeyView64<'data>, LweBootstrapKeyCreationError<Self::EngineError>>
fn create_lwe_bootstrap_key_from( &mut self, container: &'data [u64], glwe_size: GlweSize, poly_size: PolynomialSize, decomposition_base_log: DecompositionBaseLog, decomposition_level_count: DecompositionLevelCount, ) -> Result<LweBootstrapKeyView64<'data>, LweBootstrapKeyCreationError<Self::EngineError>>
§Example:
use concrete_core::prelude::{
DecompositionBaseLog, DecompositionLevelCount, GlweDimension, LweDimension, PolynomialSize,
*,
};
// DISCLAIMER: the parameters used here are only for test purpose, and are not secure.
let lwe_dimension = LweDimension(2);
let glwe_size = GlweSize(2);
let polynomial_size = PolynomialSize(256);
let level = DecompositionLevelCount(2);
let base_log = DecompositionBaseLog(1);
// 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 owned_container =
vec![0_u64; lwe_dimension.0 * level.0 * glwe_size.0 * glwe_size.0 * polynomial_size.0];
let slice = owned_container.as_slice();
let lwe_bootstrap_key: LweBootstrapKeyView64 =
engine.create_lwe_bootstrap_key_from(slice, glwe_size, polynomial_size, base_log, level)?;
Source§unsafe fn create_lwe_bootstrap_key_from_unchecked(
&mut self,
container: &'data [u64],
glwe_size: GlweSize,
poly_size: PolynomialSize,
decomposition_base_log: DecompositionBaseLog,
decomposition_level_count: DecompositionLevelCount,
) -> LweBootstrapKeyView64<'data>
unsafe fn create_lwe_bootstrap_key_from_unchecked( &mut self, container: &'data [u64], glwe_size: GlweSize, poly_size: PolynomialSize, decomposition_base_log: DecompositionBaseLog, decomposition_level_count: DecompositionLevelCount, ) -> LweBootstrapKeyView64<'data>
Unsafely creates an LWE bootstrap key from an existing container. Read more
Source§impl LweBootstrapKeyEntity for LweBootstrapKeyView64<'_>
impl LweBootstrapKeyEntity for LweBootstrapKeyView64<'_>
Source§fn glwe_dimension(&self) -> GlweDimension
fn glwe_dimension(&self) -> GlweDimension
Returns the GLWE dimension of the key.
Source§fn polynomial_size(&self) -> PolynomialSize
fn polynomial_size(&self) -> PolynomialSize
Returns the polynomial size of the key.
Source§fn input_lwe_dimension(&self) -> LweDimension
fn input_lwe_dimension(&self) -> LweDimension
Returns the input LWE dimension of the key.
Source§fn decomposition_base_log(&self) -> DecompositionBaseLog
fn decomposition_base_log(&self) -> DecompositionBaseLog
Returns the number of decomposition levels of the key.
Source§fn decomposition_level_count(&self) -> DecompositionLevelCount
fn decomposition_level_count(&self) -> DecompositionLevelCount
Returns the logarithm of the base used in the key.
Source§fn output_lwe_dimension(&self) -> LweDimension
fn output_lwe_dimension(&self) -> LweDimension
Returns the output LWE dimension of the key.
Source§impl<'a> PartialEq for LweBootstrapKeyView64<'a>
impl<'a> PartialEq for LweBootstrapKeyView64<'a>
impl<'a> Eq for LweBootstrapKeyView64<'a>
impl<'a> StructuralPartialEq for LweBootstrapKeyView64<'a>
Auto Trait Implementations§
impl<'a> Freeze for LweBootstrapKeyView64<'a>
impl<'a> RefUnwindSafe for LweBootstrapKeyView64<'a>
impl<'a> Send for LweBootstrapKeyView64<'a>
impl<'a> Sync for LweBootstrapKeyView64<'a>
impl<'a> Unpin for LweBootstrapKeyView64<'a>
impl<'a> UnwindSafe for LweBootstrapKeyView64<'a>
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> 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