Gaussian_sampling.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:Lattice-Based-Signatures 作者: krishnacharya 项目源码 文件源码
def Bernoulli_cosh(x):
    '''
    Sample according to 1/cosh(x/f)
    Extends corollary 6.4 from BLISS paper
    '''
    powx = abs(x)
    while(True):
        A = Bernoulli_exp(powx) # each iteration this changes as randomness comes from Bernoulli_exp exp(-|x|/f)
        if(A):
            return 1
        B = Bernoulli_rv(0.5) or Bernoulli_exp(powx)  # has to be seperate Bernoulli_exp(powx) call as we dont want dependence on A
        if not(B):          
            return 0
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号