Skip to content

Commit

Permalink
Minor improvements (#258)
Browse files Browse the repository at this point in the history
  • Loading branch information
tlepoint authored Mar 26, 2024
1 parent 0b54b88 commit c5b51b5
Show file tree
Hide file tree
Showing 26 changed files with 466 additions and 383 deletions.
71 changes: 61 additions & 10 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ criterion = "^0.5.1"
doc-comment = "^0.3.3"
env_logger = "^0.11.3"
ethnum = "^1.5.0"
fastdiv = "^0.1.0"
indicatif = "^0.17.8"
itertools = "^0.12.1"
log = "^0.4.21"
Expand Down
4 changes: 4 additions & 0 deletions crates/fhe-math/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,21 @@ fhe-traits = { version = "^0.1.0-beta.8", path = "../fhe-traits" }
fhe-util = { version = "^0.1.0-beta.8", path = "../fhe-util" }

concrete-ntt.workspace = true
derivative = "^2.2.0"
ethnum.workspace = true
fastdiv.workspace = true
itertools.workspace = true
ndarray.workspace = true
num-bigint.workspace = true
num-bigint-dig.workspace = true
num-traits.workspace = true
prost.workspace = true
pulp = "^0.18.9"
rand.workspace = true
rand_chacha.workspace = true
thiserror.workspace = true
zeroize.workspace = true
zeroize_derive.workspace = true
sha2.workspace = true

[build-dependencies]
Expand Down
4 changes: 2 additions & 2 deletions crates/fhe-math/src/rns/scaler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -315,13 +315,13 @@ impl RnsScaler {
let gamma_i = self.gamma.get_unchecked(starting_index + i);
let gamma_shoup_i = self.gamma_shoup.get_unchecked(starting_index + i);

let mut yi = (qi.modulus() * 2
let mut yi = (**qi * 2
- qi.lazy_mul_shoup(qi.reduce_u128(v), *gamma_i, *gamma_shoup_i))
as u128;

if !self.scaling_factor.is_one {
let wi = qi.lazy_reduce_u128(w);
yi += if w_sign { qi.modulus() * 2 - wi } else { wi } as u128;
yi += if w_sign { **qi * 2 - wi } else { wi } as u128;
}

debug_assert!(rests.len() <= omega_i.len());
Expand Down
Loading

0 comments on commit c5b51b5

Please sign in to comment.