Skip to content

Commit

Permalink
chore(doc): fix modulus struct docstrings in shortint
Browse files Browse the repository at this point in the history
- it stated it represented a number of bits while it represents the actual
modulus
  • Loading branch information
IceTDrinker committed Feb 1, 2024
1 parent 0226570 commit 8a9559c
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions tfhe/src/shortint/parameters/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,22 @@ pub use parameters_wopbs::WopbsParameters;
use super::ciphertext::{Degree, NoiseLevel};
use super::PBSOrder;

/// The number of bits on which the message will be encoded.
/// The modulus of the message space. For a given plaintext $p$ we have the message $m$ defined as
/// $m = p\bmod{MessageModulus}$ and so $0 <= m < MessageModulus$.
///
/// # Note
///
/// The total plaintext modulus is given by $MessageModulus \times CarryModulus$
#[derive(Debug, PartialEq, Eq, Copy, Clone, Serialize, Deserialize)]
pub struct MessageModulus(pub usize);

/// The number of bits on which the carry will be encoded.
/// The modulus of the carry space. For a given plaintext $p$ we have the carry $c$ defined as
/// $c = \frac{p}{MessageModulus}$ and so $0 <= c < CarryModulus$ as the total plaintext modulus is
/// given by $MessageModulus \times CarryModulus$
///
/// # Note
///
/// The total plaintext modulus is given by $MessageModulus \times CarryModulus$
#[derive(Debug, PartialEq, Eq, Copy, Clone, Serialize, Deserialize)]
pub struct CarryModulus(pub usize);

Expand Down

0 comments on commit 8a9559c

Please sign in to comment.