Struct concrete_core::crypto::encoding::PlaintextList [−][src]
pub struct PlaintextList<Cont> { /* fields omitted */ }
Expand description
A list of plaintexts
Implementations
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));
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));
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 as AsRefTensor>::Element>> where
Self: AsRefTensor,
<Self as AsRefTensor>::Element: Numeric,
pub fn plaintext_iter(
&self
) -> impl Iterator<Item = &Plaintext<<Self as AsRefTensor>::Element>> where
Self: AsRefTensor,
<Self as AsRefTensor>::Element: Numeric,
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 as AsMutTensor>::Element>> where
Self: AsMutTensor,
<Self as AsMutTensor>::Element: Numeric,
pub fn plaintext_iter_mut(
&mut self
) -> impl Iterator<Item = &mut Plaintext<<Self as AsMutTensor>::Element>> where
Self: AsMutTensor,
<Self as AsMutTensor>::Element: Numeric,
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 as AsRefTensor>::Element]>> where
Self: AsRefTensor,
pub fn sublist_iter(
&self,
count: PlaintextCount
) -> impl Iterator<Item = PlaintextList<&[<Self as AsRefTensor>::Element]>> where
Self: AsRefTensor,
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 as AsMutTensor>::Element]>> where
Self: AsMutTensor,
pub fn sublist_iter_mut(
&mut self,
count: PlaintextCount
) -> impl Iterator<Item = PlaintextList<&mut [<Self as AsMutTensor>::Element]>> where
Self: AsMutTensor,
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 as AsRefTensor>::Element]> where
Self: AsRefTensor,
pub fn as_polynomial(&self) -> Polynomial<&[<Self as AsRefTensor>::Element]> where
Self: AsRefTensor,
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 as AsRefTensor>::Element]> where
Self: AsMutTensor,
pub fn as_mut_polynomial(
&mut self
) -> Polynomial<&mut [<Self as AsRefTensor>::Element]> where
Self: AsMutTensor,
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
type Element = Element
type Element = Element
The element type.
Returns a mutable reference to the enclosed tensor.
type Element = Element
type Element = Element
The element type.
Returns a mutable reference to the enclosed tensor.
type Element = Element
type Element = Element
The element type.
type Container = AlignedVec<Element>
type Container = AlignedVec<Element>
The container used by the tensor.
Returns a mutable reference to the enclosed tensor.
type Element = Element
type Element = Element
The element type.
type Container = &'a mut [Element]
type Container = &'a mut [Element]
The container used by the tensor.
Returns a mutable reference to the enclosed tensor.
type Element = Element
type Element = Element
The element type of the collection container.
type Container = AlignedVec<Element>
type Container = AlignedVec<Element>
The type of the collection container.
Consumes self
and returns an owned tensor.
type Element = Element
type Element = Element
The element type of the collection container.
type Container = &'a [Element]
type Container = &'a [Element]
The type of the collection container.
Consumes self
and returns an owned tensor.
type Element = Element
type Element = Element
The element type of the collection container.
type Container = &'a mut [Element]
type Container = &'a mut [Element]
The type of the collection container.
Consumes self
and returns an owned tensor.
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,