Skip to content
New issue

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

[bug]simulator可能存在计算错误 #50

Open
didaozi opened this issue Apr 17, 2024 · 1 comment
Open

[bug]simulator可能存在计算错误 #50

didaozi opened this issue Apr 17, 2024 · 1 comment

Comments

@didaozi
Copy link
Contributor

didaozi commented Apr 17, 2024

QINIT 1
CREG 1
RX q[0], (-1.57)
RZ q[0], (1.57)
H q[0]
MEASURE q[0],c[0]

这个线路应该和

QINIT 1
CREG 1
X q[0]
MEASURE q[0],c[0]

结果一致,pyqpanda模拟结果分别为{'0': 3.170681151136739e-07, '1': 0.9999996829318852},{'0': 0.0, '1': 1.0},与理论预期一致; 但qpandalite分别为[0.9999996829318849, 3.170681151136738e-07]和[0.0, 1.0],排除了顺序问题确实有误。将H q[0]替换为RY q[0], (-1.57)时同样有问题。

@YunJ1e
Copy link
Contributor

YunJ1e commented Apr 17, 2024

quick update:

qpandalite.simulator没有问题,如果结果不对可能在parser上,需要进一步排查。

import qpandalite.simulator as qsim

sim = qsim.Simulator()
sim.init_n_qubit(1)
# sim.x(0)
sim.rx(0, -1.57)
sim.rz(0, 1.57)
sim.hadamard(0)

print(sim.state)
print(sim.pmeasure(0))

returns

[(0.00039832185787549583+0.0003980047897352759j), (0.9999997622620077-0.0003980047897352759j)]
[3.1706811511360793e-07, 0.9999996829318846]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants