Struct concrete_core::crypto::ggsw::GgswLevelMatrix [−][src]
pub struct GgswLevelMatrix<Cont> { /* fields omitted */ }
Expand description
A matrix containing a single level of gadget decomposition.
Implementations
pub fn from_container(
cont: Cont,
poly_size: PolynomialSize,
rlwe_size: GlweSize,
level: DecompositionLevel
) -> Self where
Cont: AsRefSlice,
pub fn from_container(
cont: Cont,
poly_size: PolynomialSize,
rlwe_size: GlweSize,
level: DecompositionLevel
) -> Self where
Cont: AsRefSlice,
Creates a GGSW level matrix from an arbitrary container.
Example
use concrete_core::crypto::ggsw::GgswLevelMatrix; use concrete_core::crypto::GlweSize; use concrete_core::math::decomposition::DecompositionLevel; use concrete_core::math::polynomial::PolynomialSize; let level_matrix = GgswLevelMatrix::from_container( vec![0 as u8; 10 * 7 * 7], PolynomialSize(10), GlweSize(7), DecompositionLevel(1) ); assert_eq!(level_matrix.polynomial_size(), PolynomialSize(10)); assert_eq!(level_matrix.glwe_size(), GlweSize(7)); assert_eq!(level_matrix.decomposition_level(), DecompositionLevel(1));
Returns the size of the GLWE ciphertexts composing the GGSW level matrix.
This is also the number of columns of the matrix (assuming it is a matrix of polynomials) , as well as its number of rows.
Example
use concrete_core::crypto::ggsw::GgswLevelMatrix; use concrete_core::crypto::GlweSize; use concrete_core::math::decomposition::DecompositionLevel; use concrete_core::math::polynomial::PolynomialSize; let level_matrix = GgswLevelMatrix::from_container( vec![0 as u8; 10 * 7 * 7], PolynomialSize(10), GlweSize(7), DecompositionLevel(1) ); assert_eq!(level_matrix.glwe_size(), GlweSize(7));
Returns the index of the level corresponding to this matrix.
Example
use concrete_core::crypto::ggsw::GgswLevelMatrix; use concrete_core::crypto::GlweSize; use concrete_core::math::decomposition::DecompositionLevel; use concrete_core::math::polynomial::PolynomialSize; let level_matrix = GgswLevelMatrix::from_container( vec![0 as u8; 10 * 7 * 7], PolynomialSize(10), GlweSize(7), DecompositionLevel(1) ); assert_eq!(level_matrix.decomposition_level(), DecompositionLevel(1));
Returns the size of the polynomials of the current ciphertext.
Example
use concrete_core::crypto::ggsw::GgswLevelMatrix; use concrete_core::crypto::GlweSize; use concrete_core::math::decomposition::DecompositionLevel; use concrete_core::math::polynomial::PolynomialSize; let level_matrix = GgswLevelMatrix::from_container( vec![0 as u8; 10 * 7 * 7], PolynomialSize(10), GlweSize(7), DecompositionLevel(1) ); assert_eq!(level_matrix.polynomial_size(), PolynomialSize(10));
pub fn row_iter(
&self
) -> impl Iterator<Item = GgswLevelRow<&[<Self as AsRefTensor>::Element]>> where
Self: AsRefTensor,
pub fn row_iter(
&self
) -> impl Iterator<Item = GgswLevelRow<&[<Self as AsRefTensor>::Element]>> where
Self: AsRefTensor,
Returns an iterator over the borrowed rows of the matrix.
Example
use concrete_core::crypto::ggsw::GgswLevelMatrix; use concrete_core::crypto::GlweSize; use concrete_core::math::decomposition::DecompositionLevel; use concrete_core::math::polynomial::PolynomialSize; let level_matrix = GgswLevelMatrix::from_container( vec![0 as u8; 10 * 7 * 7], PolynomialSize(10), GlweSize(7), DecompositionLevel(1) ); for row in level_matrix.row_iter(){ assert_eq!(row.glwe_size(), GlweSize(7)); assert_eq!(row.polynomial_size(), PolynomialSize(10)); } assert_eq!(level_matrix.row_iter().count(), 7);
pub fn row_iter_mut(
&mut self
) -> impl Iterator<Item = GgswLevelRow<&mut [<Self as AsRefTensor>::Element]>> where
Self: AsMutTensor,
pub fn row_iter_mut(
&mut self
) -> impl Iterator<Item = GgswLevelRow<&mut [<Self as AsRefTensor>::Element]>> where
Self: AsMutTensor,
Returns an iterator over the mutably borrowed rows of the matrix.
Example
use concrete_core::crypto::ggsw::GgswLevelMatrix; use concrete_core::crypto::GlweSize; use concrete_core::math::tensor::{AsMutTensor, AsRefTensor}; use concrete_core::math::polynomial::PolynomialSize; use concrete_core::math::decomposition::DecompositionLevel; let mut level_matrix = GgswLevelMatrix::from_container( vec![0 as u8; 10 * 7 * 7], PolynomialSize(10), GlweSize(7), DecompositionLevel(1) ); for mut row in level_matrix.row_iter_mut(){ row.as_mut_tensor().fill_with_element(9); } assert!(level_matrix.as_tensor().iter().all(|a| *a == 9)); assert_eq!(level_matrix.row_iter_mut().count(), 7);
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 GgswLevelMatrix<Cont> where
Cont: RefUnwindSafe,
impl<Cont> Send for GgswLevelMatrix<Cont> where
Cont: Send,
impl<Cont> Sync for GgswLevelMatrix<Cont> where
Cont: Sync,
impl<Cont> Unpin for GgswLevelMatrix<Cont> where
Cont: Unpin,
impl<Cont> UnwindSafe for GgswLevelMatrix<Cont> where
Cont: UnwindSafe,