Struct concrete_core::crypto::lwe::LweMask[][src]

pub struct LweMask<Cont> { /* fields omitted */ }
Expand description

The mask of an LWE encrypted ciphertext.

Implementations

Creates a mask from a scalar container.

Example

use concrete_core::crypto::lwe::*;
use concrete_core::crypto::LweDimension;
let masks = LweMask::from_container(vec![0 as u8; 10]);
assert_eq!(masks.mask_size(), LweDimension(10));

Returns an iterator over the mask elements.

Example

use concrete_core::crypto::lwe::*;
let mut ciphertext = LweCiphertext::from_container(vec![0 as u8; 10]);
let masks = ciphertext.get_mask();
for mask in masks.mask_element_iter(){
    assert_eq!(mask, &0);
}
assert_eq!(masks.mask_element_iter().count(), 9);

Returns an iterator over mutable mask elements.

Example

use concrete_core::crypto::lwe::*;
let mut ciphertext = LweCiphertext::from_container(vec![0 as u8; 10]);
let mut masks = ciphertext.get_mut_mask();
for mask in masks.mask_element_iter_mut(){
    *mask = 9;
}
for mask in masks.mask_element_iter(){
    assert_eq!(mask, &9);
}
assert_eq!(masks.mask_element_iter_mut().count(), 9);

Returns the number of masks.

Example

use concrete_core::crypto::lwe::*;
use concrete_core::crypto::LweDimension;
let mut ciphertext = LweCiphertext::from_container(vec![0 as u8; 10]);
assert_eq!(ciphertext.get_mask().mask_size(), LweDimension(9));

Computes sum of the mask elements wighted by the key bits.

Example

use concrete_core::crypto::lwe::LweCiphertext;
use concrete_core::crypto::secret::LweSecretKey;
let ciphertext = LweCiphertext::from_container(vec![1u32,2,3,4,5]);
let mask = ciphertext.get_mask();
let key = LweSecretKey::from_container(vec![true, true, false, true]);
let multisum = mask.compute_binary_multisum(&key);
assert_eq!(multisum, 7);

Trait Implementations

The element type.

The container used by the tensor.

Returns a mutable reference to the enclosed tensor.

The element type.

The container used by the tensor.

Returns a mutable reference to the enclosed tensor.

The element type.

The container used by the tensor.

Returns a mutable reference to the enclosed tensor.

The element type.

The container used by the tensor.

Returns a mutable reference to the enclosed tensor.

The element type.

The container used by the tensor.

Returns a reference to the enclosed tensor.

The element type.

The container used by the tensor.

Returns a reference to the enclosed tensor.

The element type.

The container used by the tensor.

Returns a reference to the enclosed tensor.

The element type.

The container used by the tensor.

Returns a reference to the enclosed tensor.

The element type.

The container used by the tensor.

Returns a reference to the enclosed tensor.

Formats the value using the given formatter. Read more

The element type of the collection container.

The type of the collection container.

Consumes self and returns an owned tensor.

The element type of the collection container.

The type of the collection container.

Consumes self and returns an owned tensor.

The element type of the collection container.

The type of the collection container.

Consumes self and returns an owned tensor.

The element type of the collection container.

The type of the collection container.

Consumes self and returns an owned tensor.

The element type of the collection container.

The type of the collection container.

Consumes self and returns an owned tensor.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

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

Performs the conversion.

Performs the conversion.

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.