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

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));

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);

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

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.

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.

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 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.