qclib.py 文件源码

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

项目:quantum-computing 作者: QuantumSystems 项目源码 文件源码
def QFT(self,nqbits):
        N = 2**nqbits # number of rows and cols
        theta = 2.0 * np.pi / N
        opmat = [None]*N
        for i in range(N):
            # print "row",i,"--------------------"
            row = []
            for j in range(N):
                pow = i * j
                pow = pow % N
                # print "w^",pow
                row.append(np.e**(1.j*theta*pow))
            opmat[i] = row
        # print opmat
        opmat = np.matrix(opmat,dtype=complex) / np.sqrt(N)
        oper = ["QFT({:d})".format(nqbits),opmat]
        return oper
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号