Trait concrete_core::math::tensor::AsRefTensor [−][src]
A trait for Tensor
-based types, allowing to borrow the enclosed tensor.
This trait is used by the types that build on the Tensor
type to implement multi-dimensional
collections of various kind. In essence, this trait allows to extract a tensor properly
qualified to use all the methods of the Tensor
type:
use concrete_core::math::tensor::{Tensor, AsRefTensor, AsRefSlice}; pub struct Matrix<Cont>{ tensor: Tensor<Cont>, row_length: usize, } pub struct Row<Cont>{ tensor: Tensor<Cont> } impl<Cont> AsRefTensor for Matrix<Cont> where Cont: AsRefSlice{ type Element = Cont::Element; type Container = Cont; fn as_tensor(&self) -> &Tensor<Cont> { &self.tensor } } impl<Cont> Matrix<Cont> { // Returns an iterator over the matrix rows. pub fn row_iter(&self) -> impl Iterator<Item = Row<&[<Self as AsRefTensor>::Element]>> where Self: AsRefTensor { self.as_tensor() // `AsRefTensor` method returning a `&Tensor<Cont>` .as_slice() // Since `Cont` is `AsView`, so is `Tensor<Cont>` .chunks(self.row_length) // Split in chunks of the size of the rows. .map(|sub| Row{tensor: Tensor::from_container(sub)}) // Wraps into a row type. } }
Associated Types
type Element
[src]
The element type.
type Container: AsRefSlice<Element = Self::Element>
[src]
The container used by the tensor.
Required methods
Loading content...Implementors
impl<'a, Element> AsRefTensor for BootstrapKey<&'a [Element]>
[src]
type Element = Element
type Container = &'a [Element]
fn as_tensor(&self) -> &Tensor<Self::Container>
[src]
impl<'a, Element> AsRefTensor for BootstrapKey<&'a mut [Element]>
[src]
type Element = Element
type Container = &'a mut [Element]
fn as_tensor(&self) -> &Tensor<Self::Container>
[src]
impl<'a, Element> AsRefTensor for CleartextList<&'a [Element]>
[src]
type Element = Element
type Container = &'a [Element]
fn as_tensor(&self) -> &Tensor<Self::Container>
[src]
impl<'a, Element> AsRefTensor for CleartextList<&'a mut [Element]>
[src]
type Element = Element
type Container = &'a mut [Element]
fn as_tensor(&self) -> &Tensor<Self::Container>
[src]
impl<'a, Element> AsRefTensor for PlaintextList<&'a [Element]>
[src]
type Element = Element
type Container = &'a [Element]
fn as_tensor(&self) -> &Tensor<Self::Container>
[src]
impl<'a, Element> AsRefTensor for PlaintextList<&'a mut [Element]>
[src]
type Element = Element
type Container = &'a mut [Element]
fn as_tensor(&self) -> &Tensor<Self::Container>
[src]
impl<'a, Element> AsRefTensor for GgswCiphertext<&'a [Element]>
[src]
type Element = Element
type Container = &'a [Element]
fn as_tensor(&self) -> &Tensor<Self::Container>
[src]
impl<'a, Element> AsRefTensor for GgswCiphertext<&'a mut [Element]>
[src]
type Element = Element
type Container = &'a mut [Element]
fn as_tensor(&self) -> &Tensor<Self::Container>
[src]
impl<'a, Element> AsRefTensor for GgswLevelMatrix<&'a [Element]>
[src]
type Element = Element
type Container = &'a [Element]
fn as_tensor(&self) -> &Tensor<Self::Container>
[src]
impl<'a, Element> AsRefTensor for GgswLevelMatrix<&'a mut [Element]>
[src]
type Element = Element
type Container = &'a mut [Element]
fn as_tensor(&self) -> &Tensor<Self::Container>
[src]
impl<'a, Element> AsRefTensor for GgswLevelRow<&'a [Element]>
[src]
type Element = Element
type Container = &'a [Element]
fn as_tensor(&self) -> &Tensor<Self::Container>
[src]
impl<'a, Element> AsRefTensor for GgswLevelRow<&'a mut [Element]>
[src]
type Element = Element
type Container = &'a mut [Element]
fn as_tensor(&self) -> &Tensor<Self::Container>
[src]
impl<'a, Element> AsRefTensor for GlweBody<&'a [Element]>
[src]
type Element = Element
type Container = &'a [Element]
fn as_tensor(&self) -> &Tensor<Self::Container>
[src]
impl<'a, Element> AsRefTensor for GlweBody<&'a mut [Element]>
[src]
type Element = Element
type Container = &'a mut [Element]
fn as_tensor(&self) -> &Tensor<Self::Container>
[src]
impl<'a, Element> AsRefTensor for GlweCiphertext<&'a [Element]>
[src]
type Element = Element
type Container = &'a [Element]
fn as_tensor(&self) -> &Tensor<Self::Container>
[src]
impl<'a, Element> AsRefTensor for GlweCiphertext<&'a mut [Element]>
[src]
type Element = Element
type Container = &'a mut [Element]
fn as_tensor(&self) -> &Tensor<Self::Container>
[src]
impl<'a, Element> AsRefTensor for GlweList<&'a [Element]>
[src]
type Element = Element
type Container = &'a [Element]
fn as_tensor(&self) -> &Tensor<Self::Container>
[src]
impl<'a, Element> AsRefTensor for GlweList<&'a mut [Element]>
[src]
type Element = Element
type Container = &'a mut [Element]
fn as_tensor(&self) -> &Tensor<Self::Container>
[src]
impl<'a, Element> AsRefTensor for GlweMask<&'a [Element]>
[src]
type Element = Element
type Container = &'a [Element]
fn as_tensor(&self) -> &Tensor<Self::Container>
[src]
impl<'a, Element> AsRefTensor for GlweMask<&'a mut [Element]>
[src]
type Element = Element
type Container = &'a mut [Element]
fn as_tensor(&self) -> &Tensor<Self::Container>
[src]
impl<'a, Element> AsRefTensor for GlweMaskElement<&'a [Element]>
[src]
type Element = Element
type Container = &'a [Element]
fn as_tensor(&self) -> &Tensor<Self::Container>
[src]
impl<'a, Element> AsRefTensor for GlweMaskElement<&'a mut [Element]>
[src]
type Element = Element
type Container = &'a mut [Element]
fn as_tensor(&self) -> &Tensor<Self::Container>
[src]
impl<'a, Element> AsRefTensor for LweCiphertext<&'a [Element]>
[src]
type Element = Element
type Container = &'a [Element]
fn as_tensor(&self) -> &Tensor<Self::Container>
[src]
impl<'a, Element> AsRefTensor for LweCiphertext<&'a mut [Element]>
[src]
type Element = Element
type Container = &'a mut [Element]
fn as_tensor(&self) -> &Tensor<Self::Container>
[src]
impl<'a, Element> AsRefTensor for LweKeyswitchKey<&'a [Element]>
[src]
type Element = Element
type Container = &'a [Element]
fn as_tensor(&self) -> &Tensor<Self::Container>
[src]
impl<'a, Element> AsRefTensor for LweKeyswitchKey<&'a mut [Element]>
[src]
type Element = Element
type Container = &'a mut [Element]
fn as_tensor(&self) -> &Tensor<Self::Container>
[src]
impl<'a, Element> AsRefTensor for LweList<&'a [Element]>
[src]
type Element = Element
type Container = &'a [Element]
fn as_tensor(&self) -> &Tensor<Self::Container>
[src]
impl<'a, Element> AsRefTensor for LweList<&'a mut [Element]>
[src]
type Element = Element
type Container = &'a mut [Element]
fn as_tensor(&self) -> &Tensor<Self::Container>
[src]
impl<'a, Element> AsRefTensor for LweMask<&'a [Element]>
[src]
type Element = Element
type Container = &'a [Element]
fn as_tensor(&self) -> &Tensor<Self::Container>
[src]
impl<'a, Element> AsRefTensor for LweMask<&'a mut [Element]>
[src]
type Element = Element
type Container = &'a mut [Element]
fn as_tensor(&self) -> &Tensor<Self::Container>
[src]
impl<'a, Element> AsRefTensor for GlweSecretKey<&'a [Element]>
[src]
type Element = Element
type Container = &'a [Element]
fn as_tensor(&self) -> &Tensor<Self::Container>
[src]
impl<'a, Element> AsRefTensor for GlweSecretKey<&'a mut [Element]>
[src]
type Element = Element
type Container = &'a mut [Element]
fn as_tensor(&self) -> &Tensor<Self::Container>
[src]
impl<'a, Element> AsRefTensor for LweSecretKey<&'a [Element]>
[src]
type Element = Element
type Container = &'a [Element]
fn as_tensor(&self) -> &Tensor<Self::Container>
[src]
impl<'a, Element> AsRefTensor for LweSecretKey<&'a mut [Element]>
[src]
type Element = Element
type Container = &'a mut [Element]
fn as_tensor(&self) -> &Tensor<Self::Container>
[src]
impl<'a, Element> AsRefTensor for FourierPolynomial<&'a [Element]>
[src]
type Element = Element
type Container = &'a [Element]
fn as_tensor(&self) -> &Tensor<Self::Container>
[src]
impl<'a, Element> AsRefTensor for FourierPolynomial<&'a mut [Element]>
[src]
type Element = Element
type Container = &'a mut [Element]
fn as_tensor(&self) -> &Tensor<Self::Container>
[src]
impl<'a, Element> AsRefTensor for Monomial<&'a [Element]>
[src]
type Element = Element
type Container = &'a [Element]
fn as_tensor(&self) -> &Tensor<Self::Container>
[src]
impl<'a, Element> AsRefTensor for Monomial<&'a mut [Element]>
[src]
type Element = Element
type Container = &'a mut [Element]
fn as_tensor(&self) -> &Tensor<Self::Container>
[src]
impl<'a, Element> AsRefTensor for Polynomial<&'a [Element]>
[src]
type Element = Element
type Container = &'a [Element]
fn as_tensor(&self) -> &Tensor<Self::Container>
[src]
impl<'a, Element> AsRefTensor for Polynomial<&'a mut [Element]>
[src]
type Element = Element
type Container = &'a mut [Element]
fn as_tensor(&self) -> &Tensor<Self::Container>
[src]
impl<'a, Element> AsRefTensor for PolynomialList<&'a [Element]>
[src]
type Element = Element
type Container = &'a [Element]
fn as_tensor(&self) -> &Tensor<Self::Container>
[src]
impl<'a, Element> AsRefTensor for PolynomialList<&'a mut [Element]>
[src]
type Element = Element
type Container = &'a mut [Element]
fn as_tensor(&self) -> &Tensor<Self::Container>
[src]
impl<Cont> AsRefTensor for Tensor<Cont> where
Cont: AsRefSlice,
[src]
Cont: AsRefSlice,