Skip to content

Commit

Permalink
fixed typo of 'tenary' by 'ternary'
Browse files Browse the repository at this point in the history
  • Loading branch information
inel-desilo committed Jan 2, 2025
1 parent fcfb711 commit 831eadd
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/liberate/fhe/ckks_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def __init__(self, devices: list[int] = None, verbose: bool = False,
num_scales=None,
num_special_primes=2,
sigma=3.2,
uniform_tenary_secret=True,
uniform_ternary_secret=True,
cache_folder='cache/',
security_bits=128,
quantum='post_quantum',
Expand Down
10 changes: 5 additions & 5 deletions src/liberate/fhe/context/ckks_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ def __init__(
num_scales=None,
num_special_primes=2,
sigma=3.2,
uniform_tenary_secret=True,
uniform_ternary_secret=True,
cache_folder=CACHE_FOLDER,
security_bits=128,
quantum="post_quantum",
Expand Down Expand Up @@ -203,11 +203,11 @@ def __init__(
self.distribution = distribution
# Sampling strategy.
self.sigma = sigma
self.uniform_tenary_secret = uniform_tenary_secret
if self.uniform_tenary_secret:
self.secret_key_sampling_method = "uniform tenary"
self.uniform_ternary_secret = uniform_ternary_secret
if self.uniform_ternary_secret:
self.secret_key_sampling_method = "uniform ternary"
else:
self.secret_key_sampling_method = "sparse tenary"
self.secret_key_sampling_method = "sparse ternary"

# dtypes.
self.torch_dtype = {30: torch.int32, 62: torch.int64}[
Expand Down
14 changes: 7 additions & 7 deletions src/liberate/fhe/context/security_parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
# We separate them in respective dictionaries.
#
# Also, there are 3 different methods of sampling the messages according to respective distributions.
# Those are uniform, error, and (-1, 1) (tenary).
# We differentiate the message distribution by dictionary keys: 'uniform', 'error', and 'tenary'.
# Those are uniform, error, and (-1, 1) (ternary).
# We differentiate the message distribution by dictionary keys: 'uniform', 'error', and 'ternary'.

# This is the pre-quantum security requirements.
logq_preq = {}
Expand Down Expand Up @@ -60,7 +60,7 @@
613,
478,
]
logq_preq["tenary"] = [
logq_preq["ternary"] = [
27,
19,
14,
Expand Down Expand Up @@ -123,7 +123,7 @@
573,
445,
]
logq_postq["tenary"] = [
logq_postq["ternary"] = [
25,
17,
13,
Expand Down Expand Up @@ -158,7 +158,7 @@ def partitq(q):

# Gather up.
logq = {}
distributions = ["uniform", "error", "tenary"]
distributions = ["uniform", "error", "ternary"]
logq["pre_quantum"] = {
distributions[disti]: partitq(logq_preq[dist])
for disti, dist in enumerate(distributions)
Expand All @@ -176,7 +176,7 @@ def minimum_cyclotomic_order(
"pre_quantum",
"post_quantum",
], "Wrong quantum security model!!!"
assert distribution in ["uniform", "error", "tenary"]
assert distribution in ["uniform", "error", "ternary"]
assert security_bits in [128, 192, 256]

x = logq[quantum][distribution][security_bits]
Expand All @@ -192,7 +192,7 @@ def maximum_qbits(
"pre_quantum",
"post_quantum",
], "Wrong quantum security model!!!"
assert distribution in ["uniform", "error", "tenary"]
assert distribution in ["uniform", "error", "ternary"]
assert security_bits in [128, 192, 256]

x = cyclotomic_n
Expand Down
2 changes: 1 addition & 1 deletion src/liberate/fhe/tests/test_generate_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def ckks_engine(
"num_special_primes": 2,
"buffer_bit_length": 62,
"sigma": 3.2,
"uniform_tenary_secret": True,
"uniform_ternary_secret": True,
"cache_folder": "cache/",
"quantum": "post_quantum",
"distribution": "uniform",
Expand Down

0 comments on commit 831eadd

Please sign in to comment.