Struct concrete_core::math::polynomial::PolynomialList [−][src]
A generic polynomial list type.
This type represents a set of polynomial of homogeneous degree.
Example
use concrete_core::math::polynomial::{PolynomialList, PolynomialSize, PolynomialCount}; let list = PolynomialList::from_container(vec![1u8,2,3,4,5,6,7,8], PolynomialSize(2)); assert_eq!(list.polynomial_count(), PolynomialCount(4)); assert_eq!(list.polynomial_size(), PolynomialSize(2));
Implementations
impl<Coef> PolynomialList<Vec<Coef>> where
Coef: Copy,
[src]
Coef: Copy,
pub fn allocate(
value: Coef,
number: PolynomialCount,
size: PolynomialSize
) -> Self
[src]
value: Coef,
number: PolynomialCount,
size: PolynomialSize
) -> Self
Allocates a new polynomial list.
Example
use concrete_core::math::polynomial::{PolynomialList, PolynomialSize, PolynomialCount}; let list = PolynomialList::allocate(1u8, PolynomialCount(10), PolynomialSize(2)); assert_eq!(list.polynomial_count(), PolynomialCount(10)); assert_eq!(list.polynomial_size(), PolynomialSize(2));
impl<Cont> PolynomialList<Cont>
[src]
pub fn from_container(
cont: Cont,
poly_size: PolynomialSize
) -> PolynomialList<Cont> where
Cont: AsRefSlice,
[src]
cont: Cont,
poly_size: PolynomialSize
) -> PolynomialList<Cont> where
Cont: AsRefSlice,
Creates a polynomial list from a list of values.
Example
use concrete_core::math::polynomial::{PolynomialList, PolynomialSize, PolynomialCount}; let list = PolynomialList::from_container(vec![1u8,2,3,4,5,6,7,8], PolynomialSize(2)); assert_eq!(list.polynomial_count(), PolynomialCount(4)); assert_eq!(list.polynomial_size(), PolynomialSize(2));
pub fn polynomial_count(&self) -> PolynomialCount where
Self: AsRefTensor,
[src]
Self: AsRefTensor,
Returns the number of polynomials in the list.
Example
use concrete_core::math::polynomial::{PolynomialList, PolynomialSize, PolynomialCount}; let list = PolynomialList::allocate(1u8, PolynomialCount(10), PolynomialSize(2)); assert_eq!(list.polynomial_count(), PolynomialCount(10));
pub fn polynomial_size(&self) -> PolynomialSize
[src]
Returns the size of the polynomials in the list.
Example
use concrete_core::math::polynomial::{PolynomialList, PolynomialSize, PolynomialCount}; let list = PolynomialList::allocate(1u8, PolynomialCount(10), PolynomialSize(2)); assert_eq!(list.polynomial_size(), PolynomialSize(2));
pub fn get_polynomial(&self, n: usize) -> Polynomial<&[Self::Element]> where
Self: AsRefTensor,
[src]
Self: AsRefTensor,
Returns a reference to the n-th polynomial of the list.
Example
use concrete_core::math::polynomial::{PolynomialList, PolynomialSize, PolynomialCount, MonomialDegree}; let list = PolynomialList::from_container(vec![1u8,2,3,4,5,6,7,8], PolynomialSize(2)); let poly = list.get_polynomial(2); assert_eq!(*poly.get_monomial(MonomialDegree(0)).get_coefficient(), 5u8); assert_eq!(*poly.get_monomial(MonomialDegree(1)).get_coefficient(), 6u8);
pub fn get_mut_polynomial(
&mut self,
n: usize
) -> Polynomial<&mut [Self::Element]> where
Self: AsMutTensor,
[src]
&mut self,
n: usize
) -> Polynomial<&mut [Self::Element]> where
Self: AsMutTensor,
Returns a mutable reference to the n-th polynomial of the list.
Example
use concrete_core::math::polynomial::{PolynomialList, PolynomialSize, MonomialDegree}; let mut list = PolynomialList::from_container(vec![1u8,2,3,4,5,6,7,8], PolynomialSize(2)); let mut poly = list.get_mut_polynomial(2); poly.get_mut_monomial(MonomialDegree(0)).set_coefficient(10u8); poly.get_mut_monomial(MonomialDegree(1)).set_coefficient(11u8); let poly = list.get_polynomial(2); assert_eq!(*poly.get_monomial(MonomialDegree(0)).get_coefficient(), 10u8); assert_eq!(*poly.get_monomial(MonomialDegree(1)).get_coefficient(), 11u8);
pub fn polynomial_iter(
&self
) -> impl Iterator<Item = Polynomial<&[Self::Element]>> where
Self: AsRefTensor,
[src]
&self
) -> impl Iterator<Item = Polynomial<&[Self::Element]>> where
Self: AsRefTensor,
Returns an iterator over references to the polynomials contained in the list.
Example
use concrete_core::math::polynomial::{PolynomialList, PolynomialSize, MonomialDegree}; let mut list = PolynomialList::from_container(vec![1u8,2,3,4,5,6,7,8], PolynomialSize(2)); for polynomial in list.polynomial_iter(){ assert_eq!(polynomial.polynomial_size(), PolynomialSize(2)); } assert_eq!(list.polynomial_iter().count(), 4);
pub fn polynomial_iter_mut(
&mut self
) -> impl Iterator<Item = Polynomial<&mut [Self::Element]>> where
Self: AsMutTensor,
[src]
&mut self
) -> impl Iterator<Item = Polynomial<&mut [Self::Element]>> where
Self: AsMutTensor,
Returns an iterator over mutable references to the polynomials contained in the list.
Example
use concrete_core::math::polynomial::{PolynomialList, PolynomialSize, MonomialDegree}; let mut list = PolynomialList::from_container(vec![1u8,2,3,4,5,6,7,8], PolynomialSize(2)); for mut polynomial in list.polynomial_iter_mut(){ polynomial.get_mut_monomial(MonomialDegree(0)).set_coefficient(10u8); assert_eq!(polynomial.polynomial_size(), PolynomialSize(2)); } for polynomial in list.polynomial_iter(){ assert_eq!(*polynomial.get_monomial(MonomialDegree(0)).get_coefficient(), 10u8); } assert_eq!(list.polynomial_iter_mut().count(), 4);
pub fn update_with_wrapping_monic_monomial_mul<Coef>(
&mut self,
monomial_degree: MonomialDegree
) where
Self: AsMutTensor<Element = Coef>,
Coef: UnsignedInteger,
[src]
&mut self,
monomial_degree: MonomialDegree
) where
Self: AsMutTensor<Element = Coef>,
Coef: UnsignedInteger,
Multiplies (mod $(X^N+1)$), all the polynomials of the list with a unit monomial of a given degree.
Examples
use concrete_core::math::polynomial::{MonomialDegree, PolynomialList, PolynomialSize}; let mut list = PolynomialList::from_container(vec![1u8,2,3,4,5,6], PolynomialSize(3)); list.update_with_wrapping_monic_monomial_mul(MonomialDegree(2)); let poly = list.get_polynomial(0); assert_eq!(*poly.get_monomial(MonomialDegree(0)).get_coefficient(), 254); assert_eq!(*poly.get_monomial(MonomialDegree(1)).get_coefficient(), 253); assert_eq!(*poly.get_monomial(MonomialDegree(2)).get_coefficient(), 1);
pub fn update_with_wrapping_monic_monomial_div<Coef>(
&mut self,
monomial_degree: MonomialDegree
) where
Self: AsMutTensor<Element = Coef>,
Coef: UnsignedInteger,
[src]
&mut self,
monomial_degree: MonomialDegree
) where
Self: AsMutTensor<Element = Coef>,
Coef: UnsignedInteger,
Divides (mod $(X^N+1)$), all the polynomials of the list with a unit monomial of a given degree.
Examples
use concrete_core::math::polynomial::{MonomialDegree, PolynomialList, PolynomialSize}; let mut list = PolynomialList::from_container(vec![1u8,2,3,4,5,6], PolynomialSize(3)); list.update_with_wrapping_monic_monomial_div(MonomialDegree(2)); let poly = list.get_polynomial(0); assert_eq!(*poly.get_monomial(MonomialDegree(0)).get_coefficient(), 3); assert_eq!(*poly.get_monomial(MonomialDegree(1)).get_coefficient(), 255); assert_eq!(*poly.get_monomial(MonomialDegree(2)).get_coefficient(), 254);
Trait Implementations
impl<Element> AsMutTensor for PolynomialList<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 PolynomialList<[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 PolynomialList<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 PolynomialList<&'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 PolynomialList<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 PolynomialList<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 PolynomialList<[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 PolynomialList<&'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 PolynomialList<&'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 PolynomialList<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 PolynomialList<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 PolynomialList<[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 PolynomialList<&'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 PolynomialList<&'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]
impl<Cont: PartialEq> PartialEq<PolynomialList<Cont>> for PolynomialList<Cont>
[src]
fn eq(&self, other: &PolynomialList<Cont>) -> bool
[src]
fn ne(&self, other: &PolynomialList<Cont>) -> bool
[src]
impl<Cont> StructuralPartialEq for PolynomialList<Cont>
[src]
Auto Trait Implementations
impl<Cont> RefUnwindSafe for PolynomialList<Cont> where
Cont: RefUnwindSafe,
Cont: RefUnwindSafe,
impl<Cont> Send for PolynomialList<Cont> where
Cont: Send,
Cont: Send,
impl<Cont> Sync for PolynomialList<Cont> where
Cont: Sync,
Cont: Sync,
impl<Cont> Unpin for PolynomialList<Cont> where
Cont: Unpin,
Cont: Unpin,
impl<Cont> UnwindSafe for PolynomialList<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>,