pub struct LweKeyswitchKeyMutView64<'a>(_);
Expand description

A structure representing an LWE keyswitch key with 64 bits of precision.

By view here, we mean that the entity does not own the data, but mutably 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. Mutable variant.

Trait Implementations

The kind of the entity.
Formats the value using the given formatter. Read more
Example:
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_lwe_dimension = LweDimension(3);
let decomposition_level_count = DecompositionLevelCount(2);
let decomposition_base_log = DecompositionBaseLog(8);
let noise = Variance(2_f64.powf(-50.));

// 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 mut owned_container = vec![
    0u64;
    input_lwe_dimension.0
        * output_lwe_dimension.to_lwe_size().0
        * decomposition_level_count.0
];
let slice = owned_container.as_mut_slice();
let underlying_ptr = slice.as_ptr();

let keyswitch_key: LweKeyswitchKeyMutView64 = engine.create_lwe_keyswitch_key_from(
    slice,
    output_lwe_dimension,
    decomposition_base_log,
    decomposition_level_count,
)?;
let retrieved_slice = engine.consume_retrieve_lwe_keyswitch_key(keyswitch_key)?;

assert_eq!(underlying_ptr, retrieved_slice.as_ptr());
Unsafely retrieves the content of the container from an LWE keyswitch key, consuming it in the process. Read more
Example:
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_lwe_dimension = LweDimension(3);
let decomposition_level_count = DecompositionLevelCount(2);
let decomposition_base_log = DecompositionBaseLog(8);
let noise = Variance(2_f64.powf(-50.));

// 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 mut owned_container = vec![
    0u64;
    input_lwe_dimension.0
        * output_lwe_dimension.to_lwe_size().0
        * decomposition_level_count.0
];

let keyswitch_key: LweKeyswitchKeyMutView64 = engine.create_lwe_keyswitch_key_from(
    owned_container.as_mut_slice(),
    output_lwe_dimension,
    decomposition_base_log,
    decomposition_level_count,
)?;

assert_eq!(
    keyswitch_key.decomposition_level_count(),
    decomposition_level_count
);
assert_eq!(
    keyswitch_key.decomposition_base_log(),
    decomposition_base_log
);
assert_eq!(keyswitch_key.input_lwe_dimension(), input_lwe_dimension);
assert_eq!(keyswitch_key.output_lwe_dimension(), output_lwe_dimension);
Unsafely creates an LWE keyswitch key from an existing container. Read more
Example:
use concrete_core::prelude::Variance;
use concrete_core::prelude::{
    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_lwe_dimension = LweDimension(3);
let decomposition_level_count = DecompositionLevelCount(2);
let decomposition_base_log = DecompositionBaseLog(8);
let noise = Variance(2_f64.powf(-50.));

// 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: LweSecretKey64 = engine.generate_new_lwe_secret_key(output_lwe_dimension)?;

let keyswitch_key = engine.generate_new_lwe_keyswitch_key(
    &input_key,
    &output_key,
    decomposition_level_count,
    decomposition_base_log,
    noise,
)?;

let mut owned_container = vec![
    0_u64;
    decomposition_level_count.0 * output_lwe_dimension.to_lwe_size().0 * input_lwe_dimension.0
];

let mut out_ksk_mut_view: LweKeyswitchKeyMutView64 = engine.create_lwe_keyswitch_key_from(
    owned_container.as_mut_slice(),
    output_lwe_dimension,
    decomposition_base_log,
    decomposition_level_count,
)?;

assert_eq!(
assert_eq!(
assert_eq!(out_ksk_mut_view.input_lwe_dimension(), input_lwe_dimension);
assert_eq!(out_ksk_mut_view.output_lwe_dimension(), output_lwe_dimension);
Unsafely converts a LWE keyswitch key . Read more
Returns the input LWE dimension of the key.
Returns the output lew dimension of the key.
Returns the number of decomposition levels of the key.
Returns the logarithm of the base used in the key.
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The alignment of pointer.
The type for initializers.
Initializes a with the given initializer. Read more
Dereferences the given pointer. Read more
Mutably dereferences the given pointer. Read more
Drops the object pointed to by the given pointer. Read more
Should always be Self
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.