from pyqpanda import *
QCM = QCloud()
QCM.init_qvm("apiKey")
qubits = QCM.qAlloc_many(6)
cbits = QCM.cAlloc_many(6)
# 构建量子程序
prog = QProg()
prog.insert(U3(qubits[0],1.570796,-1.5707963,1.570796))\
.insert(U3(qubits[1],3.1415927,3.1415927,0))\
.insert(U3(qubits[2],0,1.570796,0))\
.insert(U3(qubits[3],3.1415927,1.570796,0))\
.insert(BARRIER([qubits[1],qubits[2]]))\
.insert(U3(qubits[2],1.5707963,0,3.1415927))\
.insert(CZ(qubits[2],qubits[1]))\
.insert(U3(qubits[1],3.1415927,3.1415927,0))\
.insert(U3(qubits[2],1.5707963,1.5707963,3.1415927))\
.insert(CZ(qubits[1],qubits[2]))\
.insert(U3(qubits[1],1.5707963,-3.1415927,0))\
.insert(CZ(qubits[1],qubits[2]))\
.insert(U3(qubits[1],1.5707963,3.1415927,3.1415927))\
.insert(U3(qubits[2],1.5707963,0,3.1415927))\
.insert(CZ(qubits[2],qubits[1]))\
.insert(U3(qubits[1],0,0.78539816,0))\
.insert(U3(qubits[2],1.5707963,0,3.1415927))\
.insert(Measure(qubits[2],cbits[3]))
# 调用真实芯片计算接口,需要量子程序和测量次数两个参数
result = QCM.real_chip_measure(prog, 1000)
QCM.finalize()
量子比特数:6
重复试验次数:1000
脉冲时间:510000ns