We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
您好。
对于特定的量子线路,即使不同的输入,ProbsMeasure的输出结果也是一样的。我不太清楚为什么有这样的结果(ProbsMeasure介绍下给的链接我跳转不到对应页面)。所以,可否提供更多关于 pyvqnet.qnn.measure中ProbsMeasure函数的介绍。
以下是我的代码: `
from pyvqnet.qnn.measure import ProbsMeasure import pyqpanda as pq from pyqpanda.Visualization import draw_qprog import os import warnings warnings.filterwarnings("ignore") dir = os.path.join( os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))), 'results/quantum' ) if __name__ == '__main__': input = [[0.56,0.1], [0, 0.1],[0.1, 1]] for i in range(3): print('input:', input[i]) measure_qubits = [0,2] machine = pq.init_quantum_machine(pq.QMachineType.CPU) m_prog = pq.QProg() m_qlist = machine.qAlloc_many(3) cir = pq.QCircuit() cir.insert(pq.H(m_qlist[0])) cir.insert(pq.H(m_qlist[1])) cir.insert(pq.H(m_qlist[2])) cir.insert(pq.RZ(m_qlist[0], input[i][0])) cir.insert(pq.CNOT(m_qlist[0],m_qlist[1])) cir.insert(pq.RY(m_qlist[1], input[i][1])) cir.insert(pq.CNOT(m_qlist[0], m_qlist[2])) m_prog.insert(cir) rlt_prob = ProbsMeasure([0, 2], m_prog, machine, m_qlist) print('ProbsMeasure output:', rlt_prob) draw_qprog(m_prog, 'pic', filename=dir + '/cir.png')
`
结果:
The text was updated successfully, but these errors were encountered:
@lingjiajie 这个接口实际封装的是qpanda的概率测量接口,对应代码在https://github.com/OriginQ/QPanda-2/blob/a182212503a97981844140b165cb3cee8e293edd/Core/Core.cpp#L241。 具体原理参考https://github.com/OriginQ/Quantum-programming-textbook/blob/main/%E7%AC%AC%E4%BA%8C%E7%AB%A0%E9%87%8F%E5%AD%90%E8%AE%A1%E7%AE%97%E5%9F%BA%E7%A1%80.md中的测量部分。
使用pennylane实现相同代码可以得到一样的结果。 1 (2).txt
Sorry, something went wrong.
No branches or pull requests
您好。
对于特定的量子线路,即使不同的输入,ProbsMeasure的输出结果也是一样的。我不太清楚为什么有这样的结果(ProbsMeasure介绍下给的链接我跳转不到对应页面)。所以,可否提供更多关于 pyvqnet.qnn.measure中ProbsMeasure函数的介绍。
以下是我的代码:
`
`
结果:
The text was updated successfully, but these errors were encountered: