Struct concrete_core::crypto::glwe::GlweList[][src]

pub struct GlweList<Cont> { /* fields omitted */ }
Expand description

A list of ciphertexts encoded with the GLWE scheme.

Implementations

Allocates storage for an owned GlweList.

Example

use concrete_core::crypto::glwe::GlweList;
use concrete_core::math::polynomial::PolynomialSize;
use concrete_core::crypto::{GlweSize, CiphertextCount, GlweDimension};
let list = GlweList::allocate(
    0 as u8,
    PolynomialSize(10),
    GlweDimension(20),
    CiphertextCount(30)
);
assert_eq!(list.ciphertext_count(), CiphertextCount(30));
assert_eq!(list.polynomial_size(), PolynomialSize(10));
assert_eq!(list.glwe_size(), GlweSize(21));
assert_eq!(list.glwe_dimension(), GlweDimension(20));

Creates a list from a container of values.

use concrete_core::crypto::glwe::GlweList;
use concrete_core::math::polynomial::PolynomialSize;
use concrete_core::crypto::{GlweSize, CiphertextCount, GlweDimension};
let list = GlweList::from_container(
    vec![0 as u8; 10 * 21 * 30],
    GlweDimension(20),
    PolynomialSize(10),
);
assert_eq!(list.ciphertext_count(), CiphertextCount(30));
assert_eq!(list.polynomial_size(), PolynomialSize(10));
assert_eq!(list.glwe_size(), GlweSize(21));
assert_eq!(list.glwe_dimension(), GlweDimension(20));

Returns the number of ciphertexts in the list.

Example

use concrete_core::crypto::glwe::GlweList;
use concrete_core::math::polynomial::PolynomialSize;
use concrete_core::crypto::{GlweSize, CiphertextCount, GlweDimension};
let list = GlweList::allocate(
    0 as u8,
    PolynomialSize(10),
    GlweDimension(20),
    CiphertextCount(30)
);
assert_eq!(list.ciphertext_count(), CiphertextCount(30));

Returns the size of the glwe ciphertexts contained in the list.

Example

use concrete_core::crypto::glwe::GlweList;
use concrete_core::math::polynomial::PolynomialSize;
use concrete_core::crypto::{GlweDimension, CiphertextCount, GlweSize};
let list = GlweList::allocate(
    0 as u8,
    PolynomialSize(10),
    GlweDimension(20),
    CiphertextCount(30)
);
assert_eq!(list.glwe_size(), GlweSize(21));

Returns the number of coefficients of the polynomials used for the list ciphertexts.

Example

use concrete_core::crypto::glwe::GlweList;
use concrete_core::math::polynomial::PolynomialSize;
use concrete_core::crypto::{GlweSize, CiphertextCount, GlweDimension};
let list = GlweList::allocate(
    0 as u8,
    PolynomialSize(10),
    GlweDimension(20),
    CiphertextCount(30)
);
assert_eq!(list.polynomial_size(), PolynomialSize(10));

Returns the number of masks of the ciphertexts in the list.

Example

use concrete_core::crypto::glwe::GlweList;
use concrete_core::math::polynomial::PolynomialSize;
use concrete_core::crypto::{GlweSize, CiphertextCount, GlweDimension};
let list = GlweList::allocate(
    0 as u8,
    PolynomialSize(10),
    GlweDimension(20),
    CiphertextCount(30)
);
assert_eq!(list.glwe_dimension(), GlweDimension(20));

Returns an iterator over ciphertexts borrowed from the list.

Example

use concrete_core::crypto::glwe::{GlweList, GlweBody};
use concrete_core::math::polynomial::PolynomialSize;
use concrete_core::crypto::{GlweSize, CiphertextCount, GlweDimension};
use concrete_core::math::tensor::AsRefTensor;
let list = GlweList::allocate(
    0 as u8,
    PolynomialSize(10),
    GlweDimension(20),
    CiphertextCount(30)
);
for ciphertext in list.ciphertext_iter(){
    let (body, masks) = ciphertext.get_body_and_mask();
    assert_eq!(body.as_polynomial().polynomial_size(), PolynomialSize(10));
}
assert_eq!(list.ciphertext_iter().count(), 30);

Returns an iterator over ciphertexts borrowed from the list.

Example

use concrete_core::crypto::glwe::{GlweList, GlweBody};
use concrete_core::math::polynomial::PolynomialSize;
use concrete_core::crypto::{GlweSize, CiphertextCount, GlweDimension};
use concrete_core::math::tensor::{AsMutTensor, AsRefTensor};
let mut list = GlweList::allocate(
    0 as u8,
    PolynomialSize(10),
    GlweDimension(20),
    CiphertextCount(30)
);
for mut ciphertext in list.ciphertext_iter_mut(){
    let mut body = ciphertext.get_mut_body();
    body.as_mut_tensor().fill_with_element(9);
}
for ciphertext in list.ciphertext_iter(){
    let body = ciphertext.get_body();
    assert!(body.as_tensor().iter().all(|a| *a == 9));
}
assert_eq!(list.ciphertext_iter_mut().count(), 30);

Trait Implementations

The element type.

The container used by the tensor.

Returns a mutable reference to the enclosed tensor.

The element type.

The container used by the tensor.

Returns a mutable reference to the enclosed tensor.

The element type.

The container used by the tensor.

Returns a mutable reference to the enclosed tensor.

The element type.

The container used by the tensor.

Returns a mutable reference to the enclosed tensor.

The element type.

The container used by the tensor.

Returns a reference to the enclosed tensor.

The element type.

The container used by the tensor.

Returns a reference to the enclosed tensor.

The element type.

The container used by the tensor.

Returns a reference to the enclosed tensor.

The element type.

The container used by the tensor.

Returns a reference to the enclosed tensor.

The element type.

The container used by the tensor.

Returns a reference to the enclosed tensor.

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Deserialize this value from the given Serde deserializer. Read more

The element type of the collection container.

The type of the collection container.

Consumes self and returns an owned tensor.

The element type of the collection container.

The type of the collection container.

Consumes self and returns an owned tensor.

The element type of the collection container.

The type of the collection container.

Consumes self and returns an owned tensor.

The element type of the collection container.

The type of the collection container.

Consumes self and returns an owned tensor.

The element type of the collection container.

The type of the collection container.

Consumes self and returns an owned tensor.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

Should always be Self

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.