Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ uint64_t *generate_identity_lut_pbs(int polynomial_size, int glwe_dimension,
// Modulus of the msg contained in the msg bits and operations buffer
uint64_t modulus_sup = message_modulus * carry_modulus;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to change something here or was only a matter of adjusting the comment?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in what way ? normally the code is correct otherwise you would have issues, the reason for the modulus_sup is that the LUT represents the whole plaintext space (so msg + carry)


// N/(p/2) = size of each block
// N/p = size of each box
uint64_t box_size = polynomial_size / modulus_sup;

// Value of the shift we multiply our messages by
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ pub fn generate_programmable_bootstrap_glwe_lut<F, Scalar: UnsignedTorus + CastF
where
F: Fn(Scalar) -> Scalar,
{
// N/(p/2) = size of each block, to correct noise from the input we introduce the
// N = polynomial_size
// p = message_modulus
// N/p = size of each box, to correct noise from the input we introduce the
// notion of box, which manages redundancy to yield a denoised value
// for several noisy values around a true input value.
let box_size = polynomial_size.0 / message_modulus;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,9 @@ fn generate_accumulator_many_lut<Scalar: UnsignedTorus + CastFrom<usize>>(
delta: Scalar,
funcs: &[&dyn Fn(Scalar) -> Scalar],
) -> (GlweCiphertextOwned<Scalar>, usize) {
// N/(p/2) = size of each block, to correct noise from the input we introduce the
// N = polynomial_size
// p = message_modulus
// N/p = size of each box, to correct noise from the input we introduce the
// notion of box, which manages redundancy to yield a denoised value
// for several noisy values around a true input value.
let box_size = polynomial_size.0 / message_modulus;
Expand Down
2 changes: 1 addition & 1 deletion tfhe/src/core_crypto/hpu/entities/glwe_lookuptable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ pub fn create_hpu_lookuptable(
// Modulus of the msg contained in the msg bits and operations buffer
let modulus_sup = 1 << (pbs_p.message_width + pbs_p.carry_width);

// N/(p/2) = size of each block
// N/p = size of each box
let box_size = pbs_p.polynomial_size / modulus_sup;

// Value of the shift we multiply our messages by
Expand Down
4 changes: 2 additions & 2 deletions tfhe/src/shortint/engine/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ where
// Modulus of the msg contained in the msg bits and operations buffer
let input_modulus_sup = (input_message_modulus.0 * input_carry_modulus.0) as usize;

// N/(p/2) = size of each block
// N/p = size of each box
let box_size = polynomial_size.0 / input_modulus_sup;

let mut body = accumulator_view.get_mut_body();
Expand Down Expand Up @@ -193,7 +193,7 @@ where
// Modulus of the msg contained in the msg bits and operations buffer
let modulus_sup = (message_modulus.0 * carry_modulus.0) as usize;

// N/(p/2) = size of each block
// N/p = size of each box
let box_size = polynomial_size.0 / modulus_sup;

let mut body = accumulator_view.get_mut_body();
Expand Down
Loading