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

Classical control gives wrong results #5

Closed
perak opened this issue Jan 20, 2019 · 0 comments
Closed

Classical control gives wrong results #5

perak opened this issue Jan 20, 2019 · 0 comments
Labels

Comments

@perak
Copy link
Collaborator

perak commented Jan 20, 2019

When gate is controlled by classical register, measurement gives correct results, but probabilities and state vector are not correct.

Example circuit:

OPENQASM 2.0;
include "qelib1.inc";
qreg q[2];
creg c[1];
h q[0];
measure q[0] -> c[0];
if(c==1) x q[1];

Result of measurement is correct: [0, 0] or [1, 1]

Probabilities are wrong:

[0.5, 0] or [0.5, 1]

Expected is:

[0, 0] or [1, 1]

State is wrong. It returns:

0.70710680+0.00000000i|00>	50.00000%
0.70710680+0.00000000i|10>	50.00000%

OR

0.70710680+0.00000000i|11>	50.00000%
0.70710680+0.00000000i|10>	50.00000%

But expected is:

0.70710680+0.00000000i|00>	100.00000%

OR

0.70710680+0.00000000i|11>	100.00000%
@perak perak added the bug label Jan 20, 2019
@perak perak closed this as completed in aa346d0 Jan 25, 2019
perak pushed a commit that referenced this issue Jul 8, 2024
fix errors and warnings and apply formatting
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant