Skip to content

Commit

Permalink
using key variation seems to be fine
Browse files Browse the repository at this point in the history
  • Loading branch information
nindanaoto committed Aug 16, 2022
1 parent 0923715 commit b864083
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
12 changes: 7 additions & 5 deletions python/ConcreteCCbound.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
# 128bit TFHE's parameter.

class lvl0param:
n = 635
α = 2**-15
n = 586
α = 0.00008976167396834998

class lvl1param:
nbit = 9
Expand All @@ -19,7 +19,7 @@ class lvl1param:
l = 2
Bgbit = 8
Bg = 2**Bgbit
α = 2**-25
α = 0.0000000342338787018369
ε = 1/(2*(Bg**l))
β = Bg/2

Expand Down Expand Up @@ -234,20 +234,22 @@ def romnoisecalc(brP,ikP,privksP,ROMaddress):
print(conventionalvariance)
from scipy.special import erfc
print(erfc(1/(16*np.sqrt(2*dists["normal"]))))
print("conventional error rate")
print(erfc(1/(16*np.sqrt(2*conventionalvariance))))

import math
numccfunc, diffccfunc, funwithjac = ccfunc(1/16,dists)

from scipy.optimize import minimize,shgo,dual_annealing
from scipy.optimize import minimize,shgo,dual_annealing,direct

# result = minimize(fun = numccfunc,x0 = np.array([1e-6]), jac = diffccfunc, method = 'Newton-CG')
# print(result['x'])
# print(result['fun'])
# print(2*math.exp(result['fun']))

result = shgo(numccfunc,bounds=[(1e-6,None)],minimizer_kwargs={'method': "SLSQP", 'jac':diffccfunc})
# result = shgo(numccfunc,bounds=[(1e-6,None)],minimizer_kwargs={'method': "SLSQP", 'jac':diffccfunc})
# result = dual_annealing(numccfunc,bounds=[(1e-3,1e5)],initial_temp=1e4)
result = direct(numccfunc,bounds=[(1e-3,1e5)])

print(result.x)
print(result.fun)
Expand Down
4 changes: 2 additions & 2 deletions python/keyvariation.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ class lvl1param:
α = 0.0000000342338787018369 * q

class lvl10param:
t = 4
basebit = 3
t = 3
basebit = 4

variance_key_coefficient = 1./4
expectation_key_coefficient = 1./2
Expand Down

0 comments on commit b864083

Please sign in to comment.