Struct concrete_core::crypto::encoding::PlaintextList [−][src]
A list of plaintexts
Implementations
impl<Scalar> PlaintextList<Vec<Scalar>> where
Scalar: Copy,
[src]
Scalar: Copy,
pub fn allocate(
value: Scalar,
count: PlaintextCount
) -> PlaintextList<Vec<Scalar>>
[src]
value: Scalar,
count: PlaintextCount
) -> PlaintextList<Vec<Scalar>>
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]
Self: AsRefTensor,
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]
Self: AsRefTensor,
Self::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::Element>> where
Self: AsMutTensor,
Self::Element: Numeric,
[src]
&mut self
) -> impl Iterator<Item = &mut Plaintext<Self::Element>> where
Self: AsMutTensor,
Self::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::Element]>> where
Self: AsRefTensor,
[src]
&self,
count: PlaintextCount
) -> impl Iterator<Item = PlaintextList<&[Self::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::Element]>> where
Self: AsMutTensor,
[src]
&mut self,
count: PlaintextCount
) -> impl Iterator<Item = PlaintextList<&mut [Self::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::Element]> where
Self: AsRefTensor,
[src]
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::Element]> where
Self: AsMutTensor,
[src]
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
impl<Element> AsMutTensor for PlaintextList<Vec<Element>>
[src]
type Element = Element
The element type.
type Container = Vec<Element>
The container used by the tensor.
fn as_mut_tensor(&mut self) -> &mut Tensor<Self::Container>
[src]
impl<Element> AsMutTensor for PlaintextList<[Element; 1]>
[src]
type Element = Element
The element type.
type Container = [Element; 1]
The container used by the tensor.
fn as_mut_tensor(&mut self) -> &mut Tensor<Self::Container>
[src]
impl<Element> AsMutTensor for PlaintextList<AlignedVec<Element>>
[src]
type Element = Element
The element type.
type Container = AlignedVec<Element>
The container used by the tensor.
fn as_mut_tensor(&mut self) -> &mut Tensor<Self::Container>
[src]
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.
fn as_mut_tensor(&mut self) -> &mut Tensor<Self::Container>
[src]
impl<Element> AsRefTensor for PlaintextList<Vec<Element>>
[src]
type Element = Element
The element type.
type Container = Vec<Element>
The container used by the tensor.
fn as_tensor(&self) -> &Tensor<Self::Container>
[src]
impl<Element> AsRefTensor for PlaintextList<AlignedVec<Element>>
[src]
type Element = Element
The element type.
type Container = AlignedVec<Element>
The container used by the tensor.
fn as_tensor(&self) -> &Tensor<Self::Container>
[src]
impl<Element> AsRefTensor for PlaintextList<[Element; 1]>
[src]
type Element = Element
The element type.
type Container = [Element; 1]
The container used by the tensor.
fn as_tensor(&self) -> &Tensor<Self::Container>
[src]
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.
fn as_tensor(&self) -> &Tensor<Self::Container>
[src]
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.
fn as_tensor(&self) -> &Tensor<Self::Container>
[src]
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.
fn into_tensor(self) -> Tensor<Self::Container>
[src]
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.
fn into_tensor(self) -> Tensor<Self::Container>
[src]
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.
fn into_tensor(self) -> Tensor<Self::Container>
[src]
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.
fn into_tensor(self) -> Tensor<Self::Container>
[src]
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.
fn into_tensor(self) -> Tensor<Self::Container>
[src]
Auto Trait Implementations
impl<Cont> RefUnwindSafe for PlaintextList<Cont> where
Cont: RefUnwindSafe,
Cont: RefUnwindSafe,
impl<Cont> Send for PlaintextList<Cont> where
Cont: Send,
Cont: Send,
impl<Cont> Sync for PlaintextList<Cont> where
Cont: Sync,
Cont: Sync,
impl<Cont> Unpin for PlaintextList<Cont> where
Cont: Unpin,
Cont: Unpin,
impl<Cont> UnwindSafe for PlaintextList<Cont> where
Cont: UnwindSafe,
Cont: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<Input, Output> CastInto<Output> for Input where
Output: CastFrom<Input>,
[src]
Output: CastFrom<Input>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,