mimc_run.py 文件源码

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

项目:mimclib 作者: StochasticNumerics 项目源码 文件源码
def transNK(self, d, N, problem_arg=0):
        # return np.arange(0, N), np.arange(0, N)
        # Each ind has 2*|ind|_0 samples
        indSet = setutil.GenTDSet(d, N, base=0)
        N_per_ind = 2**np.sum(indSet!=0, axis=1)
        if problem_arg == 1:
            N_per_ind[1:] /= 2
        _, k_ind = np.unique(np.sum(indSet, axis=1), return_inverse=True)
        k_of_N = np.repeat(k_ind, N_per_ind.astype(np.int))[:N]
        # N_of_k = [j+np.arange(0, i, dtype=np.uint) for i, j in
        #           zip(N_per_ind, np.hstack((np.array([0],
        #                                              dtype=np.uint),
        #                                     np.cumsum(N_per_ind)[:np.max(k_of_N)])))]
        return k_of_N
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号