Struct concrete_core::crypto::encoding::PlaintextList[][src]

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

A list of plaintexts

Implementations

impl<Scalar> PlaintextList<Vec<Scalar>> where
    Scalar: Copy
[src]

pub fn allocate(
    value: Scalar,
    count: PlaintextCount
) -> PlaintextList<Vec<Scalar>>
[src]

Allocates a new list of plaintexts.

Example

use concrete_core::crypto::{PlaintextCount, encoding::*};
let plain_list = PlaintextList::allocate(1 as u8, PlaintextCount(100));
assert_eq!(plain_list.count(), PlaintextCount(100));

impl<Cont> PlaintextList<Cont>[src]

pub fn from_container(cont: Cont) -> PlaintextList<Cont>[src]

Creates a plaintext list from a container of values.

Example

use concrete_core::crypto::{PlaintextCount, encoding::*};
let plain_list = PlaintextList::from_container(vec![1 as u8; 100]);
assert_eq!(plain_list.count(), PlaintextCount(100));

pub fn from_tensor(tensor: Tensor<Cont>) -> PlaintextList<Cont>[src]

pub fn count(&self) -> PlaintextCount where
    Self: AsRefTensor
[src]

Returns the number of elements in the list.

Example

use concrete_core::crypto::{PlaintextCount, encoding::*};
let plain_list = PlaintextList::from_container(vec![1 as u8; 100]);
assert_eq!(plain_list.count(), PlaintextCount(100));

pub fn plaintext_iter(&self) -> impl Iterator<Item = &Plaintext<Self::Element>> where
    Self: AsRefTensor,
    Self::Element: Numeric
[src]

Creates an iterator over borrowed plaintexts.

Example

use concrete_core::crypto::{PlaintextCount, encoding::*};
let plain_list = PlaintextList::from_container(vec![1 as u8; 100]);
plain_list.plaintext_iter()
    .for_each(|a| assert_eq!(a.0, 1));
assert_eq!(plain_list.plaintext_iter().count(), 100);

pub fn plaintext_iter_mut(
    &mut self
) -> impl Iterator<Item = &mut Plaintext<Self::Element>> where
    Self: AsMutTensor,
    Self::Element: Numeric
[src]

Creates an iterator over mutably borrowed plaintexts.

Example

use concrete_core::crypto::{PlaintextCount, encoding::*};
let mut plain_list = PlaintextList::from_container(vec![1 as u8; 100]);
plain_list.plaintext_iter_mut()
    .for_each(|a| *a = Plaintext(2));
plain_list.plaintext_iter()
    .for_each(|a| assert_eq!(a.0, 2));
assert_eq!(plain_list.plaintext_iter_mut().count(), 100);

pub fn sublist_iter(
    &self,
    count: PlaintextCount
) -> impl Iterator<Item = PlaintextList<&[Self::Element]>> where
    Self: AsRefTensor
[src]

Creates an iterator over borrowed sub-lists.

Example

use concrete_core::crypto::{PlaintextCount, encoding::*};
let mut plain_list = PlaintextList::from_container(vec![1 as u8; 100]);
plain_list.sublist_iter(PlaintextCount(10))
    .for_each(|a| assert_eq!(a.count(), PlaintextCount(10)));
assert_eq!(plain_list.sublist_iter(PlaintextCount(10)).count(), 10);

pub fn sublist_iter_mut(
    &mut self,
    count: PlaintextCount
) -> impl Iterator<Item = PlaintextList<&mut [Self::Element]>> where
    Self: AsMutTensor
[src]

Creates an iterator over mutably borrowed sub-lists.

Example

use concrete_core::crypto::{PlaintextCount, encoding::*};
let mut plain_list = PlaintextList::from_container(vec![1 as u8; 100]);
plain_list.sublist_iter_mut(PlaintextCount(10))
    .for_each(|mut a| a.plaintext_iter_mut().for_each(|b| *b = Plaintext(2)));
plain_list.plaintext_iter()
    .for_each(|a| assert_eq!(*a, Plaintext(2)));
assert_eq!(plain_list.sublist_iter_mut(PlaintextCount(10)).count(), 10);

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

Return a borrowed polynomial whose coefficients are the plaintexts of this list.

Example

use concrete_core::crypto::{PlaintextCount, encoding::*};
use concrete_core::math::polynomial::PolynomialSize;
let plain_list = PlaintextList::from_container(vec![1 as u8; 100]);
let plain_poly = plain_list.as_polynomial();
assert_eq!(plain_poly.polynomial_size(), PolynomialSize(100));

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

Return a mutably borrowed polynomial whose coefficients are the plaintexts of this list.

Example

use concrete_core::crypto::{PlaintextCount, encoding::*};
use concrete_core::math::polynomial::PolynomialSize;
let mut plain_list = PlaintextList::from_container(vec![1 as u8; 100]);
let mut plain_poly = plain_list.as_mut_polynomial();
assert_eq!(plain_poly.polynomial_size(), PolynomialSize(100));

Trait Implementations

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

type Element = Element

The element type.

type Container = Vec<Element>

The container used by the tensor.

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

type Element = Element

The element type.

type Container = [Element; 1]

The container used by the tensor.

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

type Element = Element

The element type.

type Container = AlignedVec<Element>

The container used by the tensor.

impl<'a, Element> AsMutTensor for PlaintextList<&'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 PlaintextList<Vec<Element>>[src]

type Element = Element

The element type.

type Container = Vec<Element>

The container used by the tensor.

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

type Element = Element

The element type.

type Container = AlignedVec<Element>

The container used by the tensor.

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

type Element = Element

The element type.

type Container = [Element; 1]

The container used by the tensor.

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

type Element = Element

The element type.

type Container = &'a [Element]

The container used by the tensor.

impl<'a, Element> AsRefTensor for PlaintextList<&'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 PlaintextList<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 PlaintextList<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 PlaintextList<[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 PlaintextList<&'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 PlaintextList<&'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 PlaintextList<Cont> where
    Cont: RefUnwindSafe

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

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

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

impl<Cont> UnwindSafe for PlaintextList<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.