Struct concrete_core::crypto::glwe::GlweMask[][src]

pub struct GlweMask<Cont> { /* fields omitted */ }

The mask of a GLWE ciphertext

Implementations

impl<Cont> GlweMask<Cont>[src]

pub fn mask_element_iter(
    &self
) -> impl Iterator<Item = GlweMaskElement<&[Self::Element]>> where
    Self: AsRefTensor
[src]

Returns an iterator over borrowed mask elements contained in the mask.

Example

use concrete_core::crypto::{*, glwe::*};
use concrete_core::math::polynomial::PolynomialSize;
let rlwe_ciphertext = GlweCiphertext::allocate(0 as u8, PolynomialSize(10), GlweSize(100));
for mask in rlwe_ciphertext.get_mask().mask_element_iter(){
    assert_eq!(mask.as_polynomial().polynomial_size(), PolynomialSize(10));
}
assert_eq!(rlwe_ciphertext.get_mask().mask_element_iter().count(), 99);

pub fn mask_element_iter_mut(
    &mut self
) -> impl Iterator<Item = GlweMaskElement<&mut [Self::Element]>> where
    Self: AsMutTensor
[src]

Returns an iterator over mutably borrowed mask elements contained in the mask.

Example

use concrete_core::crypto::{*, glwe::*};
use concrete_core::math::polynomial::PolynomialSize;
use concrete_core::math::tensor::{AsMutTensor, AsRefTensor};
let mut rlwe = GlweCiphertext::allocate(0 as u8, PolynomialSize(10), GlweSize(100));
for mut mask in rlwe.get_mut_mask().mask_element_iter_mut(){
    mask.as_mut_tensor().fill_with_element(9);
}
assert!(rlwe.get_mask().as_tensor().iter().all(|a| *a==9));
assert_eq!(rlwe.get_mask().mask_element_iter().count(), 99);

pub fn as_polynomial_list(&self) -> PolynomialList<&[Self::Element]> where
    Self: AsRefTensor
[src]

Returns a borrowed polynomial list from the current mask.

Example

use concrete_core::crypto::{*, glwe::*};
use concrete_core::math::polynomial::{PolynomialSize, PolynomialCount};
use concrete_core::math::tensor::{AsMutTensor, AsRefTensor};
let rlwe = GlweCiphertext::allocate(0 as u8, PolynomialSize(10), GlweSize(100));
let masks = rlwe.get_mask();
let list = masks.as_polynomial_list();
assert_eq!(list.polynomial_size(), PolynomialSize(10));
assert_eq!(list.polynomial_count(), PolynomialCount(99));

pub fn as_mut_polynomial_list(&mut self) -> PolynomialList<&mut [Self::Element]> where
    Self: AsMutTensor
[src]

Returns a mutably borrowed polynomial list from the current mask list.

Example

use concrete_core::crypto::{*, glwe::*};
use concrete_core::math::polynomial::{PolynomialSize, PolynomialCount};
use concrete_core::math::tensor::{AsMutTensor, AsRefTensor};
let mut rlwe = GlweCiphertext::allocate(0 as u8, PolynomialSize(10), GlweSize(100));
let mut masks = rlwe.get_mut_mask();
let mut tensor = masks.as_mut_polynomial_list();
assert_eq!(tensor.polynomial_size(), PolynomialSize(10));
assert_eq!(tensor.polynomial_count(), PolynomialCount(99));

Trait Implementations

impl<Element> AsMutTensor for GlweMask<Vec<Element>>[src]

type Element = Element

The element type.

type Container = Vec<Element>

The container used by the tensor.

impl<Element> AsMutTensor for GlweMask<[Element; 1]>[src]

type Element = Element

The element type.

type Container = [Element; 1]

The container used by the tensor.

impl<Element> AsMutTensor for GlweMask<AlignedVec<Element>>[src]

type Element = Element

The element type.

type Container = AlignedVec<Element>

The container used by the tensor.

impl<'a, Element> AsMutTensor for GlweMask<&'a mut [Element]>[src]

type Element = Element

The element type.

type Container = &'a mut [Element]

The container used by the tensor.

impl<Element> AsRefTensor for GlweMask<Vec<Element>>[src]

type Element = Element

The element type.

type Container = Vec<Element>

The container used by the tensor.

impl<Element> AsRefTensor for GlweMask<AlignedVec<Element>>[src]

type Element = Element

The element type.

type Container = AlignedVec<Element>

The container used by the tensor.

impl<Element> AsRefTensor for GlweMask<[Element; 1]>[src]

type Element = Element

The element type.

type Container = [Element; 1]

The container used by the tensor.

impl<'a, Element> AsRefTensor for GlweMask<&'a [Element]>[src]

type Element = Element

The element type.

type Container = &'a [Element]

The container used by the tensor.

impl<'a, Element> AsRefTensor for GlweMask<&'a mut [Element]>[src]

type Element = Element

The element type.

type Container = &'a mut [Element]

The container used by the tensor.

impl<Element> IntoTensor for GlweMask<Vec<Element>>[src]

type Element = Element

The element type of the collection container.

type Container = Vec<Element>

The type of the collection container.

impl<Element> IntoTensor for GlweMask<AlignedVec<Element>>[src]

type Element = Element

The element type of the collection container.

type Container = AlignedVec<Element>

The type of the collection container.

impl<Element> IntoTensor for GlweMask<[Element; 1]>[src]

type Element = Element

The element type of the collection container.

type Container = [Element; 1]

The type of the collection container.

impl<'a, Element> IntoTensor for GlweMask<&'a [Element]>[src]

type Element = Element

The element type of the collection container.

type Container = &'a [Element]

The type of the collection container.

impl<'a, Element> IntoTensor for GlweMask<&'a mut [Element]>[src]

type Element = Element

The element type of the collection container.

type Container = &'a mut [Element]

The type of the collection container.

Auto Trait Implementations

impl<Cont> RefUnwindSafe for GlweMask<Cont> where
    Cont: RefUnwindSafe

impl<Cont> Send for GlweMask<Cont> where
    Cont: Send

impl<Cont> Sync for GlweMask<Cont> where
    Cont: Sync

impl<Cont> Unpin for GlweMask<Cont> where
    Cont: Unpin

impl<Cont> UnwindSafe for GlweMask<Cont> where
    Cont: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<Input, Output> CastInto<Output> for Input where
    Output: CastFrom<Input>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.